How to size an async FIFO (and why "double it" isn't a strategy)
The most common FIFO sizing method in industry is: take a guess, double it, and ship. It usually works, which is exactly why it eventually doesn't — on the one link where the burst got longer, the reader got slower, and the overflow only happens under full load in the field.
Here's the actual model, which takes five minutes.
The accumulation model
A FIFO exists to absorb a temporary rate mismatch. During a write burst:
accumulation = burst_words - drained_words
drained_words = burst_duration x read_bandwidth
burst_duration = burst_words / write_bandwidth
So:
depth_min = B x (1 - R_read / R_write) when R_read < R_write
where the bandwidths are in words/second: R = f_clock x words_per_clock.
Example. Writer: 100 MHz, one word/cycle, bursts of 256. Reader: 75 MHz, one word/cycle, reads continuously.
depth_min = 256 x (1 - 75/100) = 64 words
Try it live in the FIFO Depth Calculator.
The parts everyone forgets
1. Synchronizer slack. In an async FIFO the write side learns about reads via a gray-coded read pointer through a 2-flop synchronizer — news that's 2–3 destination-clock cycles old, in both directions. The FIFO looks more full than it is; budget ~4 extra words so you don't stall the writer early.
2. Read stalls. "The reader drains continuously" is doing a lot of work in
that formula. If the reader arbitrates with anything else (a DMA engine, a
DDR controller refresh window), your effective R_read during the burst is
lower. Model the worst-case window, not the average.
3. Back-to-back bursts. If a second burst can start before the FIFO drains, there is no finite depth that saves you unless average read bandwidth ≥ average write bandwidth. The FIFO handles jitter, not sustained deficit. This is the most common field failure: the math was right for one burst.
4. Powers of two. Async FIFO pointers want power-of-two depths so the gray-code wrap works out; you'll round up anyway, so take the margin.
A sizing checklist
- Compute
depth_minfrom the burst model above. - Add ~4 words of CDC slack (async only).
- Check the worst-case reader stall window and add it x
R_write. - Prove that average read ≥ average write bandwidth, or define what backpressure does to the writer.
- Round up to a power of two.
- In simulation, assert on
full && wr_en— an overflowing FIFO must be a test failure, not a statistic.
Steps 1, 2 and 5 are automated in the calculator; steps 3, 4 and 6 are engineering. That split — automate the arithmetic, keep the thinking — is basically the thesis of this site.