20,261 views
91 votes
91 votes

Consider numbers represented in 4-bit Gray code. Let $ h_{3}h_{2}h_{1}h_{0}$  be the Gray code  representation of a number $n$ and let $ g_{3}g_{2}g_{1}g_{0}$ be the Gray code of $ (n+1)(modulo 16)$  value of the number. Which one of the following functions is correct?

  1. $ g_{0}(h_{3}h_{2}h_{1}h_{0})=\sum (1,2,3,6,10,13,14,15) $
  2. $ g_{1}(h_{3}h_{2}h_{1}h_{0})=\sum (4, 9,10,11,12,13,14,15) $
  3. $ g_{2}(h_{3}h_{2}h_{1}h_{0})=\sum (2, 4,5,6,7,12,13,15) $
  4. $ g_{3}(h_{3}h_{2}h_{1}h_{0})=\sum (0,1,6,7,10,11,12,13) $

7 Answers

Best answer
81 votes
81 votes

The answer is C.$$\small \begin{array}{c|c|c|c}  \textbf{Decimal}\; \bf{n} & \textbf{Binary}\; \bf{n} & \bf{H(x) = }\textbf{Gray} (n) & \bf{G(x) = }\textbf{Gray}\bf{[(n+1) \mod 16]} \\\hline 0 & 0000 & 0000(00) & 0001 \\\hline 1 & 0001 & 0001(01)& 0011 \\\hline 2 & 0010 & 0011(03) & 0010 \\\hline 3 & 0011 &0010(02) & 0110 \\\hline 4 &0100  & 0110(06) & 0111  \\\hline 5 &0101  & 0111(07) & 0101   \\\hline 6 & 0110 & 0101 (05) & 0100  \\\hline 7 & 0111 & 0100 (04) &1100   \\\hline 8 & 1000 & 1100 (12) & 1101   \\\hline 9 &1001  & 1101 (13) & 1111  \\\hline 10 &1010  & 1111 (15) &  1110 \\\hline 11 &1011  & 1110 (14) & 1010  \\\hline 12& 1100 &1010 (10) & 1011   \\\hline 13 & 1101 &1011 (11) &1001    \\\hline 14 &1110 &1001 (09) &1000 \\\hline 15 &1111  & 1000 (08) & 0000  \\\hline\end{array}$$ We need to map min terms of $g_3g_2g_1g_0$ with respect to $h_3h_2h_1h_0$.

Hence as highlighted $g_2$ matches with option C.

Edit :
We have to map $h(x)$ with $g(x)$. Mod 16 is used in $g(x)$ only because since we have $4$ bits, the maximum possible no that can be represented is $15$, so after $15$ we shouldn't get $16$ and go back to $0$. that's why.
Now, mapping is simple. We just have to map such that $h(x)\rightarrow  g(x+1)$
This means if h represents gray code of $0$ then $g$ will represent the gray code of $1$
If h represents the gray code of $1$ then $g$ will represent $2$ and so on.
For the last number $h(15) \mod 16$ actually comes into the picture which will make it represent as $g(0)$
So, drawing the table as mentioned above.
Now, write $g$ as a function of $f$. Simply how we do minimization. See the minterms.
Be careful only in one thing here.
An example for $2$ gray code representations is $0011$ meaning $3$ in decimal. So, if we select this row as a minterm(just an example) then we have selected $3$ and not $2,$ means row numbers are not representing minterms. Rest everything is fine!

edited by
31 votes
31 votes

The question simply says that if 'h' (coded as $h_3h_2h_1h_0$) is the 4-bit gray code of n then 'g' (coded as $g_3g_2g_1g_0$) is the gray code of (n+1) mod 16.

So, write the gray code as:

  function h function g
$n$ $h_3$ $h_2$ $h_1$ $h_0$ $g_3$ $g_2$ $g_1$ $g_0$
0 0 0 0 0 0 0 0 1
1 0 0 0 1 0 0 1 1
2 0 0 1 1 0 0 1 0
3 0 0 1 0 0 1 1 0
4 0 1 1 0 0 1 1 1
5 0 1 1 1 0 1 0 1
6 0 1 0 1 0 1 0 0
7 0 1 0 0 1 1 0 0
8 1 1 0 0 1 1 0 1
9 1 1 0 1 1 1 1 1
10 1 1 1 1 1 1 1 0
11 1 1 1 0 1 0 1 0
12 1 0 1 0 1 0 1 1
13 1 0 1 1 1 0 0 1
14 1 0 0 1 1 0 0 0
15 1 0 0 0 0 0 0 0

Now, we just have to write $g_2$ as a function of $h$ i.e $g_2(h_3h_2h_1h_0)=\sum(minterms \ of\ g_2) $

To get minterms, convert h to decimal wherever you get '1' in $g_2$.

$\therefore g_2=\sum (2,4,5,6,7,12,13,15) $

Hence, Correct Answer: C.

 

12 votes
12 votes

(C) is the answer. 

For each gi, we need to find the 4-bit sequences whose next code gives a 1 for bit position i. So, based on the Gray code sequence (in below link) we get (C) as true. (Just convert the Gray code to decimal, and we get the minterm). 

http://electrical4u.com/gray-code-binary-to-gray-code-and-that-to-binary-conversion/

8 votes
8 votes

g0 (h3h2h1h0) = ∑ (1,2,3,6,10,13,14,15)

These 1,2,3,6,10... numbers are not in decimal. They're in Gray Code.

Minterms of g2 would be: 3,4,5,6,7,8,9,10.

In Gray code, it'll be: 2,4,5,6,7,12,13,15 (not respectively)

Hence, Option C.

 

Answer:

Related questions

2 votes
2 votes
1 answer
2
shreshtha5 asked Nov 29, 2015
4,377 views
Convert $1101_2$ to corresponding $excess-3$ binary number.(A) $10000$(B) $01000110$(C) $100110$(D) $10110$
70 votes
70 votes
6 answers
3
Rucha Shelke asked Sep 22, 2014
14,918 views
Given two three bit numbers $a_{2}a_{1}a_{0}$ and $b_{2}b_{1}b_{0}$ and $c$ the carry in, the function that represents the carry generate function when these two numbers ...
34 votes
34 votes
2 answers
4
Rucha Shelke asked Sep 22, 2014
9,647 views
Consider the circuit above. Which one of the following options correctly represents $f\left(x,y,z\right)$$x\bar{z}+xy+\bar{y}z$$x\bar{z}+xy+\overline{yz}$$xz+xy+\overline...