Memory & FIFOs
FWFT Sync FIFO with Almost Full/Empty
A First-Word-Fall-Through (FWFT) synchronous FIFO module with configurable almost full and almost empty threshold flags for precise flow control.
About this block
Simulate it in the Verilog IDE
FWFT Sync FIFO with Almost Full/Empty is a Verilog reference block in the Memory & FIFOs catalog. SRAM models, FIFOs, register files, and memory-style storage. Marked Hard: a larger reference. Simulate the packaged testbench before you change the RTL.
This IP implements a First-Word-Fall-Through (FWFT) synchronous FIFO with configurable almost full and almost empty threshold flags. It provides precise flow control for high-speed data paths, ensuring low latency by making data available immediately upon a valid read enable.
The module supports configurable data width, depth, and threshold levels, making it suitable for buffering data between synchronous clock domains or as a component within asynchronous clock crossing logic.
- Choose Open in IDE. RTL Studio loads the packaged workspace for FWFT Sync FIFO with Almost Full/Empty.
- Read the Verilog module in the editor. The catalog line for this block: A First-Word-Fall-Through (FWFT) synchronous FIFO module with configurable almost full and almost empty threshold flags for precise flow control.
- Run the packaged testbench with the in-browser Verilator simulator, then open the VCD in the waveform viewer.
- Run Yosys in the same IDE for a generic netlist. Sky130 liberty mapping is a separate Pro library option.
RTL Studio is the Verilog simulator and IDE around this block: Slang lint, Verilator, VCD waveforms, and Yosys, in the browser. Simulation guide · Yosys guide.
Features
- First-Word-Fall-Through (FWFT): Data is available on
rd_dataimmediately whenrd_enis asserted, provided the FIFO is not empty. - Configurable Parameters: Supports configurable
DATA_WIDTH,DEPTH,AF_THRESH(Almost Full Threshold), andAE_THRESH(Almost Empty Threshold). - Precise Flow Control:
- almost_full asserts when the remaining space is less than or equal to AF_THRESH. - almost_empty asserts when the used space is less than or equal to AE_THRESH.
- Robust Flag Logic:
- full prevents invalid writes. - empty prevents invalid reads.
- Synchronous Reset: Defined initial state with
fullandemptyasserted high upon reset.
Ports
| Port Name | Direction | Width | Description |
|---|---|---|---|
clk | Input | 1 | Clock input |
rst_n | Input | 1 | Active-low synchronous reset |
wr_en | Input | 1 | Write enable signal |
rd_en | Input | 1 | Read enable signal |
wr_data | Input | [DATA_WIDTH-1:0] | Data input to be written |
rd_data | Output | [DATA_WIDTH-1:0] | Data output from the FIFO |
full | Output | 1 | High when FIFO is completely full |
empty | Output | 1 | High when FIFO is completely empty |
almost_full | Output | 1 | High when FIFO is near full (<= AF_THRESH) |
almost_empty | Output | 1 | High when FIFO is near empty (<= AE_THRESH) |
Verification
The testbench verifies the following scenarios:
| Test Case | Description | Expected Result |
|---|---|---|
| TC1 | Reset State | empty and full flags are high |
| TC2 | Fill to Almost Full | almost_full asserts at threshold |
| TC3 | Fill to Full | full asserts when depth is reached |
| TC4 | Write to Full | Write is ignored, full remains high |
| TC5 | Drain to Almost Empty | almost_empty asserts at threshold |
| TC6 | Drain to Empty | empty asserts when depth is cleared |
| TC7 | Read from Empty | Read is ignored, empty remains high |
All test cases passed successfully in simulation.
More in Memory & FIFOs
- 16-Word 16-Bit Sync RAM with Byte Enable — L2 Upgrade
- 16×8 Sync RAM (No Reset, Registered Read) — L2 Upgrade
- 32-Bit Asynchronous FIFO with Gray Pointer Encoding
- 32-Bit Register with Byte Writes
- 32x16 Synchronous Single-Port RAM
- 4x8 1W1R Register File (Comb Read)
- 4×8 Sync RAM (Async Reset, Comb Read)
- 64-bit Wide Scratchpad RAM with Dual-Port Access
- 8-Bit Valid/Ready Skid Buffer
- 8x16 Single-Port Sync RAM
- 8x32 Dual-Read Register File
- 8×8 Sync RAM (Async Reset, Comb Read, Loop Init) — L1 Upgrade
- Asymmetric RAM WR8 RD16 — L2 Upgrade
- Byte-Enable Regfile 8x32 — L2 Upgrade
- CAM 4x8 with Invalidate
- Circular Buffer 16x8