Implementation of Clifford E. Cummings' seminal asynchronous FIFO architecture for safe Clock Domain Crossing (CDC). Gray code pointer synchronization eliminates metastability hazards while enabling reliable data transfer between unrelated clock domains — a foundational building block used in the 72ns Gateway HFT Accelerator and production Ethernet designs.
When data crosses between two unrelated clock domains, metastability can corrupt signals. A naive binary counter FIFO can produce glitches where multiple bits change simultaneously, causing the receiving domain to read a completely wrong pointer value. Cummings' solution uses Gray code — where only one bit changes per increment — to make pointer synchronization safe.
Binary counters can have multi-bit transitions (e.g., 0111 → 1000 = 4 bits change). If sampled mid-transition, the synchronized value could be completely wrong. Gray code guarantees only 1 bit changes per increment, making 2-FF synchronization safe.
Two flip-flop stages reduce metastability probability to negligible levels (MTBF > millions of years at typical clock rates). The first FF may go metastable; the second resolves to a valid logic level before being used.
Empty: read pointer equals synchronized write pointer (exact match). Full: write pointer equals synchronized read pointer with the two MSBs inverted. The extra MSB distinguishes "same address, full" from "same address, empty."
FIFO depth must be 2^N for Gray code math to work correctly. The binary-to-Gray and Gray-to-binary conversions exploit XOR properties that only hold for power-of-2 address spaces.
| Component | Technology | Purpose |
|---|---|---|
| HDL | Verilog / SystemVerilog | RTL implementation |
| Simulation | ModelSim / Vivado Sim | Functional verification |
| Synthesis | Vivado / Synopsys DC | FPGA and ASIC targeting |
| CDC Analysis | CDC Lint Tools | Structural CDC checks |
| Reference Paper | Cummings SNUG 2002 | "Simulation and Synthesis Techniques for Asynchronous FIFO Design" |
| Application | 72ns Gateway | CDC between market data and order logic clocks |