Lecture 2.5 - KMaps

Download as pdf or txt
Download as pdf or txt
You are on page 1of 42

Digital Logic Design

EE-221
By Dr. Mir Yasir Umair
Associate Professor, MCS, NUST
K-Maps
Boolean Algrebra (Contd.)

DLD by Dr. MIR YASIR UMAIR 2


Gate-level Minimization

▪Although truth tables representation of a function is unique, it


can be expressed algebraically in different forms
▪The procedure of simplifying Boolean expressions is
difficult since it lacks specific rules to predict the successive
steps in the simplification process.
▪ Alternative: Karnaugh Map (K-map) Method.
▪Straight forward procedure for minimizing Boolean Function
▪Fact: Any function can be expressed as sum of minterms
▪K-map method can be seen as a pictorial form of the truth table.
y
y0 1
x
m0 m1 0 x' y ' x' y
m2 m3 x 1 xy' xy

3
Two-variable map
• Each block in a map is called a cell
• A cell corresponds to a row in a truth table
• Also a cell represents a minterm or a maxterm
• For the minterm place 1 and for maxterm place 0
• Multi cell areas represents a standard term
• For a 2 variable function number of blocks will be 22=4
• So for n variable function number of cells in a map 2n

4
Two-variable K-MAP
y
y0 1
x
0 x' y ' x' y
x 1 xy' xy

y y
y0 1 y0 1
x x
0 0 1

x 1 1 x 1 1 1

F2 = m1 + m2 + m3 =
F1 = xy
= x' y + xy'+ xy
5
Adjacent Cells
• Two cells are called adjacent if they differ by one literal
• m0=x1’x2’ is adjacent to m1=x1’x2
here x1 is same in both terms but x2 varies from 0 to 1
• Adjacent cells can be grouped together.
• Number of cells in a group should be in a power of 2 ie
2,4,8 etc.

6
Two-variable K-MAP

y y
y0 1 y0 1
x x
0 x' y ' x' y 0 1 Grouping (ORing) of
1’s allows
x 1 xy' xy x 1 1 1 simplification

F2 = x + y

The three squares can be determined from the intersection


of variable x in the second row and variable y in the second
column. 7
Three-Variable K-Map

▪ Any two adjacent squares differ by only one variable.


▪ m5 is row 1 column 01. ➔ 101= xy’z=m5
▪ Since adjacent squares differ by one variable (1 primed, 1 unprimed)
▪From the postulates of Boolean algebra, the sum of two minterms
in adjacent squares can be simplified to a simple AND
▪For example m5+m7=xy’z+xyz=xz(y’+y)=xz
8
Three-Variable K-Map

Example 1

F = (m2 , m3 , m4 , m5 ) = x ' yz '+ x ' yz + xy ' z '+ xy ' z


= x ' y ( z + z ') + xy '( z + z ') = x ' y + xy '

9
Three-Variable K-Map
Example 2
Simplify: F ( x, y, z ) = (3,4,6,7)

m0 m1 m3 m2
m4 m5 m7 m6

yz
xz ' xz '

10
Three-Variable K-Map
Example 3
Simplify: F ( x, y, z ) = (0,2,4,5,6)

m0 m1 m3 m2
m4 m5 m7 m6

11
Three-Variable K-Map
Example 3
Simplify: F ( x, y, z ) = (0,2,4,6)

m0 m1 m3 m2
m4 m5 m7 m6

12
Three-Variable K-Map
Example 4
Given: F ( A, B, C ) = A' C + A' B + AB' C + BC

(a) Express F in sum of minterms.


(b) Find the minimal sum of products using K-Map

A' C ( B + B ' ) = A' BC + A' B ' C


