Gray Code
The gray code is a binary numeral system there two successive values differ by only one bit. It is also known as the reflected binary code.
1-bit gray code: 0 and 1
2-bit gray code:
Decimal | Gray Code |
---|---|
0 | 00 |
1 | 01 |
2 | 11 |
3 | 10 |
3-bit gray code:
Decimal | Gray Code |
---|---|
0 | 000 |
1 | 001 |
2 | 011 |
3 | 010 |
4 | 110 |
5 | 111 |
6 | 101 |
7 | 100 |
Gray Code Simplification
Example
Find the simplest function for the truth table:
0 | 0 | 1 |
0 | 1 | 1 |
1 | 0 | 0 |
1 | 1 | 1 |
solution
Canonical SOP:
(see partial distributive law)
However, we can rearrange the table:
0 | 0 | 1 |
0 | 1 | 1 |
1 | 1 | 1 |
1 | 0 | 0 |
Which makes Gray code on the
Taking the first two columns, we have