Sign in on the Premium hub to save lesson progress. This lesson is open to read so the page is a complete article, not an empty login wall.
Lesson 3.1

Binary pointer CDC and the convergence problem

If you sample a binary counter with another clock, several bits can be in transition at once. The captured vector can be a value the counter never held. That illegal pointer is the convergence / multi-bit CDC problem β€” and it is why async FIFOs use Gray code.

1

The 7 β†’ 8 transition

A 4-bit binary count going from 7 to 8:

0111 β†’ 1000 β€” all four bits flip.

The destination flop bank samples during that transition. Because of skew on the bus and metastability per bit, you might capture:

CapturedDecimalLegal count?
01117old, OK
10008new, OK
111115never a neighbor of 7 or 8
00000illegal jump
110012illegal

An illegal pointer compared for full/empty can assert empty when the FIFO still has data (underflow next) or deassert full when there is no space (overflow). That is a silicon bug, not a β€œrare glitch”.

2

Why it is called convergence / reconvergence

Each bit is a separate CDC. After 2FF sync, each bit is β€œclean” digitally β€” but they were sampled at slightly different times. When you recombine them into one vector and decode it (compare pointers, compute occupancy), the bits have converged from different sample instants. The vector is coherent only if at most one bit was allowed to change.

wr_clk domain rd_clk domain wptr_bin[3:0] bit3 2FF bit2 2FF bit1 2FF bit0 2FF compare / decode β€” garbage

Four independent synchronizers + one compare = reconvergent CDC. Forbidden for binary counters.

3

Waveform β€” multi-bit change vs one-bit change

Gray(7)=0100, Gray(8)=1100. One bit. A 2FF synchronizer on that bus captures either 0100 or 1100 β€” both legal pointer encodings. Occupancy interpreted from a stale Gray is conservative (you might think the FIFO is a little more full or more empty than it is), never wildly wrong.

Interview

β€œWhy Gray for pointers but not for FIFO data?” β€” Data is not a unit-distance code; any bit pattern is legal payload. You keep data in dual-port RAM and only synchronize the address/count. Gray is for monotone pointers.

4

Metastability vs a wrong digital value

People mix two failures. Metastability is an analog linger on one flop; 2FF makes the downstream digital world binary again with high MTBF. An illegal vector is a perfectly digital 4-bit number that was never a valid count. Two-flopping each binary bit does not fix illegal vectors. Gray reduces the CDC to one bit so the only uncertainty is old vs new.

If two Gray bits ever toggle together because you XOR’d combinationally (lesson 3.3), you re-introduce illegal vectors. Unit-distance is a property of the net you sample, not of a comment in the spec.

5

When a FIFO is the wrong CDC

A single event (interrupt, packet-done) should use a pulse stretcher or handshake, not a 512-deep FIFO. A software-visible register that rarely changes can use a handshake + captured data (req/ack) rather than Gray. The async FIFO is for a stream of beats with backpressure. Using a FIFO for one flag wastes RAM and still needs you to size almost-empty correctly.

Q

Frequently asked questions

Why can’t you 2FF a binary counter?

Several bits may toggle on one count. Destination flops sample at slightly different times and recombine into a count the source never held. Full/empty decoded from that chimera can overflow or underflow.

What happens at binary 7 to 8?

0111 to 1000 flips every bit. Gray 0100 to 1100 flips only the MSB. The Gray 2FF captures old or new, both legal.

Is a stale Gray pointer dangerous?

It is late, not wild. Occupancy looks a little more full or empty than reality. Formulas must be written so late information is pessimistic, never optimistic about free space or available data.

Why not Gray-code the FIFO data bus?

Payload bits are not a unit-distance sequence. Any pattern is legal data. Store data in dual-port RAM; synchronize only the monotone pointer.

Key takeaways

  • Binary counters are multi-bit CDC. Reconvergence can invent illegal counts.
  • Gray encoding makes adjacent counts differ by one bit β€” the 2FF sees old or new, never a chimera.
  • Stale Gray is safe for full/empty if the formulas stay conservative (next lesson).