Why do we use Gray code in asynchronous FIFO? (I am aware that only ONE bit changes in Gray code at a time, but what is the advantage of that?)
Gray code in asynchronous FIFO design
Started by ●April 4, 2007
Reply by ●April 4, 20072007-04-04
On Apr 4, 2:57 pm, "anand" <writean...@gmail.com> wrote:> Why do we use Gray code in asynchronous FIFO? (I am aware that only > ONE bit changes in Gray code at a time, but what is the advantage of > that?)This sounds suspiciously like a homework problem, but I'll give you a clue. Suppose you wanted to sample the write address pointer using the read clock? What would happen if the address were changing just as you sampled it?
Reply by ●April 4, 20072007-04-04
On Apr 4, 12:19 pm, "Gabor" <g...@alacron.com> wrote:> On Apr 4, 2:57 pm, "anand" <writean...@gmail.com> wrote: > > > Why do we use Gray code in asynchronous FIFO? (I am aware that only > > ONE bit changes in Gray code at a time, but what is the advantage of > > that?) > > This sounds suspiciously like a homework problem, but I'll give you a > clue. Suppose you wanted to sample the write address pointer using > the read clock? What would happen if the address were changing just > as you sampled it?Well the setup time would not be met, therefore, metastability will occur? No, this is not a HW problem, rather, I am trying to prepare for an interview ;-)
Reply by ●April 4, 20072007-04-04
"anand" <writeanand@gmail.com> wrote in message news:1175720120.262865.103380@q75g2000hsh.googlegroups.com...> On Apr 4, 12:19 pm, "Gabor" <g...@alacron.com> wrote: >> On Apr 4, 2:57 pm, "anand" <writean...@gmail.com> wrote: >> >> > Why do we use Gray code in asynchronous FIFO? (I am aware that only >> > ONE bit changes in Gray code at a time, but what is the advantage of >> > that?) >> >> This sounds suspiciously like a homework problem, but I'll give you a >> clue. Suppose you wanted to sample the write address pointer using >> the read clock? What would happen if the address were changing just >> as you sampled it? > > Well the setup time would not be met, therefore, metastability will > occur? > No, this is not a HW problem, rather, I am trying to prepare for an > interview ;-)I almost think it's unfair to give you information if the new comany wants you for your knowledge and ability. But perhaps the ability to ask the professionals in a newsgroup is underrated. Keep in mind that propagation delays aren't the same for all sources and all destinations. When you sample the write address from the read domain, there will be an area of uncertainty where the bits are transitioning between the previous and next values. The metastability windows in modern devices are extremely slow; I think Peter Alfke's numbers from one of the most recent high-end families was sub-femtosecond. Darn, that's small! So Metastability isn't an issue, the uncertainty region between values is the issue. If you're only uncertain about one bit, it doesn't matter if you have the previous or next value - both are valid for your "on the edge" calculation. What isn't valid is getting a pointer that's off by 2, 4, or 8 from either of the two valid values you're trying to sample. Now, do you know how to properly pipeline? How about state machines: can you design a soda dispenser state machine to count change? And how many gas stations would you estimate are in the US (please explain your reasoning)? If you had a belt tight around the equator of the earth, how much length do you figure you'd need to add to raise the belt to an altitude of 1 foot across the entire distance and why? Good luck with your interviewing.
Reply by ●April 4, 20072007-04-04
Quick typo clarification. I meant small, not slow. "The metastability windows in modern devices are extremely small; I think Peter Alfke's numbers from one of the most recent high-end families was sub-femtosecond." I hate it when that happens. "John_H" <newsgroup@johnhandwork.com> wrote in message news:13185gkp47lpq2c@corp.supernews.com...> "anand" <writeanand@gmail.com> wrote in message > news:1175720120.262865.103380@q75g2000hsh.googlegroups.com... >> On Apr 4, 12:19 pm, "Gabor" <g...@alacron.com> wrote: >>> On Apr 4, 2:57 pm, "anand" <writean...@gmail.com> wrote: >>> >>> > Why do we use Gray code in asynchronous FIFO? (I am aware that only >>> > ONE bit changes in Gray code at a time, but what is the advantage of >>> > that?) >>> >>> This sounds suspiciously like a homework problem, but I'll give you a >>> clue. Suppose you wanted to sample the write address pointer using >>> the read clock? What would happen if the address were changing just >>> as you sampled it? >> >> Well the setup time would not be met, therefore, metastability will >> occur? >> No, this is not a HW problem, rather, I am trying to prepare for an >> interview ;-) > > I almost think it's unfair to give you information if the new comany wants > you for your knowledge and ability. But perhaps the ability to ask the > professionals in a newsgroup is underrated. > > Keep in mind that propagation delays aren't the same for all sources and > all destinations. When you sample the write address from the read domain, > there will be an area of uncertainty where the bits are transitioning > between the previous and next values. The metastability windows in modern > devices are extremely slow; I think Peter Alfke's numbers from one of the > most recent high-end families was sub-femtosecond. Darn, that's small! > So Metastability isn't an issue, the uncertainty region between values is > the issue. If you're only uncertain about one bit, it doesn't matter if > you have the previous or next value - both are valid for your "on the > edge" calculation. What isn't valid is getting a pointer that's off by 2, > 4, or 8 from either of the two valid values you're trying to sample. > > Now, do you know how to properly pipeline? How about state machines: can > you design a soda dispenser state machine to count change? And how many > gas stations would you estimate are in the US (please explain your > reasoning)? If you had a belt tight around the equator of the earth, how > much length do you figure you'd need to add to raise the belt to an > altitude of 1 foot across the entire distance and why? > > Good luck with your interviewing. >
Reply by ●April 4, 20072007-04-04
hi thanks for your response(s). "I almost think it's unfair to give you information if the new comany wants you for your knowledge and ability. But perhaps the ability to ask the professionals in a newsgroup is underrated" Well I would disagree with the above. Reason is, it is not that I CANNOT design - I DO have a design background and have done a lot of it in my last role (barring the async fifo that is!) . It is just that the last few years I happen to be doing something else, and all I am doing is brushing up. And for doing so, anyone will certainly use ANY and ALL resources including groups at their disposal, isnt that logical? Unless you use something on a daily basis, I dont think it is realistic to show up at a tech company and be serious about landing an offer. Anyways, you have answered my question and that is what counts Hopefully, my "read_ptr" is not even off by 1 bit :-) Thanks!!!
Reply by ●April 5, 20072007-04-05
> > >And how many gas stations would you estimate are in the US (please explain your > > reasoning)?This is interesting. I dont know the answer, but the reasoning can be tagged to the distribution of gas station /sq mile or per population density.> >If you had a belt tight around the equator of the earth, how > > much length do you figure you'd need to add to raise the belt to an > > altitude of 1 foot across the entire distance and why?The earth's equatorial radius is 3,963.189mi, so elevate the radius by 1 ft, from the top view, it would be like drawing an outer circle with a 1 ft border. From this we can calculate the new radius and hence the addition in the radius gives us the new circumference and thus the addition in length.....what do u think...am I way off???
Reply by ●April 5, 20072007-04-05
> >>> If you had a belt tight around the equator of the earth, how >>> much length do you figure you'd need to add to raise the belt to an >>> altitude of 1 foot across the entire distance and why? > The earth's equatorial radius is 3,963.189mi, so elevate the radius by > 1 ft, from the top view, it would be like drawing an outer circle with > a 1 ft border. From this we can calculate the new radius and hence the > addition in the radius gives us the new circumference and thus the > addition in length.....what do u think...am I way off???You don't need the earth radius. Let's says the original radius is r and expressed in feet, the original belt would be 2*pi*r . By adding 1 feet, you now have a belt of 2*pi*(r+1). So you added 2*pi feet to it no matter what. Sylvain
Reply by ●April 5, 20072007-04-05
On Apr 5, 12:29 am, Sylvain Munaut <tnt-at-246tNt- dot-...@youknowwhattodo.com> wrote:> >>> If you had a belt tight around the equator of the earth, how > >>> much length do you figure you'd need to add to raise the belt to an > >>> altitude of 1 foot across the entire distance and why? > > The earth's equatorial radius is 3,963.189mi, so elevate the radius by > > 1 ft, from the top view, it would be like drawing an outer circle with > > a 1 ft border. From this we can calculate the new radius and hence the > > addition in the radius gives us the new circumference and thus the > > addition in length.....what do u think...am I way off??? > > You don't need the earth radius. > > Let's says the original radius is r and expressed in feet, the > original belt would be 2*pi*r . By adding 1 feet, you now have > a belt of 2*pi*(r+1). So you added 2*pi feet to it no matter what. > > SylvainYeah I knw....I have a habit of thinking out loud....atleast I wasnt way off Any idea on the estimation on the number of gas pumps in the US?
Reply by ●April 5, 20072007-04-05
"John_H" <newsgroup@johnhandwork.com> wrote in message news:13185gkp47lpq2c@corp.supernews.com...> > Now, do you know how to properly pipeline? How about state machines: can > you design a soda dispenser state machine to count change? And how many > gas stations would you estimate are in the US (please explain your > reasoning)? If you had a belt tight around the equator of the earth, how > much length do you figure you'd need to add to raise the belt to an > altitude of 1 foot across the entire distance and why? > > Good luck with your interviewing.Hi John, I used to drive my buddy Kurt insane with these questions. The secret is to ask him about two pints into a Friday night Guinness session. After four pints he'll let you tell him the answer. The next few pints erase his memory so you can do it all over again a couple of weeks later. Eventually he bought himself a notebook! For example, a brother and sister were born on the same day a few minutes apart. But they're not twins. How? Cheers, Syms.





