quine - mccluskey · quine‐mccluskey algorithm(for e15) 1. starting with a list of cubes (groups)...
TRANSCRIPT
Minimization of a three variable map as seen on a cube
q1 q0
00 01 11 10q2
01m0
000
0m1001
0m3011
1m2010
11m4100
1m5101
0m7111
1m6110
Adapted from “Fundamentals of Digital Logic with Verilog Design” by Brown and Vranesic, McGraw‐Hill
2 1 0f q ,q ,q m(0,2,4,5,6) 0 2 1q q q
A four variable map as seen on a hypercube
Adapted from http://commons.wikimedia.org/wiki/File:Schlegel_wireframe_8‐cell.png
Karnaugh Map, with minterms and “Groups”Q1 Q0
00 01 11 10Q3 Q2
00m0
0000
G0
m1
0001
G1
m3
0011
G2
m2
0010
G1
01m4
0100
G1
m5
0101
G2
m7
0111
G3
m6
0110
G2
11m12
1100
G2
m13
1101
G3
m15
1111
G4
m14
1110
G3
10m8
1000
G1
m9
1001
G2
m11
1011
G3
m10
1010
G2
Every minterm in Group n (Gn) has n 1’s. So minterms in G2 have 2 ones.
Example 1, Generate Prime Implicants
Minimize f(d,c,b,a)=m(1,3,5,11,12,13,14,15)
0 1 1 0
0 1 0 0
1 1 1 1
0 0 1 0
Group minterm Implicant
List 1 (1 cube – a node) List 2 (2 cube – an edge) List 3 (3 cube – a face)
G0 ‐‐‐‐‐‐‐ G1,2 1,3 00x1 P1 G1,2,3 ‐‐‐‐‐‐
G1 1 0001 √ 1,5 0x01 P2 G2,3,4 12,13,14,15 11xx P6G2 3 0011 √ G2,3 3,11 x011 P3 12,14,13,15
5 0101 √ 5,13 x101 P412 1100 √ 12,13 110x √
G3 11 1011 √ 12,14 11x0 √13 1101 √ G3,4 11,15 1x11 P514 1110 √ 13,15 11x1 √
G4 15 1111 √ 14,15 111x √
Table to generate prime implicants
Note: Prime implicants can be identified on Karnaugh map for low number of inputs.
Example 1, Find Minimum Cover (1)0 1 1 0
0 1 0 0
1 1 1 1
0 0 1 0
PrimeImplicant m1 m3 m5 m11 m12* m13 m14* m15
P1 √ √P2 √ √P3 √ √P4 √ √P5 √ √P6 √ √ √ √
Any column with a single check mark is only covered by one prime implicant (i.e., IPE), so that implicant must be chosen and can be removed from the table,along with all the other minterms covered by that implicant.So we choose P6 as one of our implicants.We can then work with a simplified table.
minterms implicant
1,3 001x P1
1,5 0x01 P2
3,11 x011 P3
5,13 x101 P4
11,15 1x11 P5
12,13,14,15 11xx P6
Example 1, Find Minimum Cover (2)0 1 1 0
0 1 0 0
1 1 1 1
0 0 1 0PrimeImplicant m1 m3 m5 m11
P1 √ √P2 √ √P3 √ √P4 √P5 √
• We say that row P2 dominates row P4 because P2 covers every minterm covered by P4, so we only need P2.
• So by including P2, we are sure that the resulting circuit will be no more “costly” than it would by including P4.
• So eliminate P4. This makes P2 essential (because it is the only implicant covering m5).• So we choose P2 and we can eliminate m1 and m5 from the table.• Note: book uses slightly different method (we will discuss later).• We can then work with a simplified table.
Example 1, Find Minimum Cover (3)0 1 1 0
0 1 0 0
1 1 1 1
0 0 1 0PrimeImplicant m3 m11
P1 √P3 √ √P5 √
• In the same way P3 dominates P1 and P5, so we eliminate them.• So we choose P3.• We eliminate columns m3 and m11 and have an empty table, (because we pick P3) so
we can stop.
• The prime implicants we have chosen (P6=11xx, P2=0x01, and P3=x011) form our minimum cover.
• Note: there are no fundamental difficulties in extending this to more inputs (the bookkeeping just gets harder – but computers are good at that).
P6 P2 P3
f(d,c,b,a) m 1,3,5,11,12,13,14,15
d c d b a c b a
P6
P2
P3
Example 2, QM and don’t‐caresGenerate Prime Implicants (include don’t cares)Minimize f(d,c,b,a)=m(0,4,5,7,8,10,14,15) + D(1,2,12)
Group Implicant
List 1 (1 cube – a node) List 2 (2 cube – an edge) List 3 (3 cube – a face)
G0 0 0000 √ G0,1 0,1 000x √ G0,1,2 0,1,4,5 0x0x P4
G1 1 0001 √ 0,2 00x0 √ 0,4,1,5
2 0010 √ 0,4 0x00 √ 0,2,8,10 x0x0 P5
4 0100 √ 0,8 x000 √ 0,8,2,10
8 1000 √ G1,2 1,5 0x01 √ 0,4,8,12 xx00 P6
G2 5 0101 √ 2,10 x010 √ 0,8,4,12
10 1010 √ 4,5 010x √ G1,2,3 8,10,12,14 1xx0 P7
12 1100 √ 4,12 x100 √ 8,12,10,14
G3 7 0111 √ 8,10 10x0 √
14 1110 √ 8,12 1x00 √
G4 15 1111 √ G2,3 5,7 01x1 P1
10,14 1x10 √
12,14 11x0 √
G3,4 7,15 x111 P2
14,15 111x P3
1 X 0 X
1 1 1 0
X 0 1 1
1 0 0 1
Example 2, Find minimum Cover (1)(exclude don’t care minterms)
1 X 0 X
1 1 1 0
X 0 1 1
1 0 0 1
PrimeImplicant m0 m4 m5 m7 m8 m10 m14 m15
P1 √ √P2 √ √P3 √ √P4 √ √ √P5 √ √ √P6 √ √ √P7 √ √ √
• No essential prime implicants.• No row domination.• Column m0 dominates column m4. So we eliminate column m0
(when we cover m4 we also cover m0, so m0 is not needed).• In the same way column m8 dominates column m10, so remove m8.• Now we can work with a simplified table.
minterms Implicant
5,7 01x1 P1
7,15 x111 P2
14,15 111x P3
0,1,4,5 0x0x P4
0,2,8,10 x0x0 P5
0,4,8,12 xx00 P6
8,10,12,14 1xx0 P7
Example 2, Find minimum Cover (2)1 X 0 X
1 1 1 0
X 0 1 1
1 0 0 1Prime
Implicant m4 m5 m7 m10 m14 m15
P1 √ √P2 √ √P3 √ √P4 √ √P5 √P6 √P7 √ √
• No essential prime implicants.• Row P4 dominated P6, so eliminate P6.• This makes P4 essential.• So we choose P4 to be in our cover, and we can eliminate columns m4 and m5.• Row P7 dominate P5, so eliminate P5.• This makes P7 essential (for m10).• Choose P7 and eliminate columns m10 and m14.• This lets us work with a simplified table (we eliminate chosen implicants (P4 and P7)
from simplified table).
Example 2, Find minimum Cover (3)1 X 0 X
1 1 1 0
X 0 1 1
1 0 0 1PrimeImplicant m7 m15
P1 √P2 √ √P3 √
• No essential prime implicants.• Row P2 dominates P1 and P3, so choose P2.• This lets us eliminate row P1 and P3 and we have an empty table
(since we have picked P2).
• The solution includes P2=x111, P4=0x0x, P7=1xx0.
P2 P4 P7
f(d,c,b,a) m 0,4,5,7,8,10,14,15 D 1,2,12
c b a d b d a
P2
P4
P7
Example 3, Minimize f(d,c,b,a)=m(5,6,10,15)+D(2,4,7,11,13,14)
Group Implicant
List 1 (1 cube – a node) List 2 (2 cube – an edge) List 3 (3 cube – a face)
G0 ‐‐‐‐ G1,2 2,6 0x10 √ G1,2,3 2,6,10,14 xx10 P1
G1 2 0010 √ 2,10 x010 √ 2,10,6,14
4 0100 √ 4,5 010x √ 4,5,6,7 011x P2
G2 5 0101 √ 4,6 01x0 √ 4,6,5,7
6 0110 √ G2,3 5,7 01x1 √ G2,3,4 5,7,13,15 x1x1 P3
10 1010 √ 5,13 x101 √ 5,13,7,15
G3 7 0111 √ 6,7 011x √ 6,7,14,15 011x P4
11 1011 √ 6,14 x110 √ 6,14,7,15
13 1101 √ 10,11 101x √ 10,11,14,15 1x1x P5
14 1110 √ 10,14 1x10 √ 10,14,11,15
G4 15 1111 √ G3,4 7,15 x111 √
11,15 1x11 √
13,15 11x1 √
14,15 111x √
0 X 0 X
X 1 X 1
0 X 1 X
0 0 X 1
Example 3, Find minimum Cover (1)(exclude don’t care minterms)
PrimeImplicant m5 m6 m10 m15
P1 √ √P2 √ √P3 √ √P4 √ √P5 √ √
• No essential prime implicants.• No row domination.• No column domination• Use branching – try including implicants and solving.
0 X 0 X
X 1 X 1
0 X 1 X
0 0 X 1
Example 3, Find minimum Cover (2)
PrimeImplicant m5 m15
P2 √P3 √ √P4 √P5 √
0 X 0 X
X 1 X 1
0 X 1 X
0 0 X 1
P1
P3
PrimeImplicant m5 m6 m10 m15
P1 √ √P2 √ √P3 √ √P4 √ √P5 √ √
PrimeImplicant m5 m15
P2 √P3 √ √P4 √P5 √
• Try including P1 (eliminate columns m6 and m10)• P3 covers both m5 and m15, so choose it.• Cover includes P1 and P3
P1
P3
Example 3, Find minimum Cover (3)
• Next, we try including P2 (eliminate columns m5and m6)
• We can form a cover of the simplified table with just P5.
• Cover include P2 and P5
0 X 0 X
X 1 X 1
0 X 1 X
0 0 X 1
P5
PrimeImplicant m5 m6 m10 m15
P1 √ √P2 √ √P3 √ √P4 √ √P5 √ √
P2
PrimeImplicant m10 m15
P1 √P3 √P4 √P5 √ √
Example 3, Find minimum Cover (4)
• We don’t need to try with P3 because it is part of a previous solution with only P1.
• Try including P4 (eliminate columns m6 and m15)• Cover include P4 and two others (P1 and P2;
P1 and P3; P5 and P2; P5 and P3) for a total of 3 implicants, so we reject the solution (it is more complex than others)
• We don’t need to try P5 because it was included in a previous solution with only P2.
• So… use one of the previous solutions (either use P1 and P3, or P2 and P5).
0 X 0 X
X 1 X 1
0 X 1 X
0 0 X 1
PrimeImplicant m5 m6 m10 m15
P1 √ √P2 √ √P3 √ √P4 √ √P5 √ √
P4
PrimeImplicant m5 m10
P1 √P2 √P3 √P5 √
The AlgorithmQuine‐McCluskey algorithm (for E15)1. Starting with a list of cubes (groups) that represent the minterms where f = 1 or a don't‐care
condition, generate the prime implicants by successive pairwise comparisons of the cubes.2. Derive a cover table which indicates the minterms where f = 1 that are covered by each prime
implicant.3. Include the essential prime implicants (if any) in the final cover and reduce the table by removing both
these prime implicants and the covered minterms.4. Use the concept of row and column dominance to reduce the cover table further. 5. Repeat steps 3 and 4 until the cover table is either empty or no further reduction of the table is
possible.6. If the reduced cover table is not empty, then use the branching approach to determine the remaining
prime implicants that should be included in a minimum cost cover.
Quine‐McCluskey algorithm (from text)The algorithms are the same except for step 4.4. Use the concept of row and column dominance to reduce the cover table further. A dominated row is
removed only if the cost of its prime implicant is greater than or equal to the cost of the dominating row's prime implicant.
The two methods result in the same number of gates. However, since the text method may end up using a prime implicant with lower cost (fewer inputs) the resulting gates used may have fewer inputs. However, it complicates the process enough (step 6, branching, is often required) so we won’t use it. Depending on the technology used, a gate with more inputs may not be more costly than one with fewer inputs.
An example follows.
Explore difference in methods
f m 5,13,15 D ︵0,1,4,14 ︶
Group Implicant
List 1 (1 cube – a node) List 2 (2 cube – an edge) List 3 (3 cube – a face)
G0 0 0000 G0,1 0,1 000x √ G0,1,2 0,1,4,5 0x0x P4
G1 1 0001 √ 0,4 0x00 √ 0,4,1,5
4 0100 √ G1,2 1,5 0x01 √
G2 5 0101 √ 4,5 010x √
G3 13 1101 √ G2,3 5,13 X101 P1
14 1110 √ G3,4 13,15 11x1 P2
G4 15 1111 √ 14,15 111x P3
P1
P2 P3
P4X X 0 0
X 1 0 0
0 1 1 X
0 0 0 0
Find Cover
f a,b,c,d m 5,13,15 D ︵0,1,4,14 ︶
m5 m13 m15
P1 = x101 √ √P2 = 11x1 √ √P3 = 111x √P4 = 0x0x √
• By our rules P1 dominates P4 so we would pick P1 and P2 (P2 dominates P3)• This results in
• By book rules you would keep P1 and P4 (because P4 is lower cost (fewer inputs)) and use branching to find cover. The final result would be P4 and P2.• This results in
•We will use simpler rules. This results in the same number of gates (but some gates may have more inputs).
f c b a d c a
f d b d c a
P1
P2 P3
P4X X 0 0
X 1 0 0
0 1 1 X
0 0 0 0