1
LOGIC DESIGN
WEEK 6
REPRESENTATION OF A LOGIC FUNCTION
with K-Map
and K-map Reductions
Doç. Dr. Birim BALCI CBU 2022-23 Spring
Logic Function
2
Representation of a logic function
Truth table √
Algebric (SOP form / POS form) √
Logic circuit K-Map
inputs outputs
Numeric
HDL code
Steps of implementing a logic circuit :
Logic function representation
Reduce the function if possible
implemantation
Remember
3
2 ways to write a
Two variable minterms and maxterms boolean expression
SOP From
F= ab’c’ + ab’c = m4 + m5
100 101
= ∑ m (4,5)
POS From
Q= (a+b+c’).(a’+b+c’)
001 101
= M1. M5 = ∏ M (1, 5)
Karnaugh Maps (K-Map)
4
K-Maps
Used to make graphical reduction
Neighbour cells are used to make reduction
Limited number of variables (4-8)
N variables 2n cells
K-map for the function with 1 input
5
F = A’
Truth table: K-map:
dec A F
0 0 1
1 1 0
Second order K-map
6
2 inputs (x,y) 22 =4 situations means 4 cells
One cell represents one minterm with 2 literals
K-map and Truth table relation
7
Truth table
Second order K-map...
8
Example: F (a,b)=∑ m(1,3) dec A B F
0
For F, write k-map and reduce the function. 0 0 0
1 0 1 1
SOP form in k-map cell 1 and cell 3 will be 1. 2 1 0 0
cell 1 and cell 3 are neighbours reduction posible. 3 1 1 1
ignore the input which the value is changed.
Alternative representation
Do not use this !
A: MsB
B: LsB
F=B the places of inputs is changed .
Cell numbers are changed !
3rd order K-map (3 variables)
9
One cell represents one minterm with 3 literals
Locations of
minterms !
3rd order K-map ...
10
OR
We will not use this
representation !
3rd order K-map ...
11
Exp: F = BC’ + A’B + A’C + AB’ +B’C +AC’
reduce the function in k-map.
Answer:
3 inputs 23=8 cell For reduction, we’ll take the
F is in SOP form. So, relationships in symmetric axis.
(cell 4 and cell6 are neighbours- kesikli yeşiller)
we’ll look to the
neigbourship of 1’s. A
BC 00 01 11 10
0 1 1 1
1 1 1 1
F = ac’ +b’c + a’c +bc’
4 th order (4 variable) K-maps
12
y
y
w z
x
x
w
z
4th order K-maps...
13
y
y
w z
x
x
w
z
14
*** there is no neighborhood between 3 cells.
they are not in symmetric axis.
4th order K-maps...
15
we will not use this representation !
4th order K-maps...
16
Exp: f(a,b,c,d) = ∑m(0,2,5,8,9,10,11,12,13,14,15)
reduce the funtion with K-map.
a’b’d’
To more reduce:
bc’d Instead of cells 0-2 if we take 0,2,8,10
neighbourship:
a
b’ d’
f(a,b,c,d) = a + a’b’d’ +bc’d f(a,b,c,d) = a + bc’d + b’d’
K-map reduction : 2 ways
17
For SOP form: Neighborhood between 1s.
x + x’ =1
For POS form: Neighborhood between 0s.
x.x’= 0
K-map reduction ...
18
EXP: Make the reduction for function F.
cd
ab
1 1
1 1
1 1
1 1
f(a,b,c,d) = bd +b’d’
Without k-map:
F = ∑m(0,2,5,7,8,10,13,15)
= m5 + m7 + m13 +m15 + m0 + m2 + m8 + m10
= A’BC’D + A’BCD + ABC’D + ABCD + A’B’C’D’ + A’B’CD +AB’C’D’ +AB’CD’
= A’BD + ABD + B’D’
F = BD + B’D’
19
Problem
A digital circuit will be controlled with 4 switches.
If any two switches are closed the output of the
circuit will be 1; otherwise output will be 0.
Design the circuit.
Solution:
4 switches : 4 inputs (a,b,c,d)
20
dec A B C D Q
0 0 0 0 0 0
1 0 0 0 1 0
2 0 0 1 0 0
3 0 0 1 1 1 m3
4 0 1 0 0 0
5 0 1 0 1 1 m5
6 0 1 1 0 1 m6 Q= a’b’cd + a’bcd’ +ab’cd’ +ab’c’d + abc’d’ +a’bc’d
7 0 1 1 1 0
8 1 0 0 0 0
9 1 0 0 1 1 m9
10 1 0 1 0 1 m10
11 1 0 1 1 0
12 1 1 0 0 1 m12
13 1 1 0 1 0
14 1 1 1 0 0
15 1 1 1 1 0
Prime implicant (PI)
21
the biggest group
can not be combined with anaother expression.
3 types:
Essential PI: if a minterm is covered by only one PI,
that PI is essential.
Optional PI
Redundant PI
Prime implicant (PI)
22
Essential PIs
Cells 4,5,12,13 bc’
Cells 2,10 b’cd’
Optional PIs
Cells 0,4 a’c’d’
Cells 3,7 a’cd
Redundant PI
Neighbourship cells 0, 2
F= bc’ +b’cd’ +a’c’d’ +a’cd
already used.
Both of them were taken before
Prime implicant (PI)...
23
EXP: Reduce function f=∏M(1,6,8,9,11,15,14) in K-
map, according to POS form.
F=(a’+b+c).(a’+c’+d’).(b’+c’+d).(b+c+d’)
Prime implicant (PI)...
24
EXP: Q(a,b,c,d)=∑m(0,2,4,6,9,11,12,14)
Reduce the function Q as POS form on K-map.
Method 1: Take the duality of SOP
form.
a:1 a’=0 so, Q Q’
Method 2: Look neighborship of zeros
a=0 a’=1
1 minterm (SOP) Qpos =(a+d’). (a’+b’+d’). (a’+b+d)
0 maxterm(POS)
Don’t Care Conditions (FARKETMEZ Durumları)
25
Some functions are not defined for certain input
combinations
These are incompletely specified functions
No certain input values corresponding output values
do not have to be defined
This may significantly reduces the circuit complexity
Don’t Care Conditions ...
26
For unspecified minterms, we do not care what the
value the function produces.
These unspecified minterms : don’t care conditions.
We use “X” symbol or Φ symbol to
represent them in K-map.
Don’t cares can be taken 0 or 1 to make the
Boolean expression even more simplified
27
Exp:
F(x, y, z, t) = (1, 3, 7, 11, 15) + Φ (0, 2, 5)
28
Exp:
F (x,y,z,t) =∑ (1,3,7,11,15) + X(0,2,5)
Make reduction in POS form.
Fpos = ?
Fpos= (x’+z). t
Multiple output minimization
29
Step 1: Map each function
Step2: find common implicants
for combinations
... Logic circuit ...
inputs n outputs m Make a table for result of step
2 giving all shared Pıs
Map the original functions
Loop out the shared PI’s
Loop out the remaning essential
PIs
Multiple output minimization ...
30
Let’s remember the rules
For minterm For maxterm
mi .mi =mi
Mi + Mi = Mi
mi .mi = 0
Mi + Mi = 1 i= j
mi . xi =mi
mi . xj =0 Mi + xi = Mi
xi . xi = xi mi + xj = 1
xi . xj = 0 i= j xi + xi = xi
xi + xj = 1
The ones with same indices
equals 0.
Multiple output minimization...
31
Exp: Step2: find common implicants
F1= ∑ (0,3,4,5,6) for combinations
F2= ∑ (1,2,4,6,7) F1. f2 = ∑ (4,6)
F3= ∑ (1,3,4,5,6) F1. f3 = ∑ ( 3,4,5,6)
Minimize. F2.f3 = ∑ (1,4,6)
F1. f2. f3 = ∑ (4,6)
Step1: Map each function
• 3 inputs, 3outputs Step3:
A
B Logic circuit
F1
F2 Kmaps of step2 ?
C f3
Multiple output minimization...
32 ?
Step2: find common implicants
for combinations Step3: Kmaps of step2
F1. f2 = ∑ (4,6)
F1. f3 = ∑ ( 3,4,5,6)
F2.f3 = ∑ (1,4,6)
F1. f2. f3 = ∑ (4,6)
Create table:
Multiple output minimization...
33 ?
Step2: find common implicants
for combinations
F1. f2 = ∑ (4,6) F1. f3 = ∑ ( 3,4,5,6)
F2.f3 = ∑ (1,4,6) F1. f2. f3 = ∑ (4,6)
Step4: Kmaps for each function (f1, f2, f3)
First create the ones u found in step 3
Multiple output minimization...
34
step 5:
Step2: find common implicants for
combinations
F1. f2 = ∑ (4,6)
F1. f3 = ∑ ( 3,4,5,6)
F2.f3 = ∑ (1,4,6)
F1. f2. f3 = ∑ (4,6)
After step 4,
we found that :
Entered Variable Map Reduction
35
MEV method
Simple way of solution if there are more than 4 inputs.
Choose least significant bit as free variable
Write the output of the function again according to
0,1, free variable.
How many free variables must be choosen ?
N: input number (a,b,c..)
n : order of compressed k-map
N –n : number of free variable
Each submap covers 2N-n minterms or maxterms
EXP: F(a,b,c)= ∑ m(2,5,6,7) use MEV method and implement
the circuit. A: with SOP form b: with POS form
36
Solution A- step 1: Step 2: (LsD) as a free variable. C
Draw truth table of F C takes 2 diff. Values devide rows 2 by 2.
Dec A B C F Dec A B C F
0 0 0 0 0 0 0 0 0 0 0 In compressed
1 0 0 1 0 1 0 0 1 0
k-map,
2 0 1 0 1 2 0 1 0 1 C’ 2 cells will be
3 0 1 1 0 3 0 1 1 0 represented
4 1 0 0 0 4 1 0 0 0 C with 1 cell
5 1 0 1 1 5 1 0 1 1
6 1 1 0 1 6 1 1 0 1 1
7 1 1 1 1 7 1 1 1 1
37
Solution- step 3:
Dec A B C F F
0 0 0 0
Compressed K-map for F.
0 0
0 0 1 0
1 0 1 0 1 C’
0 1 1 0
2 1 0 0 0 C
1 0 1 1
3 1 1 0 1 1
1 1 1 1
Remember: in SOP
C + C’ = 1 Result: F=AC + BC’
38
Solution B: with POS form.
Dec A B C F F
0 0 0 0 0 0
0 0 1 0
1 0 1 0 1 C’
0 1 1 0
2 1 0 0 0 C
1 0 1 1
3 1 1 0 1 1
1 1 1 1
Remember: in POS Result: F= (B+C). (A+C’)
C . C’ = 0
EXP:
39
F (a,b,c,d)= ∏ M(0,1,6,8,9,11,14,15)
Reduce the function by using 3rd order K-map.
Solution:
# inputs N = 4
Order n=3
2N-n = 21 =2
MAPKEY
Each 2 cells will be
represented by 1
cell in the
compressed k-map.
40
F= A’CD + B’CD’ + BC’