69 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?

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

0

can someone plz help ? i understood the solution but my doubt is why ? we have map this with the corresponding grey code number like ( 0110 with 0010 (2) ) as while design the grey code circuit (kmap) we get the minterms by checking the corresposding decimal no like 0110 is grey code of 3(0011) so here g2 bit is 1 so its mean minterm should be 3, like in this way ? is just for making my concept more clear , bcoz this question can be further modified so, kindly clear this doubt n thanks in advance .

64 votes

Best answer

** Answer is C.**

Decimal n | Binary n | H(x) = gray(n) | G(x) = gray[(n+1) mod16] |
---|---|---|---|

0 | $0000$ | $0000 (00)$ | $0001$ |

1 | $0001$ | $0001 (01)$ | $0011$ |

2 | $0010$ | $0011 (03)$ | $0010$ |

3 | $0011$ | $0010 (02)$ | $0110$ |

4 | $0100$ | $0110 (06)$ | $0111$ |

5 | $0101$ | $0111 (07)$ | $0101$ |

6 | $0110$ | $0101 (05)$ | $0100$ |

7 | $0111$ | $0100 (04)$ | $1100$ |

8 | $1000$ | $1100 (12)$ | $1101$ |

9 | $1001$ | $1101 (13)$ | $1111 $ |

10 | $1010$ | $1111 (15)$ | $1110$ |

11 | $1011$ | $1110 (14)$ | $1010$ |

12 | $1100$ | $1010 (10)$ | $1011$ |

13 | $1101$ | $1011 (11)$ | $1001$ |

14 | $1110$ | $1001 (09)$ | $1000$ |

15 | $1111$ | $1000 (08)$ | $0000$ |

We need to map min terms of $g_3g_2g_1g_0$ w.r.t $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, mamximum possible no that can be represented is $15$, so after $15$ we shouldn't get $16$ and go back to $0$. thats why.

Now, mapping is simple.We just have to map such that **h(x)**---->**g(x+1)**

Means if **h represents gray code of 0 then g will represent gray code of 1**

If **h represents gray code of 1 then g will represent for 2** and so on.

For last number **h(15)**, mod $16$ actually comes into picture which will make it to represent as **g(0)**

So, draw table as mentioned above.

Now, write $g$ as a function of $f$. Simply how we do minimisation. See the min terms.

Be careful only in one thing here.

Example for** 2** gray code representation is **0011 meaning 3 in decimal**.So, if **we select this row as a min term**(just an Example) then** we have selected 3 and not 2**, **means row numbers are not representing min terms**. Rest everything is fine!

6

@prasanna, h3h2h1h0 is taken as an 4-bit input and g3g2g1g0 is taken as 4-bit output. so, output from g2 will be the sum of the minterms where it is high.

0

@sudhso

not getting thiz

now write g as a function of f ? what does it signify ?not getting any sense .

not getting thiz

now write g as a function of f ? what does it signify ?not getting any sense .

2

see for g0 , g1 ,g2 ,g3 are separate functions of h(x) in themselves..its like the same thing designing one flip flop from other kind

if we need to find g0 see where it is 1 for h(x)

like it is one at row no 0,1,4,5,8,9,12,13..these are row nos not min terms...so for those rows find out the min terms and represent...like see row 0..min term there is 0...see row 1 min term is 1...now see row 4 min term is 0110 means 6 and so on...do this for all and then match with options.

if we need to find g0 see where it is 1 for h(x)

like it is one at row no 0,1,4,5,8,9,12,13..these are row nos not min terms...so for those rows find out the min terms and represent...like see row 0..min term there is 0...see row 1 min term is 1...now see row 4 min term is 0110 means 6 and so on...do this for all and then match with options.

0

*g*0(*h*3*h*2*h*1*h*0) what is meant tell that ?

g0 is lsb of G(x) ?

and h3 h2 h1 h0 are position of four digits?

if it than we take g0 of which means there are 15 g0 at respective column and how do match ?

0

@bikram sir

We need to map min terms of *g*3*g*2*g*1*g*0 w.r.t *h*3*h*2*h*1*h*0

what does it mean?...plz elaborate this procedure .

0

But gray code id **non-weighted **..so

(0011) In gray means (0010) in binary and hence 2 in decimal.

how it is 3 ..

0

@jatin khachane 1 check the mapping given in the question don't do conversion here.

Step 1: 4 bits hence 16 combinations. Write down all 16 combinations of gray code for each of binary (0-15)

Step 2 : it says a gray code combination of a binary number n will map to gray code of binary number n+1. **Check value for each code is mapped to value below it.**

Continuing to your answer. gray code of 2(0010) will be (0011) and now this (0011) will be mapped to gray code of 3 which is 0010.

0

I'm getting* g*2(*h*3*h*2*h*1*h*0)=∑(2,4,5,6,7,12,**14**,15)

But in the options it is *g*2(*h*3*h*2*h*1*h*0)=∑(2,4,5,6,7,12,**13**,15)

Anyone on the same boat with me?

0

bro it's not saying (h+1)(modulo 16) it's saying (n+1)(modulo 16). you might be considering h at last.

0

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

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.

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/

1

g2(h3h2h1h0) means the values of h3h2h1h0 where g2 is 1. ($\sum$ means the sum of combinations in truth table where the output is 1)

8

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.

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.

11 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.**

5 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*.