You are on page 1of 44

Karnaugh-map (Part2)

By
Dr. Nermeen Talaat
Lecture 9

1
In general
 Map all 1s of the function to the K-map
 Choose the largest power of 2 groups until all the 1 of the
function are covered
 For a 4 variable function
 Group 8 1s – will have 1 literal
 Group 4 1s – will have 2 literals
 Group 2 1s – will have 3 literals
 No group – a lone 1 – term will have all 4 literals
 Sometimes will have a choice on how to cover that last 1.
Make the choice that results in a term with the fewest
literals. Sometimes either of 2 answers are equal.

2
Simplifying functions
 Simplify XY+X’Z+YZ
 Expand to generate minterms
 = XY(Z+Z’) + X’Z(Y+Y’) + (X+X’)YZ
 111 11 0 0 1 1 0 01 1 11 0 1 1
 = XYZ+XYZ’ + X’YZ + X’Y’Z + XYZ+X’YZ
 = m7 + m6 + m3 + m1 + repeat + repeat

 .
3
Simplification Using K-maps
 Example:
F (w,x,y,z) = w’.x.y'.z' + w'.x.y'.z + w.x'.y.z'
+ w.x'.y.z + w.x.y.z' + w.x.y.z
=  m(4, 5, 10, 11, 14, 15)
y = m4+m5+m10+m11+m14+m15
yz
wx 00 01 11 10
00

01 1 1
x (cells with ‘0’ are not
11 1 1 shown for clarity)
w
1 1
10

z
4
Simplification Using K-maps
 Each group of adjacent minterms (group size in powers of
twos) corresponds to a possible product term of the given
function. y
yz
wx 00 01 11 10
00
A
01 1 1
x
11 1 1
w
10 1 1 B

5
Simplification Using K-maps
 There are 2 groups of minterms: A and B, where:
A = w'.x.y'.z' + w‘.x.y'.z
= w'.x.y'.(z' + z)
= w'.x.y'
y
B = w.x'.y.z' + w.x'.y.z + w.x.y.z' + w.x.y.z yz

= w.x'.y.(z' + z) + w.x.y.(z' + z) wx 00 01 11 10

= w.x'.y + w.x.y 00
A
= w.(x'+x).y 01 1 1
x
= w.y 1 1
11
w
10 1 1 B
z
6
Simplification Using K-maps

 Each product term of a group, w'.x.y' and w.y, represents


the sum of minterms in that group.
 Boolean function is therefore the sum of product terms
(SOP) which represent all groups of the minterms of the
function.
F(w,x,y,z) = A + B = w'.x.y' + w.y

7
Simplification Using K-maps
 Other possible valid groupings of a 4-variable K-map
include:

1 1 1 1
1 1 1 1

1 1 1 1

1 1 1 1 1 1
1

P P P

CS1104-5 Simplification Using K-maps 8


Simplification Using K-maps

 Groups of minterms must be


(1) rectangular, and
(2) have size in powers of 2’s.
Otherwise they are invalid groups. Some examples of invalid
groups:
1 1 1 1

1 1 1 1

1 1 1

1 1 1 1 1

O O
9
Converting to Minterms Form

 The K-map of a function is easily drawn when the


function is given in canonical sum-of-products, or sum-
of-minterms form.
 What if the function is not in sum-of-minterms?
 Convert it to sum-of-products (SOP) form.
 Expand the SOP expression into sum-of-minterms
expression, or fill in the K-map directly based on the SOP
expression.

10
Converting to Minterms Form
 Example: f(A,B,C,D) = A+C
f(A,B,C,D) =
A(D+D’)(B'+B)(C+C’)+C(B+B’)(A+A‘)(D+D‘)
A
= AB'C'D' + AC'D'(B+B') + BC + A'CD AB
CD 00 01 11 10
= AB'C'D' + ABC'D' + AB'C'D' + BC(A+A')
+ A'CD 00 1 1

= AB'C'D' + ABC'D' + ABC + A'BC + A'CD 01


D
= AB'C'D' + ABC'D' + ABC(D+D') + 11 1 1 1
A'BC(D+D') + A'CD(B+B') C
10 1 1
= AB'C'D' + ABC'D' + ABCD + ABCD' +
A'BCD + A'BCD' + A'B'CD B

11
Simplest SOP Expressions
 To find the simplest possible sum of products (SOP)
expression from a K-map, you need to obtain:
 minimum number of literals per product term; and
 minimum number of product terms

 This is achieved in K-map using


 bigger groupings of minterms (prime implicants) where possible;
and
 no redundant groupings (look for essential prime implicants)

Implicant: a product term that could be used


to cover minterms of the function.
12
Implicants
 Must cover all 1s of the function on K-map
 Each 1 can be used multiple times in generating
