The Gateway to Computer Science Excellence

+48 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 .

+42 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.

+9 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)

+5

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.

- All categories
- General Aptitude 1.9k
- Engineering Mathematics 7.5k
- Digital Logic 2.9k
- Programming and DS 4.9k
- Algorithms 4.3k
- Theory of Computation 6.2k
- Compiler Design 2.1k
- Databases 4.1k
- CO and Architecture 3.4k
- Computer Networks 4.1k
- Non GATE 1.5k
- Others 1.5k
- Admissions 595
- Exam Queries 576
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 17

50,644 questions

56,503 answers

195,554 comments

101,039 users