Karnaugh Maps
-- A tool for representing
Boolean functions
We can come close to our aim by using a graphical
notation named Karnaugh Map that will be defined in
next slides
Karnaugh Map Technique
• A K-Map is simply a folded truth table, where physical
adjacency implies logical adjacency
• K-Maps are most commonly used hand method for logic
minimization.
• K-Maps are a graphical technique used to simplify a logic
equation.
• K-Maps are procedural and much cleaner than Boolean
simplification.
• K-Maps can be used for any number of input variables, BUT
are only practical for two, three, and four variables.
3
Terminology
•Implicant : Product term that implies function
• Prime Implicant : An Implicant that is not completely covered by
any other Implicant but itself
• Essential prime Implicant : A prime Implicant that has a minter
not covered by any other prime Implicant
• Product term : An and expression
4
Terms
Terminology
•Minterm : We define a Minterm to be a product that contains all variables of
that particular switching function in either complemented or non-complemented
form
• Maxterm : We define a Maxterm to be a sum that contains all variables of
that particular switching function in either complemented or non-complemented
form
•Standard SOP(Sum Of Products) : In standard SOP, the products
are obtained directly from the Karnaugh map or truth table, so the SOP
contains all of the variables of the function
•Standard POS(Product Of Sums) : In standard POS, the products
are obtained directly from the Karnaugh map or truth table, so the POS
contains all of the variables of the function
5
Terms
6
minterm
ID A B f(A,B) minterm
0 0 0 0
1 0 1 1 A’B
2 1 0 1 AB’
3 1 1 1 AB
An example of 2-variable function f(A,B)=A+B
Simplification Goals
• Goal -- minimize the cost of realizing a switching function
• Cost measures and other considerations
– Number of gates
– Number of levels
– Interconnection complexity
– Preventing hazards
• Two-level realizations
– Minimize the number of gates (terms in switching function)
Minimization of Boolean expressions
• The minimization will result in reduction of the number of gates
(resulting from less number of terms) and the number of inputs
per gate (resulting from less number of variables per term)
• The minimization will reduce cost, efficiency and power
consumption.
•y(x+x`)=y.1=y
•y+xx`=y+0=y
•(x`y+xy`)=x⊕y
•(x`y`+xy)=(x⊕y)`
Karnaugh Maps
• Boolean algebra helps us simplify expressions and circuits
• Karnaugh Map: A graphical technique for simplifying a Boolean expression
into either form:
– sum of products (SOP)
– product of sums (POS)
• Goal of the simplification.
– There are a minimal number of product/sum terms
– Each term has a minimal number of literals
• Circuit-wise, this leads to a minimal two-level implementation
Minimum SOP
• f= (xyz +x`yz+ xy`z+ …..)
Is called sum of products.
The + is sum operator which is an OR gate.
The product such as xy is an AND gate for the two inputs x and y.
Examples
• Two variable K-map f(A,B)=∑m(0,1,3)=A`B`+A`B+AB
1 0
1 1
A 0 1
B01
V
0 0
0 0
B
A
A
Groups of One – 4
Two Variable K-Map Groupings
BA
1
BA
1 1
A B
BA
1
B
12
V
0 0
0 0
B
A
A
Groups of Two – 4
Two Variable K-Map Groupings
B
A
1 1
A
1 1
1
B
1
1
B
1
13
V
1 1
1 1
B
A
A
Group of Four – 1
Two Variable K-Map Groupings
1
B
14
Three Variable K-Map Groupings
V
0 0
0 0
0 0
0 0
C C
BA
BA
BA
BA
BA
1 1
BA
1 1
BA
1 1
BA
1 1
1
CA
1
1
CA
1
1
CA
1
1
CB
1
1
CB
1
1
CA
11
CB
1
1
CB
1
Groups of One – 8 (not shown)
Groups of Two – 12
15
Groups of Four – 6
Three Variable K-Map Groupings
V
0 0
0 0
0 0
0 0
C C
BA
BA
BA
BA
1
C
1
1
1
1
C
1
1
1
A
1 1
1 1
B
1 1
1 1
A
1 1
1 1
B
1 1
1 1
16
Group of Eight - 1
Three Variable K-Map Groupings
V
1 1
1 1
1 1
1 1
C C
BA
BA
BA
BA
1
17
Three variable map
• f(A,B,C) = ∑m(0,3,5)=
A`B`C`+A`BC+AB`C
1
1
A`BC
1
AB`C
A`B`
0 0
A`B
0 1
A B
1 1
A B`
1 0
C`
0
C
1
A`B`C`
19
minterm
ID A B f(A,B) minterm
0 0 0 0
1 0 1 1 A’B
2 1 0 1 AB’
3 1 1 1 AB
An example of 2-variable function f(A,B)=A+B
20
Function can be represented by sum of minterms:
f(A,B) = A’B+AB’+AB
This is not minimal however!
We want to minimize the number of literals and terms.
We factor out common terms –
A’B+AB’+AB= A’B+AB’+AB+AB
=(A’+A)B+A(B’+B)=B+A
Hence, we have
f(A,B) = A+B
21
K-Map: Truth Table in 2 Dimensions
A = 0 A = 1
B = 0
B = 1
0 2
1 3
0 1
1 1
A’B
AB’
AB
f(A,B) = A + B
22
ID A B f(A,B) minterm
0 0 0 0
1 0 1 1 A’B
2 1 0 0
3 1 1 1 AB
Another Example f(A,B)=B
f(A,B)=A’B+AB=(A’+A)B=B
23
On the K-map:
A = 0 A= 1
B= 0
B = 1
0 2
1 3
0 0
1 1
A’B AB
f(A,B)=B
24
ID A B f(A,B) Maxterm
0 0 0 0 A+B
1 0 1 1
2 1 0 0 A’+B
3 1 1 1
Using Maxterms
f(A,B)=(A+B)(A’+B)=(AA’)+B=0+B=B
Maxterm example
f(A,B,C) = ∏M(1,2,4,6,7)
=(A+B+C`)(A+B`+C)(A`+B+C) )(A`+B`+C) (A`+B`+C`)
Note that the complements are (0,3,5) which are the minterms of the previous example
0 0 0
0 0
A`B` A`B AB AB`
C`
C
(A+B) (A+B`) (A`+B`) (A`+B)
C
C`
Re-arranging the Truth Table
• A two-variable function has four possible minterms. We can re-arrange
these minterms into a Karnaugh map
• Now we can easily see which minterms contain common literals
– Minterms on the left and right sides contain y’ and y respectively
– Minterms in the top and bottom rows contain x’ and x respectively
x y minterm
0 0 x’y’
0 1 x’y
1 0 xy’
1 1 xy
Y
0 1
0 x’y’ x’y
X
1 xy’ xy
Y
0 1
0 x’y’ x’y
X
1 xy’ xy
Y’ Y
X’ x’y’ x’y
X xy’ xy
Karnaugh Map Simplifications
• Imagine a two-variable sum of minterms:
x’y’ + x’y
• Both of these minterms appear in the top row of a Karnaugh map, which
means that they both contain the literal x’
• What happens if you simplify this expression using Boolean algebra?
x’y’ + x’y = x’(y’ + y) [ Distributive ]
= x’ • 1 [ y + y’ = 1 ]
= x’ [ x • 1 = x ]
Y
x’y’ x’y
X xy’ xy
More Two-Variable Examples
• Another example expression is x’y + xy
– Both minterms appear in the right side, where y is uncomplemented
– Thus, we can reduce x’y + xy to just y
• How about x’y’ + x’y + xy?
– We have x’y’ + x’y in the top row, corresponding to x’
– There’s also x’y + xy in the right side, corresponding to y
– This whole expression can be reduced to x’ + y
Y
x’y’ x’y
X xy’ xy
Y
x’y’ x’y
X xy’ xy
A Three-Variable Karnaugh Map
• For a three-variable expression with inputs x, y, z, the arrangement of
minterms is more tricky:
YZ
00 01 11 10
0 x’y’z’ x’y’z x’yz x’yz’
X
1 xy’z’ xy’z xyz xyz’
YZ
00 01 11 10
0 m0 m1 m3 m2
X
1 m4 m5 m7 m6
Terminology ( cont. )
30
0 0 0 1
1 1 0 1
0 01 11 10
0
1
Karnaugh Map
1 3 2
4 5 7 6
0
AB
C
Figure K-map illustrating implicants
1
C
A B
0 0 0 1 1 1 1 0
0 2 6 4
3 7 5
0
1
B
1 1
1 1 1
A
C
Minterms: {A′B′ C, A′ BC′, A′ BC, ABC′, ABC}
Groups of two minterms: {A′ B, AB, A′ C, BC′, BC}
Groups of four minterms: {B}
Prime implicants: {A′ C, B}
Cover = {A′ C, B}
MSOP = A′ C + B
Generating and Selecting Prime Implicants
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 minterms have been covered.
Generating and Selecting Prime Implicants (Revisited)
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.
Example
f(a,b,c,d) = ∑m(3,7,11,12,13,14,15)
=a`b`cd + a`bcd + ab`cd + abc`d`+ abc`d + abcd` + abcd
=cd(a`b` + a`b + ab`) + ab(c`d` + c`d + cd` + cd )
=cd(a`[b` + b] + ab`) + ab(c`[d` + d] + c[d` + d])
=cd(a`[1] + ab`) + ab(c`[1] + c[1])
=ab+ab`cd + a`cd
=ab+cd(ab` + a`)
=ab+ cd(a + a`)(a`+b`)
= ab + a`cd + b`cd
= ab +cd(a` + b`)
f(A,B,C,D) = ∑m(1,2,3,6) = A′C + BC′
1
C
A B
0 0 0 1 1 1 1 0
0 2 6 4
3 7 5
0
1
B
1 1
1 1
A
C
Proper ordering ?
• With this ordering, any group of 2, 4 or 8 adjacent squares on the map
contains common literals that can be factored out
• “Adjacency” includes wrapping around the left and right sides:
• We’ll use this property of adjacent squares to do our simplifications.
x’y’z + x’yz
= x’z(y’ + y)
= x’z • 1
= x’z
x’y’z’ + xy’z’ + x’yz’ + xyz’
= z’(x’y’ + xy’ + x’y + xy)
= z’(y’(x’ + x) + y(x’ + x))
= z’(y’+y)
= z’
Y
x’y’z’ x’y’z x’yz x’yz’
X xy’z’ xy’z xyz xyz’
Z
Y
x’y’z’ x’y’z x’yz x’yz’
X xy’z’ xy’z xyz xyz’
Z
Three-Variable K-Maps
∑ == CB(0,4)f ∑ == BA(4,5)f ∑ == B(0,1,4,5)f ∑ == A(0,1,2,3)f
BC
00
0
01
1
11 10A
1 0 0 0
1 0 0 0
BC
00
0
01
1
11 10A
0 0 0 0
1 1 0 0
BC
00
0
01
1
11 10A
1 1 1 1
0 0 0 0
BC
00
0
01
1
11 10A
1 1 0 0
1 1 0 0
∑ == CA(0,4)f ∑ == CA(4,6)f ∑ == CA(0,2)f ∑ == C(0,2,4,6)f
BC
00
0
01
1
11 10A
0 1 1 0
0 0 0 0
BC
00
0
01
1
11 10A
0 0 0 0
1 0 0 1
BC
00
0
01
1
11 10A
1 0 0 1
1 0 0 1
BC
00
0
01
1
11 10A
1 0 0 1
0 0 0 0
Four Variable K-Map Groupings
V
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
BA
BA
BA
BA
DC DC DC DC
Groups of One – 16 (not shown)
Groups of Two – 32 (not shown)
Groups of Four – 24 (seven shown)
CB
1 1
1 1
DB
1 1
1 1
DA
1
1
1
1
CB
1 1
1 1
DB
1
1
1
1
DA
1
1
1
1 DB11
11
38
Four Variable K-Map Groupings
V
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
BA
BA
BA
BA
DC DC DC DC
Groups of Eight – 8 (two shown)
B
1 1 1 1
1 1 1 1
D
1
1
1
1
1
1
1
1
39
Four Variable K-Map Groupings
V
1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1
BA
BA
BA
BA
DC DC DC DC
Group of Sixteen – 1
1
40
Four-Variable K-Maps
∑ ••== DCB(0,8)f ∑ ••== DCB(5,13)f ∑ ••== DBA(13,15)f ∑ ••== DBA(4,6)f
∑ •== CA(2,3,6,7)f ∑ •== DB)(4,6,12,14f ∑ •== CB)(2,3,10,11f ∑ •== DB(0,2,8,10)f
CD
00
00
01
01
11
11
10
10
AB
1 0 0 0
0 0 0 0
0 0 0 0
1 0 0 0
CD
00
00
01
01
11
11
10
10
AB
0 0 0 0
0 1 0 0
0 1 0 0
0 0 0 0
CD
00
00
01
01
11
11
10
10
AB
0 0 0 0
0 0 0 0
0 1 1 0
0 0 0 0
CD
00
00
01
01
11
11
10
10
AB
0 0 0 0
1 0 0 1
0 0 0 0
0 0 0 0
CD
00
00
01
01
11
11
10
10
AB
0 0 1 1
0 0 1 1
0 0 0 0
0 0 0 0
CD
00
00
01
01
11
11
10
10
AB
0 0 0 0
1 0 0 1
1 0 0 1
0 0 0 0
CD
00
00
01
01
11
11
10
10
AB
0 0 1 1
0 0 0 0
0 0 0 0
0 0 1 1
CD
00
00
01
01
11
11
10
10
AB
1 0 0 1
0 0 0 0
0 0 0 0
1 0 0 1
Four-Variable K-Maps
CD
00
00
01
01
11
11
10
10
AB
0 0 0 0
1 1 1 1
0 0 0 0
0 0 0 0
CD
00
00
01
01
11
11
10
10
AB
0 0 1 0
0 0 1 0
0 0 1 0
0 0 1 0
CD
00
00
01
01
11
11
10
10
AB
1 0 1 0
0 1 0 1
1 0 1 0
0 1 0 1
CD
00
00
01
01
11
11
10
10
AB
0 1 0 1
1 0 1 0
0 1 0 1
1 0 1 0
CD
00
00
01
01
11
11
10
10
AB
0 1 1 0
0 1 1 0
0 1 1 0
0 1 1 0
CD
00
00
01
01
11
11
10
10
AB
1 0 0 1
1 0 0 1
1 0 0 1
1 0 0 1
CD
00
00
01
01
11
11
10
10
AB
0 0 0 0
1 1 1 1
1 1 1 1
0 0 0 0
CD
00
00
01
01
11
11
10
10
AB
1 1 1 1
0 0 0 0
0 0 0 0
1 1 1 1
f (4,5,6,7) A B= = •∑ f (3,7,11,15) C D= = •∑
f (0,3,5,6,9,10,12,15)= ∑ f (1,2,4,7,8,11,13,14)= ∑
f A B C D= ⊗ ⊗ ⊗ f A B C D= ⊕ ⊕ ⊕
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=
• 4 Variable Maps
– f(A,B,C,D) = Σm(0,1,2,3,6,8,9,11,13,14)
– f = A C' D + B C D' + B' C ' + B' D + A'B'
C D
A B
00 01 11 10
00 1 1 1 1
01 0 0 0 1
11 0 1 0 1
10 1 1 1 0
• Another 4 Variable Map
– f(A,B,C,D) = Σm(0,1,2,5,6,7,8,9,10,13,15)
C D
A B
00 01 11 10
00 1 1 0 1
01 0 1 1 1
11 0 1 1 0
10 1 1 0 1
These are not
essential!
For the Simplest Result
• Make as few rectangles as possible, to minimize the number of products in
the final expression.
• Make each rectangle as large as possible, to minimize the number of literals
in each term.
• Rectangles can be overlapped, if that makes them larger.
K-map Simplification @ SoP Expressions
• Let’s consider simplifying f(x,y,z) = xy + y’z + xz
• You should convert the expression into a sum of minterms form,
– The easiest way to do this is to make a truth table for the function, and
then read off the minterms
– You can either write out the literals or use the minterm shorthand
• Here is the truth table and sum of minterms for our example:
x y z f(x,y,z)
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 1
f(x,y,z) = x’y’z + xy’z + xyz’+ xyz
= m1 + m5 + m6 + m7
Unsimplifying Expressions
• You can also convert the expression to a sum of minterms with Boolean
algebra
– Apply the distributive law in reverse to add in missing variables.
– Very few people actually do this, but it’s occasionally useful.
• In both cases, we’re actually “unsimplifying” our example expression
– The resulting expression is larger than the original one!
– But having all the individual minterms makes it easy to combine them
together with the K-map
xy + y’z + xz = (xy • 1) + (y’z • 1) + (xz • 1)
= (xy • (z’ + z)) + (y’z • (x’ + x)) + (xz • (y’ + y))
= (xyz’ + xyz) + (x’y’z + xy’z) + (xy’z + xyz)
= xyz’ + xyz + x’y’z + xy’z
= m1 + m5 + m6 + m7
Minimum product of sums (POS)
• The minimum product of sums (POS) of a
function, f, is a POS representation of f that
contains the fewest number of sum terms and the
fewest number of literals of any POS
representation of f.
• The zeros are considered exactly the same as
ones in the case of sum of product (SOP)
Example
f(a,b,c,d) = ∏M(0,1,2,4,5,6,8,9,10)
=∑m(3,7,11,12,13,14,15)
= [(a+b+c+d)(a+b+c+d`)(a+b`+c`+d`)
(a`+b+c`+d`)(a`+b`+c+ d)(a`+b`+c+ d`)
(a`+b`+c`+d)(a`+b`+c`+d`)]
PoS Optimization
• Maxterms are grouped to find minimal PoS expression
x +y+z x+y+z’ x+y’+z’ x+y’+z
x’ +y+z x’+y+z’ x’+y’+z’ x’+y’+z
00 01 11 10
0
1
x
yz
PoS Optimization
• F(W,X,Y,Z)= ∏ M(0,1,2,4,5)
x +y+z x+y+z’ x+y’+z’ x+y’+z
x’ +y+z x’+y+z’ x’+y’+z’ x’+y’+z
00 01 11 10
0
1
x
yz
0 0 1 0
0 0 1 1
00 01 11 10
0
1
x
yz
F(W,X,Y,Z)= Y . (X + Z)
Terminology ( cont. )
•Sometimes writing an expression in a POS form is easier as
seen in the following example:
0 1 1 0
1 1 1 1
00 01 11 10
0
1
Karnaugh Map
1 3 2
5 7 64
0
AB
C
52
• POS Minimization
– K-maps can be used for POS minimization, too
– f(A,B,C) = Σm(2,3,6)
• Minimum POS is f = (B)(A' + C') cost = 2 + 4 = 6
• Minimum SOP is f = A'B + BC' cost = 3 + 6 = 9
B C
A
00 01 11 10
0 0 0 1 1
1 0 0 0 1
I don’t care!
• You don’t always need all 2n
input combinations in an n-variable function
– If you can guarantee that certain input combinations never occur
– If some outputs aren’t used in the rest of the circuit
• We mark don’t-care outputs in truth tables and K-maps with Xs.
x y z f(x,y,z)
0 0 0 0
0 0 1 1
0 1 0 X
0 1 1 0
1 0 0 0
1 0 1 1
1 1 0 X
1 1 1 1
– Many times there are incompletely specified conditions
• Valuations that can never occur, or for which we “don’t care what
the device does”
– Modeling such a device requires us to specify don’t care conditions in
those instances
• Use X as a value to indicate we don't care what happens
– Don't care situations are often called incompletely specified functions
Don’t Care Conditions
• Example Using Don't Cares
– f(A,B,C,D) = Σm(1,5,8,9,10) + d(3,7,11,15)
– f = A B' + A' D
C D
A B
00 01 11 10
00 0 1 X 0
01 0 1 X 0
11 0 0 X 0
10 1 1 X 1
1. Choose an element from the “on” set
2. Find all maximal groups (prime implicants) of “on” elements and X
elements adjacent to that element
 Note 1: prime implicants are always a power of 2 in size
 Note 2: do not feel compelled to include X’s – use them only
