in Digital Logic
20,190 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) $
in Digital Logic
20.2k views

4 Comments

what does modulo16 mean in question?
0
0
Modulo is an operator which returns the remainder when one no is divided by other.
For ex. 1 modulo 16 (1%16)

 when 1 is divided by 16 it will leave a remainder of 1 ,so here modulo operator will return the value 1.
0
0
Whole crux of the problem is:

It is asking decimal values of h3h2h1h0 where function g is giving 1.

We have to find g0, g1, g2, g3 and mark option whichever is having same min terms.

Hope it helps.
1
1

7 Answers

81 votes
81 votes
Best answer

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

4 Comments

I cant understand how g is calculated. For example if I take n as 0101(5) then its gray code h will be 0111. now (n+1) is 0110(6). Then (n+1)mod 16 is 1010(10). whose gray code g will be 1111. Where am I getting it wrong?
0
0
@Gupta731  (5+1)%16=6 (0110). Gray code: 0101.
0
0

I understand how to calculate gray code and how to find the minterms, but I’m a bit confused about what the operation is. This is what I got from the question assuming the example 1000

  • the binary number is 8
  • finding the grey code, we get 1100, this is h(b)
  • h(b)+1 is 1101
  • [ h(b)+1 mod 16 ] is 1101
  • now finding g(b)→ gray( ( (h(b)+1) mod 16 ) )
  • shouldn’t this be gray(1101) = 1011 and not 0000 like in the table.

I know I am wrong, I just don’t understand where please help me read the question right and figure out what the operation means.

0
0
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.

 

2 Comments

I cant understand how g is calculated. For example if I take n as 0101(5) then its gray code h will be 0111. now (n+1) is 0110(6). Then (n+1)mod 16 is 1010(10). whose gray code g will be 1111. Where am I getting it wrong?
0
0
n= 0101 (5)

h(n)= gray code of n = 0111

g(n)= gray code of(n+1 mod 16)= gray code of (5+1)mod16= gray code of 6=gray(0110)=0101

NOTE: @Gupta731 What you are doing wrong is, (n+1)mod16 = 6mod16 = 6 NOT 10
1
1
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/

by

4 Comments

Think of how you get the canonical sum of products ∑ form from the truth table. It's the rows in truth table for which the output is 1, we consider them as 'minterms' and write something like ABC + A'BC + A'B'C' and so on as SOP.
So, in this question they are asking ..does function for g1 taking in the input variables h0,h1,h2,h3 has the following minterms?
They have given decimal equivalents of the minterm. So, in the table check where g1 is 1 and the decimal equivalent of gray code h3h2h1h0 is the minterm.
Do this for all g0,g1,g2,g3 and match with options.
9
9

atlast got it..tie buddy .

god fill ur account with black money . tie lot.

now come on following question

https://gateoverflow.in/1056/gate2004-61

0
0
edited by

 g2(h3h2h1h0)

1) see the value of 1  corresponding g2 in all 0 to 15 number

2) write value in decimal for given h3h2h1h0 in the form of minterms 

question is asked about find output in terms of input

1
1
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.

 

1 comment

Thanks.That was creating a lot of confusion for me.
0
0
Answer:

Related questions