gray codes & karnaugh maps
TRANSCRIPT
![Page 1: Gray Codes & Karnaugh Maps](https://reader031.vdocuments.mx/reader031/viewer/2022012518/6192f41a224c846dc34a25d8/html5/thumbnails/1.jpg)
Gray Codes & Karnaugh Maps
Prof. James L. FrankelHarvard University
Version of 9:19 AM 13-Sep-2017Copyright © 2017, 2016 James L. Frankel. All rights reserved.
![Page 2: Gray Codes & Karnaugh Maps](https://reader031.vdocuments.mx/reader031/viewer/2022012518/6192f41a224c846dc34a25d8/html5/thumbnails/2.jpg)
Gray Code Ordering
• A sequence of n-bit codes in which only one bit changes at each transition• Must include the transition from the last to the first in the sequence as well
• May be used to ensure that at each transition, there can never be an issue of multiple bits changing at slightly different times
• In a clocked synchronous system, this is not an issue because we do not look at the signals while they are in transition
![Page 3: Gray Codes & Karnaugh Maps](https://reader031.vdocuments.mx/reader031/viewer/2022012518/6192f41a224c846dc34a25d8/html5/thumbnails/3.jpg)
Two-Bit Gray Code Sequence
00
01
11
10
![Page 4: Gray Codes & Karnaugh Maps](https://reader031.vdocuments.mx/reader031/viewer/2022012518/6192f41a224c846dc34a25d8/html5/thumbnails/4.jpg)
Three-Bit Gray Code Sequence
000
001
011
010
110
111
101
100
![Page 5: Gray Codes & Karnaugh Maps](https://reader031.vdocuments.mx/reader031/viewer/2022012518/6192f41a224c846dc34a25d8/html5/thumbnails/5.jpg)
Gray Code Properties
• Possible to select a power-of-two subsequence of values in a gray code ordering by looking at some of the bits
• This can be used to cover some of the values as we’ll see
![Page 6: Gray Codes & Karnaugh Maps](https://reader031.vdocuments.mx/reader031/viewer/2022012518/6192f41a224c846dc34a25d8/html5/thumbnails/6.jpg)
Three-Bit Gray Code Subsequences of Length Four
000
001
011
010
110
111
101
100
• Reference the three bits asABC, for example
• Select A = 0• Select A = 1
• Select B = 0• Select B = 1
• Select C = 0• Select C = 1
![Page 7: Gray Codes & Karnaugh Maps](https://reader031.vdocuments.mx/reader031/viewer/2022012518/6192f41a224c846dc34a25d8/html5/thumbnails/7.jpg)
Three-Bit Gray Code Subsequences of Length Four
000
001
011
010
110
111
101
100
• Reference the three bits asABC, for example
• Select A = 0• Select A = 1
• Select B = 0• Select B = 1
• Select C = 0• Select C = 1
![Page 8: Gray Codes & Karnaugh Maps](https://reader031.vdocuments.mx/reader031/viewer/2022012518/6192f41a224c846dc34a25d8/html5/thumbnails/8.jpg)
Three-Bit Gray Code Subsequences of Length Four
000
001
011
010
110
111
101
100
• Reference the three bits asABC, for example
• Select A = 0• Select A = 1
• Select B = 0• Select B = 1
• Select C = 0• Select C = 1
![Page 9: Gray Codes & Karnaugh Maps](https://reader031.vdocuments.mx/reader031/viewer/2022012518/6192f41a224c846dc34a25d8/html5/thumbnails/9.jpg)
Three-Bit Gray Code Subsequences of Length Two
000
001
011
010
110
111
101
100
• Reference the three bits asABC, for example
• Select AB = 00
• Select AB = 01
• Select AB = 11
• Select AB = 10
![Page 10: Gray Codes & Karnaugh Maps](https://reader031.vdocuments.mx/reader031/viewer/2022012518/6192f41a224c846dc34a25d8/html5/thumbnails/10.jpg)
Three-Bit Gray Code Subsequences of Length Two
000
001
011
010
110
111
101
100
• Reference the three bits asABC, for example
• Select AC = 00
• Select AC = 01
• Select AC = 11
• Select AC = 10
![Page 11: Gray Codes & Karnaugh Maps](https://reader031.vdocuments.mx/reader031/viewer/2022012518/6192f41a224c846dc34a25d8/html5/thumbnails/11.jpg)
Three-Bit Gray Code Subsequences of Length Two
000
001
011
010
110
111
101
100
• Reference the three bits asABC, for example
• Select BC = 00
• Select BC = 01
• Select BC = 11
• Select BC = 10
![Page 12: Gray Codes & Karnaugh Maps](https://reader031.vdocuments.mx/reader031/viewer/2022012518/6192f41a224c846dc34a25d8/html5/thumbnails/12.jpg)
Two Literal Karnaugh (or K-) Map
AB 0 1
0
1B
A
![Page 13: Gray Codes & Karnaugh Maps](https://reader031.vdocuments.mx/reader031/viewer/2022012518/6192f41a224c846dc34a25d8/html5/thumbnails/13.jpg)
Three Literal Karnaugh (or K-) Map
ABC 00 01
0
1
11 10
B
C
A
![Page 14: Gray Codes & Karnaugh Maps](https://reader031.vdocuments.mx/reader031/viewer/2022012518/6192f41a224c846dc34a25d8/html5/thumbnails/14.jpg)
Four Literal Karnaugh (or K-) Map
ABCD 00 01
00
01
11 10
11
10
A
B
C
D
![Page 15: Gray Codes & Karnaugh Maps](https://reader031.vdocuments.mx/reader031/viewer/2022012518/6192f41a224c846dc34a25d8/html5/thumbnails/15.jpg)
Observations about Karnaugh Maps
• The K-Map graphically exhibits the adjacencies that are present in the gray code ordering
![Page 16: Gray Codes & Karnaugh Maps](https://reader031.vdocuments.mx/reader031/viewer/2022012518/6192f41a224c846dc34a25d8/html5/thumbnails/16.jpg)
Full Adder K-Maps
0
1
1
0
ABCarryin 00 01
0
1
0
1
1
0
11 10
B
Carryin
A
Sum
Carryout0
0
0
1
ABCarryin 00 01
0
1
1
1
0
1
11 10
B
Carryin
A
![Page 17: Gray Codes & Karnaugh Maps](https://reader031.vdocuments.mx/reader031/viewer/2022012518/6192f41a224c846dc34a25d8/html5/thumbnails/17.jpg)
0
0
0
1
ABCarryin 00 01
0
1
1
1
0
1
11 10
B
Carryin
A
Find Covering Rectangles
Carryout
BCarryin
ACarryin
AB
![Page 18: Gray Codes & Karnaugh Maps](https://reader031.vdocuments.mx/reader031/viewer/2022012518/6192f41a224c846dc34a25d8/html5/thumbnails/18.jpg)
0
0
0
1
ABCarryin 00 01
0
1
1
1
0
1
11 10
B
Carryin
A
Create Simplified Expression
Carryout
BCarryin
ACarryin
AB
Carryout = AB + ACarryin + BCarryin
![Page 19: Gray Codes & Karnaugh Maps](https://reader031.vdocuments.mx/reader031/viewer/2022012518/6192f41a224c846dc34a25d8/html5/thumbnails/19.jpg)
Compare Sum-of-Products and Simplified Expressions
• Sum-of-Products• Carryout = ABCarryin + (~A)BCarryin + A(~B)Carryin + AB(~Carryin)
• Four terms
• Each with three literals
• Simplified• Carryout = AB + ACarryin + BCarryin
• Three terms
• Each with two literals