0% found this document useful (0 votes)
7 views

Lecture 4 K-maps

Uploaded by

alanazisultan79
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)
7 views

Lecture 4 K-maps

Uploaded by

alanazisultan79
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/ 45

(Logic Design)

Lec. # 4

Dr. Ahmed Helmi

Accredited to: Dr. Tamer Samy Gaafr

Boolean Algebra and Logic Gates 1


Lec. # 4

Karnaugh Map

Boolean Algebra and Logic Gates 2


SOP Functions
▪ Take 1’s from Truth Table
Truth Table
XYZ F
F = X’Y’Z + XY’Z’ + XY’Z + XYZ’ + XYZ
000 0
001 1
Simplify 010 0
011 0
F = x + y’z 100 1
101 1
110 1
111 1

Boolean Algebra and Logic Gates 3


POS Functions
1. Take 0’s from truth table (F’)
Truth Table
2. Apply Demorgan (F) XYZ F
000 0
001 1
010 0
F’= x’y’z’ + x’yz’ + x’yz 011 0
100 1
101 1
110 1
F = (x+y+z).(x+y’+z).(x+y’+z’)
111 1

Boolean Algebra and Logic Gates 4


Universal Gates: NAND and NOR

▪ AND/OR/NOT gates are sufficient for building any Boolean


functions.

▪ We call the set {AND, OR, NOT} a complete set of logic.


NAND Gate (1/2)
▪ NAND gate is self-sufficient (can build any logic circuit with it).
▪ Therefore, {NAND} is also a complete set of logic.
▪ Can be used to implement AND/OR/NOT.

▪ Implementing an inverter using NAND gate:

x x'

(x.x)' = x' (T1: idempotency)


