RTL Studio Open IDE

Memory & FIFOs

Regfile Shadow Buffer with Commit

An 8x16 register file with shadow buffer support for speculative writes, atomic commit, and abort capabilities.

About this block

Simulate it in the Verilog IDE

Mediumverilogsimsyn

Regfile Shadow Buffer with Commit 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 an 8-entry, 16-bit register file with a shadow buffer mechanism to support speculative execution in out-of-order pipelines.

It allows writes to be staged in a shadow buffer without affecting the architectural state until an atomic commit is issued.

An abort signal can discard all speculative writes.

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for Regfile Shadow Buffer with Commit.
  2. Read the Verilog module in the editor. The catalog line for this block: An 8x16 register file with shadow buffer support for speculative writes, atomic commit, and abort capabilities.
  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

  • Capacity: 8 entries, 16 bits per entry.
  • Speculation Support: Isolates speculative writes from architectural state.
  • Atomic Commit: Single-cycle transfer of shadow buffer to architectural register file.
  • Abort Mechanism: Single-cycle clear of shadow buffer.
  • Reset: Synchronous active-low reset initializes both buffers to zero.
  • Latency: Single-cycle write and commit latency.

Interface

Signal NameDirectionWidthDescription
clkInput1Clock input
rst_nInput1Active-low synchronous reset
addr_wInput[2:0]Write address (0-7)
addr_rInput[2:0]Read address (0-7)
data_wInput[15:0]Write data
weInput1Write enable (targets shadow buffer)
commitInput1Commit shadow buffer to architectural register file
abortInput1Abort and clear shadow buffer
data_rOutput[15:0]Read data (from architectural register file)

Architecture

The design consists of two internal 8x16 register arrays:

  1. Architectural Register File (arch_regfile): Holds the committed state. Reads always access this array.
  2. Shadow Register File (shadow_regfile): Holds speculative writes. Writes target this array.

### Operation Logic

  • Write: If we is high, data_w is written to shadow_regfile[addr_w].
  • Read: data_r is driven by arch_regfile[addr_r].
  • Commit: If commit is high, shadow_regfile is copied to arch_regfile for all indices.
  • Abort: If abort is high, shadow_regfile is cleared to zero.
  • Reset: On !rst_n, both arrays are cleared to zero.

### Constraints & Notes

  • Priority: commit and abort should not be asserted simultaneously. If both are high, commit takes precedence in the current implementation. This is undefined behavior in the spec and should be avoided by the controller.

Verification

The provided testbench (tb_regfile_shadow_commit_8x16.v) verifies three key scenarios:

Test CaseDescriptionExpected Result
TC1Shadow write isolation and commitShadow writes are not visible on read until commit. After commit, data is visible.
TC2Abort discards shadowShadow data is discarded after abort and not visible after commit.
TC3Multiple writes and commitMultiple speculative writes are correctly committed in order.

More in Memory & FIFOs

All Memory & FIFOs blocks