A' B (C + C ' ) = A' BC + A' BC '
AB' C
BC ( A + A' ) = ABC + A' BC

(a) F ( A, B, C ) = A' B' C + A' BC '+ A' BC + AB' C + ABC


= (1,2,3,5,7)
13
Three-Variable K-Map
Example 4 (continued) F ( A, B, C ) = (1,2,3,5,7)

m0 m1 m3 m2

m4 m5 m7 m6

14
Three-variable K-Map: Observations

• One square represents one minterm → a term of 3 literals

• Two adjacent squares → a term of 2 literals

• Four adjacent squares → a term of 1 literal

• Eight adjacent squares → the function equals to 1

15
Four-Variable K-Map
Example 5 Simplify F(w,x,y,z) = (0,1,2,4,5,6,8,9,12,13,14)

F = y '+ w' z '+ xz'

16
Four-Variable K-Map

17
Four-Variable K-Map
Example 6 Simplify F(A,B,C,D) = A' B' C '+ B' CD'+ A' BCD'+ AB' C '
A' B' C ' Represented by 0001 or 0000

F = B' D'+ B' C'+ A' CD'

18
Four-variable K-Map: Observations

• One square represents one minterm → a term of 4 literals

• Two adjacent squares → a term of 3 literals

• Four adjacent squares → a term of 2 literal

• Eight adjacent squares → a term of 1 literal

• sixteen adjacent squares → the function equals to 1

19
POS
• Using Karnaugh map simplify the following Boolean expression
and give the f(A,B,C,D) = ∑m (0, 1, 2, 4, 5, 12, 14)+dc(8, 10).
F= A’C’D+B’D’+AD’
∑m (0, 1, 2, 5, 12, 14)+dc(8, 10).
B’D’ + A’C’D+ AD’
CD
AB 00 01 11 10
00 1 1 0 1
01 0 1 0 0
11 1 0 0 1
10 x 0 0 x

top
A

B
top
top
C

D top
∑m (0, 1, 2,4, 5, 12, 14)+dc(8, 10).

00 01 11 10
00 1 1 1
01 1 1
11 1 1
10 x x
∑m (0, 1, 2, 5, 12, 14)+dc(8, 10).
CD
AB 00 01 11 10
00 1 1 0 1
C’+D’
01 0 1 0 0
11 1 0 0 1
10 x 0 0 x
A’+D’

A+B’+D

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

[CD+A’BD’+AD]’
(CD)’.(A’BD’)’.(AD)’
(C’+D’)(A+B’+D)(A’+D’)
Examples of Combinational Circuits
Design a logic circuit with four input variables that will only produce a 1
output when exactly three input variables are 1s.
A B C D F
0 0 0 0 0
0 0 0 1 0
0 0 1 0 0
0 0 1 1 0 CD
00 01 11 10
AB
0 1 0 0 0 00
0 1 0 1 0 01 1
0 1 1 0 0 11 1 1
0 1 1 1 1 10 1

1 0 0 0 0
1 0 0 1 0 ABC’D+A’BCD+AB’CD
1 0 1 0 0
1 0 1 1 1
1 1 0 0 0
1 1 0 1 1
1 1 1 0 1
1 1 1 1 0
Design a logic circuit that has three inputs, A, B, and C, and whose output will be HIGH
only when a majority of the inputs are HIGH.

A B C F

0 0 0 0

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

1 1 0 1 m6

1 1 1 1m7 F=BC+AC+AB
Consider the following Figure, where an analog-to-digital converter is monitoring the
dc voltage (VB) of a 12-V storage battery on an orbiting spaceship. The converter’s
output is a four-bit binary number, ABCD, corresponding to the battery voltage in
steps of 1 V, with A as the MSB. The converter’s binary outputs are fed to a logic
circuit that is to produce a HIGH output as long as the binary value is greater than
(0110)2 = (6)10; that is, the battery voltage is greater than 6 V. Design this logic circuit.
A B C D z
CD
0 0 0 0 0 AB 00 01 11 10
0 0 0 1 0 00
0 0 1 0 0 01 1
0 0 1 1 0 11 1 1 1 1
0 1 0 0 0 10 1 1 1 1
0 1 0 1 0
0 1 1 0 0 F=A+BCD
0 1 1 1 1
1 0 0 0 1
1 0 0 1 1
1 0 1 0 1
1 0 1 1 1
1 1 0 0 1
1 1 0 1 1
1 1 1 0 1
1 1 1 1 1
Let’s design a logic circuit that controls an elevator door in a three-story building.
The circuit in Figure has four inputs. M is a logic signal that indicates when the
elevator is moving (M = 1) or stopped (M = 0). F1, F2, and F3 are floor indicator
signals that are normally LOW(0), and they go HIGH(1) only when the elevator is
positioned at the level of that particular floor. For example, when the elevator is
lined up level with the second floor, F2 = 1 and F1 = F3 = 0. The circuit output is the
OPEN signal, which is normally LOW and will go HIGH when the elevator door is to
be opened.
Conditions:
M F1 F2 F3 OPEN When elevator is moving, door should be closed
0 0 0 0 0 When elevator is stopped and is at a particular floor, door should be
opened
0 0 0 1 1 F2 F3
M F1 00 01 11 10
0 0 1 0 1
00 1 X 1
0 0 1 1 X
01 1 X X x
0 1 0 0 1
11
0 1 0 1 X
10
0 1 1 0 X
0 1 1 1 X
1 0 0 0 0 F=M’F1+M’F3 + M’F2
1 0 0 1 0
1 0 1 0 0
1 0 1 1 0
1 1 0 0 0
1 1 0 1 0
1 1 1 0 0
1 1 1 1 0
BCD to EXCESS-3 Code
BCD Excess 3
A B C D W X Y Z
0 0 0 0 0 0 1 1
0 0 0 1 0 1 0 0
0 0 1 0 0 1 0 1
0 0 1 1 0 1 1 0
0 1 0 0 0 1 1 1
0 1 0 1 1 0 0 0
0 1 1 0 1 0 0 1
0 1 1 1 1 0 1 0
1 0 0 0 1 0 1 1
1 0 0 1 1 1 0 0
1 0 1 0 X x X x
1 0 1 1 X X X X
1 1 0 0 X X X X
1 1 0 1 X X X X
1 1 1 0 X X X X
1 1 1 1 x X x X
Five-variable K-Map
A=0 A=1
DE D DE D
BC 00 01 11 10 BC 00 11 10
01
00 m0 m1 m3 m2 00 m16 m17 m19 m18

01 m4 m5 m7 m6 m20 m21 m23 m22


01
C
m12 m13 m15 m14 11 m28 m29 m31 m30 C
11
B m8 m9 m11 m10 B 10 m24 m25 m27 M26
10
E E
Five Variable K Maps have 32 squares
Six Variable K Maps have 64 squares
F(A,B,C,D,E)={0,2,4,6,9,13,21,23,25,29,31)
1 1
1 1 1 1 F=A’B’E’+BD’E+ACE
1 1 1
32
1 1
SUM of PRODUCT and PRODUCT OF SUM
Simplify the following Boolean function in:
(a) sum of products (b) product of sums
F ( A, B, C , D) = (0,1, 2,5,8,9,10)
Combining the one’s:
(a) F = B ' D '+ B ' C '+ A ' C ' D

Combining the zero’s:


F ' = AB + CD + BD '

Taking the the complement:


AB + CD + BD ' (b) ( F ') ' = F =
= ( A '+ B ')(C '+ D ')( B '+ D)

33
SOP and POS gate implementation

SUM OF PRODUCT (SOP) PRODUCT OF SUM (POS)

34
Implementation of Boolean Functions

▪ Draw the logic diagram for the following function: F = (a.b)+(b.c)

a
b
F

35
• Implement a circuit
o 2 Level
o More than two level
o SOP
o POS
• Implement a circuit using OR and Inverter Gates only
• Implement a circuit using AND and Inverter Gates only
• Implement a circuit using NAND Gates only
• Implement a circuit using NOR Gates only

36
• Implicant
o A group of one or more 1 s’ which are adjacent and can be
combined on a Karnaugh Map is called an implicant.
• The biggest group of 1’s which can be circled to cover a
given 1 is called a prime implicant.
o They are the only implicants we care about.

37
38
39
40
Practice Example

41
Practice example

42

You might also like