the terms of the expression
 When you group 1’s on a K-map, generating a
term, that term is an implicant of the function
 Prime Implicants
 Essential Prime Implicants

13
Prime Implicant (PI)
 If removal of an any literal from an implicant
P results in a product term that is not an
implicant of the function, then P is a prime
implicant.
 Let’s take a look at this.

14
implicate
 Implicants with 2 1s with 4 1s
A’D
A’B’D A’B
A’BD BD
ABD
A’BC’
A’BC
A’BD’
A’C’D
A’CD
BC’D
BCD

15
Some general statements on P I
 A single 1 on a map is a prime implicant if is
not adjacent to any other 1 of the function.
 Two adjacent 1s on a map represent a prime
implicant, provided that they are not within a
rectangle of 4 or more squares containing 1s.
 Four 1’s that are an implicant are a prime
implicant if they are not within a group of 8.

16
Essential Prime Implicant
 A prime implicant that contains a 1 that is not
covered by any other prime implicant of the
function is an essential prime implicant.
IT MUST BE INCLUDED IN ANY
MINIMAL REPRESENTATION OF THE
FUNCTION.

17
Simplest SOP Expressions
 A prime implicant is a product term obtained by combining
the maximum possible number of minterms from adjacent
squares in the map.
 Use bigger groupings (prime implicants) where possible.

1 1 1 1 1 1

1 1 1
O
1 1 1
P

18
Simplest SOP Expressions
 No redundant groups:
1 1 1 1

1
1

1
1
O 1
1

1
1
P
1 1 1 1

Essential prime implicants


 An essential prime implicant is a prime implicant that
includes at least one minterm that is not covered by any
other prime implicant.

19
Quick Review
Identify the prime implicants and the essential prime
implicants of the two K-maps below.

A
b
AB
bc CD 00 01 11 10
a
00 01 11 10
00 1 1 1
0 1 1 0 1
01 1 1
a D
1 0 1 0 0
11 1 1 1
C
c 10 1 1 1

CS1104-5 Quick Review Questions (2) 20


Simplest SOP Expressions

 Algorithm 1 (non optimal):


1. Count the number of adjacencies for each minterm on the K-map.
2. Select an uncovered minterm with the fewest number of adjacencies.
Make an arbitrary choice if more than one choice is possible.
3. Generate a prime implicant for this minterm and put it in the cover.
If this minterm is covered by more than one prime implicant, select
the one that covers the most uncovered minterms.
4. Repeat steps 2 and 3 until all the minterms have been covered.

21
Simplest SOP Expressions

 Algorithm 2 (non optimal):


1. Circle all prime implicants on the K-map.
2. Identify and select all essential prime implicants for the cover.
3. Select a minimum subset of the remaining prime implicants to
complete the cover, that is, to cover those minterms not covered by
the essential prime implicants.

22
Simplest SOP Expressions
 Example:
f(A,B,C,D) =  m(1,2,4,5,7,8,10,13,15)
A
AB
CD 00 01 11 10

00 1 1
All prime implicants
01 1 1
D
11 1 1 1
C
10 1 1

23
Simplest SOP Expressions
A
AB A
CD 00 01 11 10 AB
CD 00 01 11 10
00
1 1
01
1 1 00 1 1
D

C
11 1 1 1 01 1 1
10 1 1 D
11 1 1 1
B C
10 1 1

B
A
AB
CD 00 01 11 10

00 1 1 Minimum cover
01 1 1
D
11 1 1 1
C
10 1 1

B
24
Simplest SOP Expressions
A
AB
CD 00 01 11 10
A'BC'
00 1 1 AB'D'
01 1 1
D
11 1 1 1
C
10 1 1 BD
B

A'B'C

f(A,B,C,D) = B.D + A'.B'.C + A.B'.D' + A'.B.C'

25
Quick Review

Find the simplified expression for G(A,B,C,D).


A
AB
CD 00 01 11 10

00 1

01 1 1 1
D
11 1 1 1
C
10 1

26
Example
 Consider the example of
Fig 2-13 of text.
 Prime Implicants
 A’D
 BD’
 A’B
 Essential Prime Implicants
 A’D
 BD’
 So F=A’D + BD’
27
Using non-essential prime impicants
 Consider the example
from 2-14

 Having Prime Implicants

28
continue
 Include those that are essential
 Leaves just a single 1
uncovered
 Have the 2 choices to use for