when they provide a larger implicant
3. Repeat steps 1-2 for all elements in the “on” set
4. Select all essential prime implicants
5. For all elements of the “on” set not covered by the essential prime
implicants, select the smallest number of prime implicants that cover
them
Karnaugh Map Method Restated
K-map Summary
• K-maps are an alternative to algebra for simplifying expressions
– The result is a MSP/MPS, which leads to a minimal two-level circuit
– It’s easy to handle don’t-care conditions
– K-maps are really only good for manual simplification of small
expressions...
• Things to keep in mind:
– Remember the correct order of minterms/maxterms on the K-map
– When grouping, you can wrap around all sides of the K-map, and your
groups can overlap
– Make as few rectangles as possible, but make each of them as large as
possible. This leads to fewer, but simpler, product terms
– There may be more than one valid solution
Timing Hazards in Combinational Logic Circuits
• Hazards are undesirable changes in the output of a
combinational logic circuit caused by unequal gate
propagation delays.
• Static hazard (glitch) -- the output momentarily changes from
the correct or static state
– Static 1 hazard -- the output changes from 1 to 0 and back
to 1
– Static 0 hazard -- the output changes from 0 to 1 and back
to 0
• Dynamic hazard (bounce) -- the output changes multiple times
during a change of state
– Dynamic 0 to 1 hazard -- the output changes from 0 to 1 to
0 to 1
– Dynamic 1 to 0 hazard -- the output changes from 1 to 0 to
1 to 0
Illustration of a static hazard.
x 1
x 2
x 3
x 1
y 1
y 2
G 1
G 2
G 3I 1
z ( x 1
, x 2
, x 3
)
( a ) ( b )
x 1
x 2
x 3
y 1
y 2
G 1
G 2
G 3
z ( x 1
, x 2
, x 3
)
x 1
Illustration of a static hazard (con’t)
x 1
x 2
x 3
y 1
y 2
z
T i m e
( c )
t 1
t 2
t 3
t 4
t 5
t 6
D t
D t
D t
Illustration of a static hazard (con’t).
x 1
x 2
x 3
y 1
y 2
z
T i m e
( d )
t 1
t 2
t 3
t 4
t 5
t 6
t 7
t 8
t 9
D t 2
D t 3
D t 1 D t 3
D t 2
D t 3
Identifying hazards on a K-map.
( b )
1
11 1
x 1
x 2
x 3
z
( a )
1
11 1
x 1
x 2
x 3
z
Hazard-free network.
x 1
x 2
x 3
G 1
G 4
G 3
z ( x 1
, x 2
, x 3
)
x 3
G 2
x 1
x 2
Example of a static-0 hazard.
G 1
G 3
G 4
z ( A , B , C , D )
G 2
0
B
D
0
0 0 0 0
0 0
0
C
A
( a )
( b )
A
C
A
D
B
A
C
Example of a static-0 hazard (con’t).
0
B
D
0
0 0 0 0
0 0
0
C
A
G 1
G 4
z ( A , B , C , D )
G 2
G 3
( c )
( d )
A
C
A
D
B
A
C
C
B
D
G 5
Dynamic hazards.
( a ) ( b )
Quine-McCluskey Minimization Method
• Advantages over K-maps
– Can be computerized
– Can handle functions of more than six variables
• Overview of the method
– Given the minterms of a function
– Find all prime implicants (steps 1 and 2)
• Partition minterms into groups according to the number of 1’s
• Exhaustively search for prime implicants
– Find a minimum prime implicant cover (steps 3 and 4)
• Construct a prime implicant chart
• Select the minimum number of prime implicants
Use the Q-M method to find the
MSOP of the function
f(A,B,C,D) = ∏m(2,4,6,8,9,10,12,13,15)
C D
A B
1
0 0 0 1 1 1 1 0
0 4 1 2 8
1 5 1 3 9
3 7 1 5 1 1
2 6 1 4 1 0
0 0
0 1
1 1
1 0
B
D
1 1
1
1 1 1
A
C
1 1
Figure K-map for example 3.30.
List Prime Implicants in Groups
Step 2 -- Generate Prime Implicants
Step 3 -- Prime Implicant Chart
642 8 1 0 1 2 1 3 1 5
×
⊗
√
P I 2
P I 3
P I 4
P I 5
P I 6
* * P I 7
* * P I 1
×
×
× ×
×
×
×
×
×
×
× × ×
9
√ √ √ √
⊗
Step 4 -- Reduced Prime Implicant Chart
642 1 0
×
√
P I 2
* P I 3
* P I 4
P I 5
P I 6
×
×
×
√√ √
× ×
×
×
The Resulting Minimal Realization of f
f(A,B,C,D) = PI1 + PI3 + PI4 + PI7
= 1-0- + -010 + 01-0 + 11-1
= AC′ + B′ CD′ + A′ BD′ + ABD
How the Q-M Results Look on a K-map
C D
A B
0 0 0 1 1 1 1 0
0 4 1 2 8
1 5 1 3 9
3 7 1 5 1 1
2 6 1 4 1 0
0 0
0 1
1 1
1 0
B
1
A
C
1 1
1
D
1
1
1
1 1
Figure 3.33 Grouping of terms.
Covering Procedure
Step 1 -- Identify any minterms covered by only one PI. Select
these PIs for the cover.
Step 2 -- Remove rows covered by the PIs identified in step 1.
Remove minterms covered by the removed rows.
Step 3 -- If a cyclic chart results from step 2, go to step 5.
Otherwise, apply the reduction procedure of steps 1 and 2.
Step 4 -- If a cyclic chart results from step 3, go to step 5.
Otherwise return to step 1.
Step 5 -- Apply the cyclic chart procedure. Repeat step 5 until a
void chart or noncyclic chart chart is produced. In the latter
case, return to step 1.
Coverage Example
f(A,B,C,D) = ∑m(0,1,5,6,7,8,9,10,11,13,14,15)
510 6 8 9 1 0 1 1
×
⊗
√
* * P I 1
P I 2
P I 3
P I 4
P I 5
P I 6
* * P I 7
×
×
×
×
×
× × ×
7
√ √ √ √ √
1 3 1 4 1 5
√ √
⊗
× ×
×
×
×
×
× × ×
× ×
×
×
×
×
×
×
Reduced PI Charts
1 11 05 1 3
×
P I 2
P I 3
P I 4
P I 5
P I 6
×
× ×
×
×
× ×
× ×
×
√ √
×
1 05
* P I 2
* P I 4
Cyclic PI Charts
1. No essential PIs.
2. No row or column coverage.
321 4
×
* P I 1
P I 2
P I 3
P I 4
P I 5
P I 6
× ×
√√
× ×
×
5 6
××
× ×
××
542 6
×
P I 2
P I 3
P I 4
P I 5
P I 6
×
×
×
×
×
×
×
542 6
×
√
* P I 3
P I 4
* P I 5
×
√√ √
× ×
×
×
Using the Q-M Procedure with Incompletely Specified Functions
1. Use minterms and don’t cares when generating prime implicants
2. Use only minterms when finding a minimal cover
Example 3.25 -- Find a minimal sum of products of the following function
using the Quine-McCluskey procedure.
Minimizing Table
PI Chart
732 1 0 1 5 2 7
⊗
√
P I 1
P I 2
P I 3
×
×
1 2
√ √ √ √ √
⊗
× ×
* * P I 4
* * P I 5
* * P I 6
* * P I 7
⊗
⊗
× ×
×
Results of Minimization
f(A,B,C,D,E) = PI1 + PI4 + PI5 + PI6 + PI7 OR
= PI2 + PI4 + PI5 + PI6 + PI7
Half Adder 85
Half Adder (1/2)
 Half-Adder is a circuit which adds two single bits (called X,Y) together, to produce a
