Gray Code for Asynchronous FIFO pointer. Why?

First let us discuss the need for Asynchronous FIFO. We use Gray code for the same reason we need Async FIFO.

To transfer a stream of multi bit signal(bus) from one clock domain to a different clock domain, designers cannot use typical Data Synchronizers. Different bus signals from different data synchronizers converge at different period of time, and this typical problem is called the Re-convergence issue in ASIC Design world.

To solve the problem, Asynchronous FIFO was designed. Again in Asynchronous FIFO, pointers should be synchronized from native clock domain to the other clock domain. Pointers are multi bit which could lead to re convergence issue all over again.

Luckily, we know that pointers are not random unlike data stream. Both Read and Write pointers are incremented by one (+1) w.r.t clock edge on read & write from FIFO. Given that, we should look for a code which changes minimally on increment by one (ideally only one bit change), Gray code was the solution.

Employing an encoding scheme like Gray Code will resolve re-convergence issue, because in the pointer bus only one bit can change at any given source clock edge. When only one bit toggles, the synchronizer output of all the other bits in the bus are already stable. All the bus signals settle (ideally only one toggling signal should settle) at a know clock edge at the receiving domain. Hence Gray Code for pointers was the solution to solving CDC Re-convergence issue.

Gray Code need not be employed in Synchronous FIFO as there is no need for synchronization there. For simplicity and to reduce logic over head simpler binary codes for pointers are preferred in Synchronous FIFO.

Comments

Popular posts from this blog

Basic Memory Mapping in SoC

System Verilog Assertions for Power Gating Sequence