Consider 4-bit gray code representation of numbers. Let h3 h2 h1 h0 be the gray code representation of a number n and g1g2g3g0 be the gray code representation of the number (n + 1) modulo 16. Which one of the following functions is correct?
Consider 4-bit gray code representation of numbers. Let h3 h2 h1 h0 be the gray code representation of a number n and g1g2g3g0 be the gray code representation of the number (n + 1) modulo 16. Which one of the following functions is correct? Correct Answer g<sub>2</sub> (h<span style="position: relative; line-height: 0; vertical-align: baseline; bottom: -0.25em; font-size:10.5px;">3</span> h<span style="position: relative; line-height: 0; vertical-align: baseline; bottom: -0.25em; font-size:10.5px;">2</span> h<span style="position: relative; line-height: 0; vertical-align: baseline; bottom: -0.25em; font-size:10.5px;">1</span> h<span style="position: relative; line-height: 0; vertical-align: baseline; bottom: -0.25em; font-size:10.5px;">0</span>) = Σ(2,4,5,6,7,12,13,15)
h3 h2 h1 h0 be the gray code representation of a number n and g1g2g3g0 be the gray code representation of the number (n + 1) modulo 16.
The truth table is as shown below.
|
Decimal |
Binary |
h3 |
h2 |
h1 |
h0 |
g3 |
g2 |
g1 |
g0 |
|
0 |
0000 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
1 |
|
1 |
0001 |
0 |
0 |
0 |
1 |
0 |
0 |
1 |
1 |
|
2 |
0010 |
0 |
0 |
1 |
1 |
0 |
0 |
1 |
0 |
|
3 |
0011 |
0 |
0 |
1 |
0 |
0 |
1 |
1 |
0 |
|
4 |
0100 |
0 |
1 |
1 |
0 |
0 |
1 |
1 |
1 |
|
5 |
0101 |
0 |
1 |
1 |
1 |
0 |
1 |
0 |
1 |
|
6 |
0110 |
0 |
1 |
0 |
1 |
0 |
1 |
0 |
0 |
|
7 |
0111 |
0 |
1 |
0 |
0 |
1 |
1 |
0 |
0 |
|
8 |
1000 |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
1 |
|
9 |
1001 |
1 |
1 |
0 |
1 |
1 |
1 |
1 |
1 |
|
10 |
1010 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
0 |
|
11 |
1011 |
1 |
1 |
1 |
0 |
1 |
0 |
1 |
0 |
|
12 |
1100 |
1 |
0 |
1 |
0 |
1 |
0 |
1 |
1 |
|
13 |
1101 |
1 |
0 |
1 |
1 |
1 |
0 |
0 |
1 |
|
14 |
1110 |
1 |
0 |
0 |
1 |
1 |
0 |
0 |
0 |
|
15 |
1111 |
1 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
From the above truth table,
g3(h3 h2 h1 h0) = Σ(4, 9, 10, 11, 12, 13, 14, 15)
g2(h3 h2 h1 h0) = Σ(2, 4, 5, 6, 7, 12, 13, 15)
g1(h3 h2 h1 h0) = Σ(1, 2, 3, 6, 10, 13, 14, 15)
g0(h3 h2 h1 h0) = Σ(0, 1, 6, 7, 10, 11, 12, 13)