FIFO (First-In-First-Out)
First-In-First-Out queue with independent read and write clocks. Buffers data between asynchronous streams. Features programmable full/empty thresholds, overflow/underrun detection, and status flags (FULL, EMPTY, PROG_FULL, PROG_EMPTY). Xilinx FPGA implementation.
Introduction
This block implements a FIFO buffer for data transfer between asynchronous clock domains. Write and read operations use independent clocks (CLK_WR, CLK_RD) and can occur at different rates.
Key features:
- Asynchronous read/write clocks
- FULL and EMPTY status flags
- Programmable almost-full/almost-empty thresholds
- Overflow and underrun detection
Pin Description
Properties
Set the amount of memory in number of words
FIFO depth in words. Allowed: 64-65536. Total storage = FIFO depth × Bit Width.Default: 1024
Options: 64 128 256 512 1024 2048 4096 8192 16384 32756 65536
Set the size in bits of the data
Bit width per word. Range: 1-1024.Default: 16
Range: 1 – 1024
Set PROG_EMPTY threshold in word. MUST BE BETWEEN 3 AND FIFO SIZE -3!
Programmable empty threshold (3 to FIFO size-3). PROG_EMPTY asserts when count ≤ this value.Default: 3
Range: 3 – 65535
Set PROG_FULL threshold in word. MUST BE AT MAXIMUM FIFO SIZE - 3!
Programmable full threshold (1 to FIFO size-3). PROG_FULL asserts when count ≥ this value.Default: 1021
Range: 1 – 65535
Functional description
FIFO maintains read and write pointers:
- Write: When WR=1 and not FULL, data is written on CLK_WR edge
- Read: When RD=1 and not EMPTY, data is read on CLK_RD edge
Status flags
- EMPTY: No data available to read
- FULL: No space available to write
- PROG_EMPTY: Data count below Prog Empty threshold
- PROG_FULL: Data count above Prog Full threshold
- OVERFLOW: Write attempted when FULL
- UNDERRUN: Read attempted when EMPTY
Timing
Read latency: 1 clock cycle (data appears 1 CLK_RD cycle after RD=1).
Typical use cases
- Clock domain crossing
- Rate matching between fast producer and slow consumer
- Data buffering in streaming systems