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
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.
- Choose Open in IDE. RTL Studio loads the packaged workspace for Regfile Shadow Buffer with Commit.
- 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.
- 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
- 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 Name | Direction | Width | Description |
|---|---|---|---|
clk | Input | 1 | Clock input |
rst_n | Input | 1 | Active-low synchronous reset |
addr_w | Input | [2:0] | Write address (0-7) |
addr_r | Input | [2:0] | Read address (0-7) |
data_w | Input | [15:0] | Write data |
we | Input | 1 | Write enable (targets shadow buffer) |
commit | Input | 1 | Commit shadow buffer to architectural register file |
abort | Input | 1 | Abort and clear shadow buffer |
data_r | Output | [15:0] | Read data (from architectural register file) |
Architecture
The design consists of two internal 8x16 register arrays:
- Architectural Register File (
arch_regfile): Holds the committed state. Reads always access this array. - Shadow Register File (
shadow_regfile): Holds speculative writes. Writes target this array.
### Operation Logic
- Write: If
weis high,data_wis written toshadow_regfile[addr_w]. - Read:
data_ris driven byarch_regfile[addr_r]. - Commit: If
commitis high,shadow_regfileis copied toarch_regfilefor all indices. - Abort: If
abortis high,shadow_regfileis cleared to zero. - Reset: On
!rst_n, both arrays are cleared to zero.
### Constraints & Notes
- Priority:
commitandabortshould not be asserted simultaneously. If both are high,committakes 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 Case | Description | Expected Result |
|---|---|---|
| TC1 | Shadow write isolation and commit | Shadow writes are not visible on read until commit. After commit, data is visible. |
| TC2 | Abort discards shadow | Shadow data is discarded after abort and not visible after commit. |
| TC3 | Multiple writes and commit | Multiple speculative writes are correctly committed in order. |
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