RTL Studio Open IDE

Memory & FIFOs

Dual-Port RAM Write-First Bypass — L2 Upgrade

Dual-Port RAM with write-first bypass on Port A and shadow buffer read with invalidation on Port B.

About this block

Simulate it in the Verilog IDE

Mediumverilogsimsyn

Dual-Port RAM Write-First Bypass — L2 Upgrade is a Verilog reference block in the Memory & FIFOs catalog. SRAM models, FIFOs, register files, and memory-style storage. Marked Medium: more state or a wider datapath, still one workspace in the IDE.

This IP implements a dual-port RAM designed for low-latency cache-like structures. It features write-first bypass on Port A, allowing immediate data availability during write cycles, and a shadow buffer on Port B to support speculative or cached data reads with invalidation capabilities.

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for Dual-Port RAM Write-First Bypass — L2 Upgrade.
  2. Read the Verilog module in the editor. The catalog line for this block: Dual-Port RAM with write-first bypass on Port A and shadow buffer read with invalidation on Port B.
  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

  • Dual-Port Architecture: Single clock domain (clk) with synchronous reset (rst_n).
  • Port A (Write-First Bypass):

- Supports byte-enable writes (be_a) for partial word updates. - Immediate data output on data_out_a during write cycles (bypass). - Standard read access when not writing.

  • Port B (Shadow Read):

- Reads from a shadow buffer if shadow_valid is asserted for the target address. - Supports invalidation of shadow entries via inv_b signal. - Falls back to main memory mem if shadow is invalid. - Outputs valid_b flag indicating if the returned data is from the shadow buffer.

  • Configurable: Depth and data width can be adjusted via parameters.

Ports

SignalDirectionWidthDescription
clkInput1Clock input
rst_nInput1Active-low synchronous reset
addr_aInput8Port A address
data_in_aInput8Port A write data
be_aInput2Port A byte enable (LSB controls byte 0, etc.)
we_aInput1Port A write enable
en_aInput1Port A enable
data_out_aOutput8Port A read/bypass data
addr_bInput8Port B address
en_bInput1Port B enable
inv_bInput1Port B invalidate shadow entry at addr_b
data_out_bOutput8Port B read data

Architecture

The module consists of three internal arrays:

  1. Main Memory (mem): Standard storage.
  2. Shadow Memory (shadow): Stores speculative/cached data.
  3. Shadow Valid Array (shadow_valid): Tracks validity of shadow entries.

### Data Flow

Verification

The testbench verifies the following scenarios:

Test CaseDescriptionResult
TC1Basic Write and Read BypassPASS
TC2Byte Enable Write/ReadPASS
TC3Shadow Commit and ReadPASS
TC4Invalidate ShadowPASS
TC5Shadow Update on WritePASS

Expected Simulation Log:

More in Memory & FIFOs

All Memory & FIFOs blocks