RTL Studio Open IDE

Memory & FIFOs

FWFT Sync FIFO 16x8 — L2 Upgrade

First-Word-Fall-Through synchronous FIFO with 16x8 depth and programmable almost-full/empty thresholds.

About this block

Simulate it in the Verilog IDE

Hardverilogsimsyn

FWFT Sync FIFO 16x8 — L2 Upgrade 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 a depth of 16 and an 8-bit data width. Unlike standard FIFOs, the FWFT architecture allows data to be read on the same cycle it is written when the FIFO is empty, reducing latency for streaming applications.

Key features include:

  • Low Latency: Immediate data availability on the first write.
  • Configurable Flow Control: Programmable almost_full and almost_empty thresholds.
  • Synchronous Design: Single clock domain with active-low reset.
  • Educational Focus: Designed for Level 2 complexity, suitable for learning and integration.
  1. Choose Open in IDE. RTL Studio loads the packaged workspace for FWFT Sync FIFO 16x8 — L2 Upgrade.
  2. Read the Verilog module in the editor. The catalog line for this block: First-Word-Fall-Through synchronous FIFO with 16x8 depth and programmable almost-full/empty thresholds.
  3. Run the packaged testbench with the in-browser Verilator simulator, then open the VCD in the waveform viewer.
  4. 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

  • FWFT Architecture: Data is available at rd_data immediately upon write if the FIFO was previously empty.
  • Synchronous Operation: Operates with a single clock (clk) and active-low reset (rst_n).
  • Programmable Thresholds:

- af_thresh: Configurable almost-full threshold (distance from full). - ae_thresh: Configurable almost-empty threshold (distance from empty).

  • Status Flags:

- full: Asserted when FIFO is completely full. - empty: Asserted when FIFO is completely empty. - almost_full: Asserted when remaining space is less than or equal to af_thresh. - almost_empty: Asserted when used space is less than or equal to ae_thresh.

  • Memory Depth: 16 words x 8 bits.

Ports

Port NameDirectionWidthDescription
clkInput1Clock input
rst_nInput1Active-low reset
wr_enInput1Write enable
rd_enInput1Read enable
wr_dataInput[7:0]Data to write
rd_dataOutput[7:0]Data read (FWFT or memory)
fullOutput1FIFO is full
emptyOutput1FIFO is empty
almost_fullOutput1FIFO is near full
almost_emptyOutput1FIFO is near empty
af_threshInput[3:0]Almost-full threshold distance
ae_threshInput[3:0]Almost-empty threshold distance

Architecture

The module uses a dual-pointer approach (write and read pointers) combined with a counter to track the number of items in the FIFO. This counter is the primary source for generating status flags.

### FWFT Logic When the FIFO is empty and a write occurs, the data is latched into a temporary register (fwft_data) and a validity flag (fwft_valid) is set. On the next read cycle, this latched data is prioritized over the memory content, ensuring zero-cycle latency for the first word.

### Logic Description

  • Write Pointer: Increments when wr_en is high and !full.
  • Read Pointer: Increments when rd_en is high and !empty.
  • Count Update: Increments on write, decrements on read.
  • Almost-Full: Asserted when count >= (DEPTH - af_thresh).
  • Almost-Empty: Asserted when count <= ae_thresh.

Integration

### Instantiation

### Simulation

  1. Clone the repository.
  2. Open your preferred Verilog simulator (e.g., ModelSim, Vivado Simulator).
  3. Compile rtl/fwft_fifo_almost_prog_16x8.v and tb/tb_fwft_fifo.v.
  4. Run the simulation.

Expected Log Output:

Verification

The testbench verifies reset behavior, threshold assertions, and FWFT timing. All tests passed with zero errors.

Test CaseDescriptionResult
TC1Reset state checks empty and almost_empty flagsPASS
TC2Fill to 14 items checks almost_empty de-assertion and almost_full assertionPASS
TC3Fill to 16 items checks full flagPASS
TC4Read 12 items checks almost_empty de-assertionPASS
TC5Read 2 more items checks almost_empty assertionPASS
TC6Read remaining items checks empty flagPASS
TC7Verify FWFT data availability on first writePASS

More in Memory & FIFOs

All Memory & FIFOs blocks