Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Implement asynchronous FIFO full and empty logic

Hardware interview practice

Implement asynchronous FIFO full and empty logic

HardClock Domain CrossingSystemVerilog

Design the pointer, synchronization, memory, full, empty, and coordinated-reset behavior for a depth-16 dual-clock FIFO.

Try it in the question bankReason first. Then compare.

Keep this exact question selected while you check your answer and review the full solution.

Practice this question →
Starting point

Question code

// write: wclk, wrst_n, w_en, wdata, w_full
// read:  rclk, rrst_n, r_en, rdata, r_empty
Reviewed example

Work through one case

Input
Sixteen accepted writes and no reads
Expected output
w_full asserts after the sixteenth pointer advance

The next write Gray pointer reaches the state one buffer length ahead of synchronized read Gray.

What to cover

Requirements

  1. Use 5-bit binary/Gray pointers with a 4-bit memory address.
  2. Register local Gray pointers and synchronize each Gray bus through two destination flops.
  3. Register empty from next read Gray equaling synchronized write Gray; register full from next write Gray equaling synchronized read Gray with its top two bits inverted.
  4. Treat reset as a coordinated flush and block both sides until both domains observe synchronized release.
Continue practicing

Related questions

Clock Domain CrossingGenerate and synchronize a Gray-code counter→Clock Domain CrossingMatch each signal type to a CDC technique→Clock Domain CrossingEight-entry asynchronous FIFO→
asic.fyi · Learn silicon end to end.info@asic.fyi