covering it, both of equal size
(i.e. same # of literals)
 Choose either
 Choose as shown getting
 F = A’B’C’D’ +BC’D+ABC’
+ AB’C + ABD
29
Another problem
 Problem:

 Cover largest group of


1s

30
Select 1s not covered
 First

 Second

31
Just 1 more to go
 have a choice
 Both are equal
 Choose 1
 Get
 F = A’C’+ABD+AB’C + A’B’D’
 Equal in cost to
 F = A’C’+ABD+AB’C + B’CD’
32
Product-of-Sums
 A simple method
 Simplify F(A,B,C,D)=∑m(0,1,2,5,8,9,10)
 Map to K-map
 Include 0s

33
Group the 0’s
 Use groupings to generate F’

 F’=AB+CD+BD’
 Use DeMorgans
 F=(A’+B’)(C’+D’)(B’+D)

 Which is a product-of-sums representation


34
Getting POS Expressions

 Simplified POS expression can be obtained by grouping the


maxterms (i.e. 0s) of given function.
 Example:
Given F=m(0,1,2,3,5,7,8,9,10,11), we first draw the
K-map, then group the maxterms together:
A
AB
CD 00 01 11 10

00 1 0 0 1

01 1 1 0 1
D
11 1 1 0 1
C
10 1 0 0 1

B 35
Getting POS Expressions
A A
AB AB
CD 00 01 11 10 CD 00 01 11 10

K-map 00 1 0 0 1 00 0 1 1 0 K-map
of F 01 1 1 0 1 01 0 0 1 0 of F'
D D
11 1 1 0 1 11 0 0 1 0
C C
10 1 0 0 1 10 0 1 1 0

B B
 This gives the SOP of F' to be:
F' = B.D' + A.B
 To get POS of F, we have:
F = (B.D' + A.B)'
= (B.D')'.(A.B)' DeMorgan
= (B'+D).(A'+B') DeMorgan 36
Examples
 Example #1:
f(C,D,A,B) =  m(1,2,5,7,8,10,12,13,15)
A
AB
CD 00 01 11 10

00 1 1
Fill in the 1’s.
01 1 1
D
11 1 1 1
C
10 1 1

37
Examples
 Example #1:
f(A,B,C,D) =  m(2,3,4,5,7,8,10,13,15)
A
AB
CD 00 01 11 10
These are all the prime
00 1 1 implicants; but do we
01 1 1 need them all?
D
11 1 1 1
C
10 1 1

38
Examples
 Example #1:
f(A,B,C,D) =  m(2,3,4,5,7,8,10,13,15)
A
AB
CD 00 01 11 10

00 1 1
Essential prime implicants:
01 1 1
D
11 1 1 1
B.D
C
10 1 1 A'.B.C'
B A.B'.D'

39
Examples
 Example #1:
f(A,B,C,D) =  m(2,3,4,5,7,8,10,13,15)
A
AB
CD 00 01 11 10

00 1 1
Minimum cover.
01 1 1
D EPIs: B.D, A'.B.C', A.B'.D'
11 1 1 1
C
+
10 1 1

B
A'.B'.C

f(A,B,C,D) = B.D + A'.B.C' + A.B'.D' + A'.B'.C


40
Examples
A
AB A
CD 00 01 11 10 AB
CD 00 01 11 10
00
1 1
01
1 1 00 1 1 Essential prime
D

C
11 1 1 1 01 1 1
implicants
10 1 1 D
11 1 1 1
B C
10 1 1
SUMMARY
A B
AB
CD 00 01 11 10

00 1 1
Minimum cover
01 1 1
D
11 1 1 1
C
10 1 1
f(A,B,C,D) = B.D + A'.B'.C + A.B'.D' + A'.B.C'
B 41
Examples
 Example #2:
f(A,B,C,D) = A.B.C + B'.C.D' + A.D + B'.C'.D'
A
AB
CD 00 01 11 10

00 1 1
Fill in the 1’s.
01 1 1
D
11 1 1
C
10 1 1 1

42
Examples
 Example #2:
f(A,B,C,D) = A.B.C + B'.C.D' + A.D + B'.C'.D'
A
AB
CD 00 01 11 10

00 1 1
Find all PIs:
01 1 1
D
11 1 1 A.D
C
10 1 1 1 A.C
B B'.D'

Are all ‘1’s covered by the PIs? Yes, so the answer is:
f(A,B,C,D) = A.D + A.C + B'.D'
43
Examples
 To find simplest POS expression for example #2:
f(A,B,C,D) = A.B.C + B'.C.D' + A.D + B'.C'.D'
 Draw the K-map of the complement of f, f '.
A From K-map,
AB
CD 00 01 11 10
f ' = A'.B + A'.D + B.C'.D'
00 1 1
Using DeMorgan’s theorem,
01 1 1
D
11 1 1 f = (A'.B + A'.D + B.C'.D')'
C
10 1 = (A+B').(A+D').(B'+C+D)
B

44

You might also like