NAND Gate (2/2)
▪ Implementing AND using NAND gates:
(x.y)' x.y
x
(x.y)= ((x.y)')' idempotency
y = (xy) involution

Implementing OR using NAND gates:


x'
x
X+Y = (X+Y)’’
x+y
= ( X‘ . Y’) ‘
y
y'
NOR Gate (1/2)
▪ NOR gate is also self-sufficient.
▪ Therefore, {NOR} is also a complete set of logic
▪ Can be used to implement AND/OR/NOT.

▪ Implementing an inverter using NOR gate:

x x'

(x+x)' = x' (T1: idempotency)


NOR Gate (2/2)
Implementing AND using NOR gates:
x'
x

x.y
(XY) = (XY)’’
y
y' = ( X’ + Y’)’

Implementing OR using NOR gates:


(x+y)'
x
x+y
y
x+y = ((x+y)')‘
= (x+y)
Outline
▪ Universal Gates : NAND and NOR
• NAND Gate
• NOR Gate
▪ Implementation using NAND Gates
▪ Implementation using NOR Gates
Implementation using NAND gates (1/2)

▪ Possible to implement any Boolean expression using NAND gates.

Procedure:

(i) Obtain sum-of-products Boolean expression:


Example: F3 = x.y'+x'.z

(ii) Use DeMorgan theorem to obtain expression using 2-level


NAND gates
Example: F3 = x.y'+x'.z
= (x.y'+x'.z)' ' involution
= ((x.y')' . (x'.z)')' DeMorgan
Implementation using NAND gates (2/2)

x (x.y')'
y'
F3
x'
z (x'.z)'

F3 = ((x.y')'.(x'.z)') ' = x.y' + x'.z

NAND gate is used to implement a SOP Function


Outline
▪ Universal Gates : NAND and NOR
• NAND Gate
• NOR Gate
▪ Implementation using NAND Gates
▪ Implementation using NOR Gates
Implementation using NOR gates (1/2)

▪ Possible to implement any Boolean expression using NOR gates.

Procedure:

(i) Obtain product-of-sums Boolean expression:


Example: F6 = (x+y').(x'+z)

(ii) Use DeMorgan theorem to obtain expression using 2-level


NOR gates.
Example: F6 = (x+y').(x'+z)
= ((x+y').(x'+z))' ' involution
= ((x+y')'+(x'+z)')' DeMorgan
Implementation using NOR gates (2/2)

x (x+y')'
y'
F6
x'
z (x'+z)'

F6 = ((x+y')'+(x'+z)')' = (x+y').(x'+z)

NOR gate is used to implement a POS Function


Implementing a SOP using NOR gates

Procedure:

(i) Obtain sum-of-products Boolean expression:

Example: F3 = x.y'+x'.z

(ii) Take the Complement for both sides

G = F3’= (x.y’+x’.z)’
Then
G = F3’ = (x’+y) . (x+z’)

Note:
G = F3’ ----------- > POS ( NOR Implementation)

but needs an Inverter


Implementation using NOR gates (2/2)

X’ (x’+y)'
G = F3’ F3
Y

X
Z’ (x+z’)'

G = F3’ = (x’+y) . (x+z’)


G’’ = [(x’+y)’ + (x+z’)’]’

NOR gate is used to implement a POS Function


Implementing POS using NAND gates

▪ Possible to implement any Boolean expression using NAND gates.

Procedure:

(i) Obtain product-of-sums Boolean expression:


Example: F7 = (x+y').(x'+z)

(ii) Use DeMorgan theorem to obtain expression using 2-level to


represent as SOP
Example: F7 = (x+y').(x'+z)
F7’= x’.y+x.z’ DeMorgan
Implementation using NAND gates (2/2)

X’ (X’.Y)'
Y F7’ F7

X’
Z’ (X.Z’)'

F7’ = ((x’.y)'.(x.z’)') ' = x.y' + x.z’

NAND gate is used to implement a POS Function


Karnaugh Maps (K maps)
What are Karnaugh maps?

▪ Karnaugh maps provide an alternative way of


simplifying logic circuits.

▪ Instead of using Boolean algebra simplification


techniques, you can transfer logic values from a Boolean
statement or a truth table into a Karnaugh map.

▪ The arrangement of 0's and 1's within the map helps you
to visualize the logic relationships between the variables
and leads directly to a simplified Boolean statement.
Karnaugh maps
▪ Karnaugh maps, or K-maps, are often used to simplify logic problems with 2,
3 or 4 variables.
n
Cell = 2 ,where n is a number of variables

2
For the case of 2 variables, we form a map consisting of 2 =4 cells
as shown in Figure

A
A A A
A A
0 1 0 1
B B
00 10
B 0
0 2
B 0 AB AB
01 11
B 1
1 3
B 1
A B AB
Minterm
Examples of K-Maps:

▪ Examples:
Cell numbers are written in the cells.
▪ 2-variable K-map

B B B
0 1
A
A 0 0 1
A 1 2 3

23
3-Variable K-Map:

▪ 3-variable K-map

B B
BC BC
00 01 11 10 A
00 01 11 10
A

0 0 1 3 2 A
0 A B C A B C A BC A BC
1 1
4 5 7 6 A AB C AB C ABC ABC
C C C

24
4-variable K-map

CD
AB
00 01 11 10
00 0 1 3 2
01 4 5 7 6
11 12 13 15 14
10 8 9 11 10

25
Karnaugh maps

▪ The Karnaugh map is completed by entering a ‘1’ (or


‘0’) in each of the appropriate cells.

▪ Within the map, adjacent cells containing 1's (or 0’s)


are grouped together in twos, fours, or eights.
K-Map Format
▪ Each minterm in a truth table corresponds to a cell in the K-
Map.
▪ K-Map cells are labeled such that both horizontal and
vertical movement differ only by one variable.
▪ Since the adjacent cells differ by only one variable, they can
be grouped to create simpler terms in the sum-of-products
expression.
▪ The sum-of-products expression for the logic function can
be obtained by OR-ing together the cells or group of cells
that contain 1s.

27
Simplification Guidelines for K-maps

▪ Each cell of an n-variable K-map has n logically adjacent


cells.
▪ Cells may be combined in groups of 2,4,8,…,2k.
▪ A group of cells can be combined only if all cells in the
group have the same value for some set of variables.
▪ Always combine as many cells in a group as possible.
This will result in the fewest number of literals in the term
that represents the group.
▪ Make as few groupings as possible to cover all minterms.
This will result in the fewest product terms.
▪ Always begin with the “loneliest” cells.
Minimization with K-maps

1. Draw a K-map
2. Combine maximum number of 1’s following rules:
1. Only adjacent squares can be combined
2. All 1’s must be covered
3. Covering rectangles must be of size 1,2,4,8, … 2n
3. Check if all covering are really needed
4. Read off the SOP expression
2 variable K-Maps (Adjacency)

▪ In an n-variable k-map, each square is adjacent to exactly n other


squares

Q: What if you have 1 in all squares?

Ahmad Almulhem, KFUPM 2009


Two Variable K-Map Groupings
Group of Four – 1

V
B B

A 1 1

A 1 1

1
Example #1: 2 Variable K-Map
Example:

After labeling and transferring the truth table data into the K-Map, write the simplified sum-of-products (SOP)
logic expression for the logic function F1.

Solution:
V
J K F1 K K
0 0 1 1 1
J
0 1 1
1 0 0 J J 0 0
1 1 0

F1 = J
3-variable K-maps

▪ For 3-variable functions, the k-maps are larger and look


different.
▪ Total number of minterms that need to be accommodated
in the k-map = 8
To maintain adjacency neighbors don’t have more than 1
different bit

B
BC
A 00 01 11 10
0 m0 m1 m3 m2
1 m4 m5 m7 m6
A

C
Example 1

▪ Simplify F = ∑m(1, 3, 4, 6) using K-map

BC
01 11 10
A00
0 1 3 2
0
1 1
A 4 5 7 6
1
1 1
C
Example 1

▪ Simplify F = ∑m(1, 3, 4, 6) using K-map

BC
01 11 10
A00
F = A’C + AC’ 0 1 3 2
0
1 1
A 4 5 7 6
1
1 1
C
Example 2

▪ Simplify F = ∑m(0,1, 2, 4, 6) using K-map

B
01 11 10
A00
0 1 3 2
0
1 1 1
A 4 5 7 6
1
1 1
C
Example 2

▪ Simplify F = ∑m(0,1, 2, 4, 6) using K-map

B
01 11 10
A00
F = A’ B’ + C’ 0 1 3 2
0
1 1 1
A 4 5 7 6
1
1 1
C
3 variable K-Maps (Adjacency)

A 3-variable map has 12 possible groups of 2 minterms

They become product terms with 2 literals


00 01 11 10 00 01 11 10

0 0
1 1

00 01 11 10

0
1
3 variable K-Maps (Adjacency)

A 3-variable map has 6 possible groups of 4 minterms

They become product terms with 1 literals

00 01 11 10 00 01 11 10

0 0
1 1

00 01 11 10

0
1
Example
▪ Minimize the function
F(A,B,C,D)=∑m(1,3,5,6,7,8,9,11,14,15)
C
CD
AB 00 01 11 10
00 1 1
01
1 1 1
B
11
1 1
10
A
1 1 1

F = CD + A’D + BC + AB’C’
Example

▪F(A,B,C,D) = Sm(0,1,2,5,8,9,10)

CD C=1
AB
00 01 11 10
00 1 1 1

01 1
B=1
11
A=1
10 1 1 1

D=1
Example

▪F(A,B,C,D)

=Sm(0,1,2,5,8,9,10)
CD C=1
AB
00 01 11 10
▪Solution: 00 1 1 1

01 1
F = B’ D’ + B’ C’ + A’ C’ D B=1
11
A=1
10 1 1 1

D=1
Example (POS)

▪F(A,B,C,D) = Sm(0,1,2,5,8,9,10)
Write F in the simplified product of sums
(POS)
CD C=1
▪Two methods? AB
00 01 11 10
▪You already know one!
00 1 1 1

01 1
B=1
11
A=1
10 1 1 1

D=1
Example (POS)

▪F(A,B,C,D) = Sm(0,1,2,5,8,9,10)
Write F in the simplified product of
sums (POS)

Follow same rule as before but for the CD C=1


ZEROs AB
00 01 11 10

F’ = AB + CD + BD’ 00 1 1 0 1

01 0 1 0 0
Therefore, B=1
11 0 0 0 0
A=1
10 1 1 0 1
F’’ = F = (A’+B’)(C’+D’)(B’+D) D=1
Truth Table to K-Map Mapping
Four Variable K-Map
W X Y Z FWXYZ
Minterm – 0 0 0 0 0 0
Minterm – 1 0 0 0 1 1 V
YZ YZ YZ YZ
Minterm – 2 0 0 1 0 1
Minterm – 3 0 0 1 1 0
Minterm – 4 0 1 0 0 1 WX 0 0 1 1 0 3 1 2
Minterm – 5 0 1 0 1 1
Minterm – 6 0 1 1 0 0 1 1 1 0
WX
4 5 7 6
Minterm – 7 0 1 1 1 1
Minterm – 8 1 0 0 0 0
WX 1 0 1 1
Minterm – 9 1 0 0 1 0 12 13 15 14

Minterm – 10 1 0 1 0 1
Minterm – 11 1 0 1 1 0 WX 0 8 0 9 0 11 1 10
Minterm – 12 1 1 0 0 1
Minterm – 13 1 1 0 1 0
Minterm – 14 1 1 1 0 1
Minterm – 15 1 1 1 1 1

You might also like