Synchronous FIFO
Medium · Sequential · SystemVerilog · VHDL
Design a synchronous FIFO storing up to DEPTH words of DATA_WIDTH bits.
On each rising edge: a write (wr_en high, not full) stores wr_data at the tail; a read (rd_en high, not empty) removes the head word, and rd_data shows it in the following cycle. A simultaneous read and write both complete, leaving count unchanged. Blocked operations are no-ops: a write while full is discarded, and a read while empty does nothing (including during simultaneous reads/writes). In every cycle that does not follow a read, rd_data may take any value.
full is high when count = DEPTH; empty when count = 0; count tracks the number of stored words.
On reset (resetn low, synchronous), the pointers and count clear to 0, leaving empty asserted.
- FIFOs & memory