The Gateway to Computer Science Excellence
+55 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 by Active (3.3k points) | 6.3k views
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 .

As we know grey codes are not weighted code means there is no pattern to generate grey code and also grey code are reflected code,,I m going to see you how to get grey code ,that may help you

4 Answers

+46 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!

by Active (3.6k points)
edited by
how are you doing matching ...?? whats the exact meaning of g(h1h2h3h4) ??
Yeah explain pls how are you doing matching with respect to g(h3h2h1h0) ?

I got this solution in gatementor. But Dont know how the matching happens ?

@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.
Thank you
i have added some more it should be clear fr everyone!!

not getting thiz

now write g as a function of f ? what does it signify ?not getting any sense .
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 for those rows find out the min terms and see row 0..min term there is 0...see row 1 min term is see row 4 min term is 0110 means 6 and so this for all and then match with options.

g0(h3h2h1h0) 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 ?

to find g0 see what are its min terms inform of (h3 h2 h1 h0)
same thing do fr all

@bikram sir

We need to map min terms of g3g2g1g0 w.r.t h3h2h1h0

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

I think 14 is missing in C option ?

But gray code id non-weighted 

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

how it is 3 ..


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



I'm getting g2(h3h2h1h0)=∑(2,4,5,6,7,12,14,15)

But in the options it is g2(h3h2h1h0)=∑(2,4,5,6,7,12,13,15)

Anyone on the same boat with me?

bro it's not saying (h+1)(modulo 16) it's saying (n+1)(modulo 16). you might be considering h at last.
+11 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).

by Veteran (431k points)
Can u jus elaborate wat does g(h1h2h3h4) mean l??
not getting the answer . How to map ? (Else conversion other thing are clear )
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)
little more describe buddy i think i will get it.
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.

atlast got it..tie buddy .

god fill ur account with black money . tie lot.

now come on following question



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

+4 votes
by Active (2.4k points)
Can you please explain g2 is not 1 at 0010 why is that included in the min term?

Rest everywhere g2 is 1.
+4 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.


by Loyal (6.5k points)
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,306 answers
105,012 users