result of two bits (called C, S).
 A black-box representation of this circuit is:
Truth table representation is:
X Y C S
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
Half
adder
X
Y
(X+Y)
S
C
Half Adder 86
Half Adder (2/2)
 In sum-of-minterms forms:
C = X.Y
S = X'.Y + X.Y'
 Algebraic simplification could simplify S to:
S = X'.Y + X.Y'
= X⊕Y
 Giving:
X Y C S
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
X
Y
S
C
Karnaugh maps
Karnaugh maps
Karnaugh maps
Karnaugh maps

Karnaugh maps

  • 1.
    Karnaugh Maps -- Atool for representing Boolean functions
  • 2.
    We can comeclose to our aim by using a graphical notation named Karnaugh Map that will be defined in next slides
  • 3.
    Karnaugh Map Technique •A K-Map is simply a folded truth table, where physical adjacency implies logical adjacency • K-Maps are most commonly used hand method for logic minimization. • K-Maps are a graphical technique used to simplify a logic equation. • K-Maps are procedural and much cleaner than Boolean simplification. • K-Maps can be used for any number of input variables, BUT are only practical for two, three, and four variables. 3
  • 4.
    Terminology •Implicant : Productterm that implies function • Prime Implicant : An Implicant that is not completely covered by any other Implicant but itself • Essential prime Implicant : A prime Implicant that has a minter not covered by any other prime Implicant • Product term : An and expression 4 Terms
  • 5.
    Terminology •Minterm : Wedefine a Minterm to be a product that contains all variables of that particular switching function in either complemented or non-complemented form • Maxterm : We define a Maxterm to be a sum that contains all variables of that particular switching function in either complemented or non-complemented form •Standard SOP(Sum Of Products) : In standard SOP, the products are obtained directly from the Karnaugh map or truth table, so the SOP contains all of the variables of the function •Standard POS(Product Of Sums) : In standard POS, the products are obtained directly from the Karnaugh map or truth table, so the POS contains all of the variables of the function 5 Terms
  • 6.
    6 minterm ID A Bf(A,B) minterm 0 0 0 0 1 0 1 1 A’B 2 1 0 1 AB’ 3 1 1 1 AB An example of 2-variable function f(A,B)=A+B
  • 7.
    Simplification Goals • Goal-- minimize the cost of realizing a switching function • Cost measures and other considerations – Number of gates – Number of levels – Interconnection complexity – Preventing hazards • Two-level realizations – Minimize the number of gates (terms in switching function)
  • 8.
    Minimization of Booleanexpressions • The minimization will result in reduction of the number of gates (resulting from less number of terms) and the number of inputs per gate (resulting from less number of variables per term) • The minimization will reduce cost, efficiency and power consumption. •y(x+x`)=y.1=y •y+xx`=y+0=y •(x`y+xy`)=x⊕y •(x`y`+xy)=(x⊕y)`
  • 9.
    Karnaugh Maps • Booleanalgebra helps us simplify expressions and circuits • Karnaugh Map: A graphical technique for simplifying a Boolean expression into either form: – sum of products (SOP) – product of sums (POS) • Goal of the simplification. – There are a minimal number of product/sum terms – Each term has a minimal number of literals • Circuit-wise, this leads to a minimal two-level implementation
  • 10.
    Minimum SOP • f=(xyz +x`yz+ xy`z+ …..) Is called sum of products. The + is sum operator which is an OR gate. The product such as xy is an AND gate for the two inputs x and y.
  • 11.
    Examples • Two variableK-map f(A,B)=∑m(0,1,3)=A`B`+A`B+AB 1 0 1 1 A 0 1 B01
  • 12.
    V 0 0 0 0 B A A Groupsof One – 4 Two Variable K-Map Groupings BA 1 BA 1 1 A B BA 1 B 12
  • 13.
    V 0 0 0 0 B A A Groupsof Two – 4 Two Variable K-Map Groupings B A 1 1 A 1 1 1 B 1 1 B 1 13
  • 14.
    V 1 1 1 1 B A A Groupof Four – 1 Two Variable K-Map Groupings 1 B 14
  • 15.
    Three Variable K-MapGroupings V 0 0 0 0 0 0 0 0 C C BA BA BA BA BA 1 1 BA 1 1 BA 1 1 BA 1 1 1 CA 1 1 CA 1 1 CA 1 1 CB 1 1 CB 1 1 CA 11 CB 1 1 CB 1 Groups of One – 8 (not shown) Groups of Two – 12 15
  • 16.
    Groups of Four– 6 Three Variable K-Map Groupings V 0 0 0 0 0 0 0 0 C C BA BA BA BA 1 C 1 1 1 1 C 1 1 1 A 1 1 1 1 B 1 1 1 1 A 1 1 1 1 B 1 1 1 1 16
  • 17.
    Group of Eight- 1 Three Variable K-Map Groupings V 1 1 1 1 1 1 1 1 C C BA BA BA BA 1 17
  • 18.
    Three variable map •f(A,B,C) = ∑m(0,3,5)= A`B`C`+A`BC+AB`C 1 1 A`BC 1 AB`C A`B` 0 0 A`B 0 1 A B 1 1 A B` 1 0 C` 0 C 1 A`B`C`
  • 19.
    19 minterm ID A Bf(A,B) minterm 0 0 0 0 1 0 1 1 A’B 2 1 0 1 AB’ 3 1 1 1 AB An example of 2-variable function f(A,B)=A+B
  • 20.
    20 Function can berepresented by sum of minterms: f(A,B) = A’B+AB’+AB This is not minimal however! We want to minimize the number of literals and terms. We factor out common terms – A’B+AB’+AB= A’B+AB’+AB+AB =(A’+A)B+A(B’+B)=B+A Hence, we have f(A,B) = A+B
  • 21.
    21 K-Map: Truth Tablein 2 Dimensions A = 0 A = 1 B = 0 B = 1 0 2 1 3 0 1 1 1 A’B AB’ AB f(A,B) = A + B
  • 22.
    22 ID A Bf(A,B) minterm 0 0 0 0 1 0 1 1 A’B 2 1 0 0 3 1 1 1 AB Another Example f(A,B)=B f(A,B)=A’B+AB=(A’+A)B=B
  • 23.
    23 On the K-map: A= 0 A= 1 B= 0 B = 1 0 2 1 3 0 0 1 1 A’B AB f(A,B)=B
  • 24.
    24 ID A Bf(A,B) Maxterm 0 0 0 0 A+B 1 0 1 1 2 1 0 0 A’+B 3 1 1 1 Using Maxterms f(A,B)=(A+B)(A’+B)=(AA’)+B=0+B=B
  • 25.
    Maxterm example f(A,B,C) =∏M(1,2,4,6,7) =(A+B+C`)(A+B`+C)(A`+B+C) )(A`+B`+C) (A`+B`+C`) Note that the complements are (0,3,5) which are the minterms of the previous example 0 0 0 0 0 A`B` A`B AB AB` C` C (A+B) (A+B`) (A`+B`) (A`+B) C C`
  • 26.
    Re-arranging the TruthTable • A two-variable function has four possible minterms. We can re-arrange these minterms into a Karnaugh map • Now we can easily see which minterms contain common literals – Minterms on the left and right sides contain y’ and y respectively – Minterms in the top and bottom rows contain x’ and x respectively x y minterm 0 0 x’y’ 0 1 x’y 1 0 xy’ 1 1 xy Y 0 1 0 x’y’ x’y X 1 xy’ xy Y 0 1 0 x’y’ x’y X 1 xy’ xy Y’ Y X’ x’y’ x’y X xy’ xy
  • 27.
    Karnaugh Map Simplifications •Imagine a two-variable sum of minterms: x’y’ + x’y • Both of these minterms appear in the top row of a Karnaugh map, which means that they both contain the literal x’ • What happens if you simplify this expression using Boolean algebra? x’y’ + x’y = x’(y’ + y) [ Distributive ] = x’ • 1 [ y + y’ = 1 ] = x’ [ x • 1 = x ] Y x’y’ x’y X xy’ xy
  • 28.
    More Two-Variable Examples •Another example expression is x’y + xy – Both minterms appear in the right side, where y is uncomplemented – Thus, we can reduce x’y + xy to just y • How about x’y’ + x’y + xy? – We have x’y’ + x’y in the top row, corresponding to x’ – There’s also x’y + xy in the right side, corresponding to y – This whole expression can be reduced to x’ + y Y x’y’ x’y X xy’ xy Y x’y’ x’y X xy’ xy
  • 29.
    A Three-Variable KarnaughMap • For a three-variable expression with inputs x, y, z, the arrangement of minterms is more tricky: YZ 00 01 11 10 0 x’y’z’ x’y’z x’yz x’yz’ X 1 xy’z’ xy’z xyz xyz’ YZ 00 01 11 10 0 m0 m1 m3 m2 X 1 m4 m5 m7 m6
  • 30.
    Terminology ( cont.) 30 0 0 0 1 1 1 0 1 0 01 11 10 0 1 Karnaugh Map 1 3 2 4 5 7 6 0 AB C
  • 31.
    Figure K-map illustratingimplicants 1 C A B 0 0 0 1 1 1 1 0 0 2 6 4 3 7 5 0 1 B 1 1 1 1 1 A C Minterms: {A′B′ C, A′ BC′, A′ BC, ABC′, ABC} Groups of two minterms: {A′ B, AB, A′ C, BC′, BC} Groups of four minterms: {B} Prime implicants: {A′ C, B} Cover = {A′ C, B} MSOP = A′ C + B
  • 32.
    Generating and SelectingPrime Implicants 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 minterms have been covered.
  • 33.
    Generating and SelectingPrime Implicants (Revisited) 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.
  • 34.
    Example f(a,b,c,d) = ∑m(3,7,11,12,13,14,15) =a`b`cd+ a`bcd + ab`cd + abc`d`+ abc`d + abcd` + abcd =cd(a`b` + a`b + ab`) + ab(c`d` + c`d + cd` + cd ) =cd(a`[b` + b] + ab`) + ab(c`[d` + d] + c[d` + d]) =cd(a`[1] + ab`) + ab(c`[1] + c[1]) =ab+ab`cd + a`cd =ab+cd(ab` + a`) =ab+ cd(a + a`)(a`+b`) = ab + a`cd + b`cd = ab +cd(a` + b`)
  • 35.
    f(A,B,C,D) = ∑m(1,2,3,6)= A′C + BC′ 1 C A B 0 0 0 1 1 1 1 0 0 2 6 4 3 7 5 0 1 B 1 1 1 1 A C
  • 36.
    Proper ordering ? •With this ordering, any group of 2, 4 or 8 adjacent squares on the map contains common literals that can be factored out • “Adjacency” includes wrapping around the left and right sides: • We’ll use this property of adjacent squares to do our simplifications. x’y’z + x’yz = x’z(y’ + y) = x’z • 1 = x’z x’y’z’ + xy’z’ + x’yz’ + xyz’ = z’(x’y’ + xy’ + x’y + xy) = z’(y’(x’ + x) + y(x’ + x)) = z’(y’+y) = z’ Y x’y’z’ x’y’z x’yz x’yz’ X xy’z’ xy’z xyz xyz’ Z Y x’y’z’ x’y’z x’yz x’yz’ X xy’z’ xy’z xyz xyz’ Z
  • 37.
    Three-Variable K-Maps ∑ ==CB(0,4)f ∑ == BA(4,5)f ∑ == B(0,1,4,5)f ∑ == A(0,1,2,3)f BC 00 0 01 1 11 10A 1 0 0 0 1 0 0 0 BC 00 0 01 1 11 10A 0 0 0 0 1 1 0 0 BC 00 0 01 1 11 10A 1 1 1 1 0 0 0 0 BC 00 0 01 1 11 10A 1 1 0 0 1 1 0 0 ∑ == CA(0,4)f ∑ == CA(4,6)f ∑ == CA(0,2)f ∑ == C(0,2,4,6)f BC 00 0 01 1 11 10A 0 1 1 0 0 0 0 0 BC 00 0 01 1 11 10A 0 0 0 0 1 0 0 1 BC 00 0 01 1 11 10A 1 0 0 1 1 0 0 1 BC 00 0 01 1 11 10A 1 0 0 1 0 0 0 0
  • 38.
    Four Variable K-MapGroupings V 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 BA BA BA BA DC DC DC DC Groups of One – 16 (not shown) Groups of Two – 32 (not shown) Groups of Four – 24 (seven shown) CB 1 1 1 1 DB 1 1 1 1 DA 1 1 1 1 CB 1 1 1 1 DB 1 1 1 1 DA 1 1 1 1 DB11 11 38
  • 39.
    Four Variable K-MapGroupings V 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 BA BA BA BA DC DC DC DC Groups of Eight – 8 (two shown) B 1 1 1 1 1 1 1 1 D 1 1 1 1 1 1 1 1 39
  • 40.
    Four Variable K-MapGroupings V 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 BA BA BA BA DC DC DC DC Group of Sixteen – 1 1 40
  • 41.
    Four-Variable K-Maps ∑ ••==DCB(0,8)f ∑ ••== DCB(5,13)f ∑ ••== DBA(13,15)f ∑ ••== DBA(4,6)f ∑ •== CA(2,3,6,7)f ∑ •== DB)(4,6,12,14f ∑ •== CB)(2,3,10,11f ∑ •== DB(0,2,8,10)f CD 00 00 01 01 11 11 10 10 AB 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 CD 00 00 01 01 11 11 10 10 AB 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 CD 00 00 01 01 11 11 10 10 AB 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 CD 00 00 01 01 11 11 10 10 AB 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 CD 00 00 01 01 11 11 10 10 AB 0 0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 CD 00 00 01 01 11 11 10 10 AB 0 0 0 0 1 0 0 1 1 0 0 1 0 0 0 0 CD 00 00 01 01 11 11 10 10 AB 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 CD 00 00 01 01 11 11 10 10 AB 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1
  • 42.
    Four-Variable K-Maps CD 00 00 01 01 11 11 10 10 AB 0 00 0 1 1 1 1 0 0 0 0 0 0 0 0 CD 00 00 01 01 11 11 10 10 AB 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 CD 00 00 01 01 11 11 10 10 AB 1 0 1 0 0 1 0 1 1 0 1 0 0 1 0 1 CD 00 00 01 01 11 11 10 10 AB 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 0 CD 00 00 01 01 11 11 10 10 AB 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 CD 00 00 01 01 11 11 10 10 AB 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 CD 00 00 01 01 11 11 10 10 AB 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 CD 00 00 01 01 11 11 10 10 AB 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 f (4,5,6,7) A B= = •∑ f (3,7,11,15) C D= = •∑ f (0,3,5,6,9,10,12,15)= ∑ f (1,2,4,7,8,11,13,14)= ∑ f A B C D= ⊗ ⊗ ⊗ f A B C D= ⊕ ⊕ ⊕ 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=
  • 43.
    • 4 VariableMaps – f(A,B,C,D) = Σm(0,1,2,3,6,8,9,11,13,14) – f = A C' D + B C D' + B' C ' + B' D + A'B' C D A B 00 01 11 10 00 1 1 1 1 01 0 0 0 1 11 0 1 0 1 10 1 1 1 0
  • 44.
    • Another 4Variable Map – f(A,B,C,D) = Σm(0,1,2,5,6,7,8,9,10,13,15) C D A B 00 01 11 10 00 1 1 0 1 01 0 1 1 1 11 0 1 1 0 10 1 1 0 1 These are not essential!
  • 45.
    For the SimplestResult • Make as few rectangles as possible, to minimize the number of products in the final expression. • Make each rectangle as large as possible, to minimize the number of literals in each term. • Rectangles can be overlapped, if that makes them larger.
  • 46.
    K-map Simplification @SoP Expressions • Let’s consider simplifying f(x,y,z) = xy + y’z + xz • You should convert the expression into a sum of minterms form, – The easiest way to do this is to make a truth table for the function, and then read off the minterms – You can either write out the literals or use the minterm shorthand • Here is the truth table and sum of minterms for our example: x y z f(x,y,z) 0 0 0 0 0 0 1 1 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 1 1 1 0 1 1 1 1 1 f(x,y,z) = x’y’z + xy’z + xyz’+ xyz = m1 + m5 + m6 + m7
  • 47.
    Unsimplifying Expressions • Youcan also convert the expression to a sum of minterms with Boolean algebra – Apply the distributive law in reverse to add in missing variables. – Very few people actually do this, but it’s occasionally useful. • In both cases, we’re actually “unsimplifying” our example expression – The resulting expression is larger than the original one! – But having all the individual minterms makes it easy to combine them together with the K-map xy + y’z + xz = (xy • 1) + (y’z • 1) + (xz • 1) = (xy • (z’ + z)) + (y’z • (x’ + x)) + (xz • (y’ + y)) = (xyz’ + xyz) + (x’y’z + xy’z) + (xy’z + xyz) = xyz’ + xyz + x’y’z + xy’z = m1 + m5 + m6 + m7
  • 48.
    Minimum product ofsums (POS) • The minimum product of sums (POS) of a function, f, is a POS representation of f that contains the fewest number of sum terms and the fewest number of literals of any POS representation of f. • The zeros are considered exactly the same as ones in the case of sum of product (SOP)
  • 49.
    Example f(a,b,c,d) = ∏M(0,1,2,4,5,6,8,9,10) =∑m(3,7,11,12,13,14,15) =[(a+b+c+d)(a+b+c+d`)(a+b`+c`+d`) (a`+b+c`+d`)(a`+b`+c+ d)(a`+b`+c+ d`) (a`+b`+c`+d)(a`+b`+c`+d`)]
  • 50.
    PoS Optimization • Maxtermsare grouped to find minimal PoS expression x +y+z x+y+z’ x+y’+z’ x+y’+z x’ +y+z x’+y+z’ x’+y’+z’ x’+y’+z 00 01 11 10 0 1 x yz
  • 51.
    PoS Optimization • F(W,X,Y,Z)=∏ M(0,1,2,4,5) x +y+z x+y+z’ x+y’+z’ x+y’+z x’ +y+z x’+y+z’ x’+y’+z’ x’+y’+z 00 01 11 10 0 1 x yz 0 0 1 0 0 0 1 1 00 01 11 10 0 1 x yz F(W,X,Y,Z)= Y . (X + Z)
  • 52.
    Terminology ( cont.) •Sometimes writing an expression in a POS form is easier as seen in the following example: 0 1 1 0 1 1 1 1 00 01 11 10 0 1 Karnaugh Map 1 3 2 5 7 64 0 AB C 52
  • 53.
    • POS Minimization –K-maps can be used for POS minimization, too – f(A,B,C) = Σm(2,3,6) • Minimum POS is f = (B)(A' + C') cost = 2 + 4 = 6 • Minimum SOP is f = A'B + BC' cost = 3 + 6 = 9 B C A 00 01 11 10 0 0 0 1 1 1 0 0 0 1
  • 54.
    I don’t care! •You don’t always need all 2n input combinations in an n-variable function – If you can guarantee that certain input combinations never occur – If some outputs aren’t used in the rest of the circuit • We mark don’t-care outputs in truth tables and K-maps with Xs. x y z f(x,y,z) 0 0 0 0 0 0 1 1 0 1 0 X 0 1 1 0 1 0 0 0 1 0 1 1 1 1 0 X 1 1 1 1
  • 55.
    – Many timesthere are incompletely specified conditions • Valuations that can never occur, or for which we “don’t care what the device does” – Modeling such a device requires us to specify don’t care conditions in those instances • Use X as a value to indicate we don't care what happens – Don't care situations are often called incompletely specified functions Don’t Care Conditions
  • 56.
    • Example UsingDon't Cares – f(A,B,C,D) = Σm(1,5,8,9,10) + d(3,7,11,15) – f = A B' + A' D C D A B 00 01 11 10 00 0 1 X 0 01 0 1 X 0 11 0 0 X 0 10 1 1 X 1
  • 57.
    1. Choose anelement from the “on” set 2. Find all maximal groups (prime implicants) of “on” elements and X elements adjacent to that element  Note 1: prime implicants are always a power of 2 in size  Note 2: do not feel compelled to include X’s – use them only when they provide a larger implicant 3. Repeat steps 1-2 for all elements in the “on” set 4. Select all essential prime implicants 5. For all elements of the “on” set not covered by the essential prime implicants, select the smallest number of prime implicants that cover them Karnaugh Map Method Restated
  • 58.
    K-map Summary • K-mapsare an alternative to algebra for simplifying expressions – The result is a MSP/MPS, which leads to a minimal two-level circuit – It’s easy to handle don’t-care conditions – K-maps are really only good for manual simplification of small expressions... • Things to keep in mind: – Remember the correct order of minterms/maxterms on the K-map – When grouping, you can wrap around all sides of the K-map, and your groups can overlap – Make as few rectangles as possible, but make each of them as large as possible. This leads to fewer, but simpler, product terms – There may be more than one valid solution
  • 59.
    Timing Hazards inCombinational Logic Circuits • Hazards are undesirable changes in the output of a combinational logic circuit caused by unequal gate propagation delays. • Static hazard (glitch) -- the output momentarily changes from the correct or static state – Static 1 hazard -- the output changes from 1 to 0 and back to 1 – Static 0 hazard -- the output changes from 0 to 1 and back to 0 • Dynamic hazard (bounce) -- the output changes multiple times during a change of state – Dynamic 0 to 1 hazard -- the output changes from 0 to 1 to 0 to 1 – Dynamic 1 to 0 hazard -- the output changes from 1 to 0 to 1 to 0
  • 60.
    Illustration of astatic hazard. x 1 x 2 x 3 x 1 y 1 y 2 G 1 G 2 G 3I 1 z ( x 1 , x 2 , x 3 ) ( a ) ( b ) x 1 x 2 x 3 y 1 y 2 G 1 G 2 G 3 z ( x 1 , x 2 , x 3 ) x 1
  • 61.
    Illustration of astatic hazard (con’t) x 1 x 2 x 3 y 1 y 2 z T i m e ( c ) t 1 t 2 t 3 t 4 t 5 t 6 D t D t D t
  • 62.
    Illustration of astatic hazard (con’t). x 1 x 2 x 3 y 1 y 2 z T i m e ( d ) t 1 t 2 t 3 t 4 t 5 t 6 t 7 t 8 t 9 D t 2 D t 3 D t 1 D t 3 D t 2 D t 3
  • 63.
    Identifying hazards ona K-map. ( b ) 1 11 1 x 1 x 2 x 3 z ( a ) 1 11 1 x 1 x 2 x 3 z
  • 64.
    Hazard-free network. x 1 x2 x 3 G 1 G 4 G 3 z ( x 1 , x 2 , x 3 ) x 3 G 2 x 1 x 2
  • 65.
    Example of astatic-0 hazard. G 1 G 3 G 4 z ( A , B , C , D ) G 2 0 B D 0 0 0 0 0 0 0 0 C A ( a ) ( b ) A C A D B A C
  • 66.
    Example of astatic-0 hazard (con’t). 0 B D 0 0 0 0 0 0 0 0 C A G 1 G 4 z ( A , B , C , D ) G 2 G 3 ( c ) ( d ) A C A D B A C C B D G 5
  • 67.
  • 68.
    Quine-McCluskey Minimization Method •Advantages over K-maps – Can be computerized – Can handle functions of more than six variables • Overview of the method – Given the minterms of a function – Find all prime implicants (steps 1 and 2) • Partition minterms into groups according to the number of 1’s • Exhaustively search for prime implicants – Find a minimum prime implicant cover (steps 3 and 4) • Construct a prime implicant chart • Select the minimum number of prime implicants
  • 69.
    Use the Q-Mmethod to find the MSOP of the function f(A,B,C,D) = ∏m(2,4,6,8,9,10,12,13,15) C D A B 1 0 0 0 1 1 1 1 0 0 4 1 2 8 1 5 1 3 9 3 7 1 5 1 1 2 6 1 4 1 0 0 0 0 1 1 1 1 0 B D 1 1 1 1 1 1 A C 1 1 Figure K-map for example 3.30.
  • 70.
  • 71.
    Step 2 --Generate Prime Implicants
  • 72.
    Step 3 --Prime Implicant Chart 642 8 1 0 1 2 1 3 1 5 × ⊗ √ P I 2 P I 3 P I 4 P I 5 P I 6 * * P I 7 * * P I 1 × × × × × × × × × × × × × 9 √ √ √ √ ⊗
  • 73.
    Step 4 --Reduced Prime Implicant Chart 642 1 0 × √ P I 2 * P I 3 * P I 4 P I 5 P I 6 × × × √√ √ × × × ×
  • 74.
    The Resulting MinimalRealization of f f(A,B,C,D) = PI1 + PI3 + PI4 + PI7 = 1-0- + -010 + 01-0 + 11-1 = AC′ + B′ CD′ + A′ BD′ + ABD
  • 75.
    How the Q-MResults Look on a K-map C D A B 0 0 0 1 1 1 1 0 0 4 1 2 8 1 5 1 3 9 3 7 1 5 1 1 2 6 1 4 1 0 0 0 0 1 1 1 1 0 B 1 A C 1 1 1 D 1 1 1 1 1 Figure 3.33 Grouping of terms.
  • 76.
    Covering Procedure Step 1-- Identify any minterms covered by only one PI. Select these PIs for the cover. Step 2 -- Remove rows covered by the PIs identified in step 1. Remove minterms covered by the removed rows. Step 3 -- If a cyclic chart results from step 2, go to step 5. Otherwise, apply the reduction procedure of steps 1 and 2. Step 4 -- If a cyclic chart results from step 3, go to step 5. Otherwise return to step 1. Step 5 -- Apply the cyclic chart procedure. Repeat step 5 until a void chart or noncyclic chart chart is produced. In the latter case, return to step 1.
  • 77.
    Coverage Example f(A,B,C,D) =∑m(0,1,5,6,7,8,9,10,11,13,14,15) 510 6 8 9 1 0 1 1 × ⊗ √ * * P I 1 P I 2 P I 3 P I 4 P I 5 P I 6 * * P I 7 × × × × × × × × 7 √ √ √ √ √ 1 3 1 4 1 5 √ √ ⊗ × × × × × × × × × × × × × × × × ×
  • 78.
    Reduced PI Charts 111 05 1 3 × P I 2 P I 3 P I 4 P I 5 P I 6 × × × × × × × × × × √ √ × 1 05 * P I 2 * P I 4
  • 79.
    Cyclic PI Charts 1.No essential PIs. 2. No row or column coverage. 321 4 × * P I 1 P I 2 P I 3 P I 4 P I 5 P I 6 × × √√ × × × 5 6 ×× × × ×× 542 6 × P I 2 P I 3 P I 4 P I 5 P I 6 × × × × × × × 542 6 × √ * P I 3 P I 4 * P I 5 × √√ √ × × × ×
  • 80.
    Using the Q-MProcedure with Incompletely Specified Functions 1. Use minterms and don’t cares when generating prime implicants 2. Use only minterms when finding a minimal cover Example 3.25 -- Find a minimal sum of products of the following function using the Quine-McCluskey procedure.
  • 81.
  • 82.
    PI Chart 732 10 1 5 2 7 ⊗ √ P I 1 P I 2 P I 3 × × 1 2 √ √ √ √ √ ⊗ × × * * P I 4 * * P I 5 * * P I 6 * * P I 7 ⊗ ⊗ × × ×
  • 83.
    Results of Minimization f(A,B,C,D,E)= PI1 + PI4 + PI5 + PI6 + PI7 OR = PI2 + PI4 + PI5 + PI6 + PI7
  • 85.
    Half Adder 85 HalfAdder (1/2)  Half-Adder is a circuit which adds two single bits (called X,Y) together, to produce a result of two bits (called C, S).  A black-box representation of this circuit is: Truth table representation is: X Y C S 0 0 0 0 0 1 0 1 1 0 0 1 1 1 1 0 Half adder X Y (X+Y) S C
  • 86.
    Half Adder 86 HalfAdder (2/2)  In sum-of-minterms forms: C = X.Y S = X'.Y + X.Y'  Algebraic simplification could simplify S to: S = X'.Y + X.Y' = X⊕Y  Giving: X Y C S 0 0 0 0 0 1 0 1 1 0 0 1 1 1 1 0 X Y S C

Editor's Notes

  • #4 Explain what K-Maps are, why we use them, and the advantages of using K-Maps over Boolean algebra.
  • #13 Two variable K-Map, groups of one.
  • #14 Two variable K-Map, groups of two.
  • #15 Two variable K-Map, group of four.
  • #16 Three Variable K-Map: 8 groups of one are not shown because they are obvious. 12 groups of two; all are shown.
  • #17 Three Variable K-Map: 6 groups of four; all are shown.
  • #18 Three Variable K-Map, Group of Eight.
  • #39 Four Variable K-Map: There are 16 groups of one that are not shown because they are obvious. There are 32 groups of two that are not shown because they are obvious. There are 24 groups of four. Seven are show, the other 17 are obvious.
  • #40 Four variable K-Map: There are 8 groups of eight. Two are shown, the other 6 are obvious.
  • #41 Four variable K-Map, group of 16.