Home / Learn Verilog / Asynchronous FIFO: The Idea

Asynchronous FIFO: The Idea

Cross between two clocks safely.

Bottom lineCross between two clocks safely.

Breaking it down

Async FIFOwrite clk domainGray wptr -> syncGray rptr -> syncread clk domain
Async FIFO

Definition

Write and read pointers live in different clock domains; Gray-coded pointers cross through synchronisers.

Why you need this

Safe data transfer between clock domains.

How it works

Gray pointers change one bit at a time so a late sample is never wildly wrong.

Where you'll see this

  • Everyday RTL design
  • FPGA and ASIC projects
  • Testbenches and debugging

Try it

Gray pointer compareVerilog: edit and run

Gray pointers change one bit per step, ideal for crossing clocks.

Pointer compare rule
full  = (wgray_next == {~rgray_sync[A:A-1], rgray_sync[A-2:0]});\nempty = (rgray_next == wgray_sync);

Test what you just read

1. Async FIFO pointers are...