RTL Studio Open IDE

Memory & FIFOs

Write-Priority Regfile 4x8 — L2 Upgrade

4-word by 8-bit register file with write-priority, bit-masking, hold, and park controls.

About this block

Simulate it in the Verilog IDE

Mediumverilogsimsyn

Write-Priority Regfile 4x8 — 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 4-word by 8-bit register file with advanced write-priority logic.

It features two write ports (Port B: High Priority, Port C: Low Priority) and one read port (Port A).

Key features include bit-level write masking, deterministic priority arbitration, and control modes for 'Hold' (freeze writes) and 'Park' (redirect Port C to address 0).

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for Write-Priority Regfile 4x8 — L2 Upgrade.
  2. Read the Verilog module in the editor. The catalog line for this block: 4-word by 8-bit register file with write-priority, bit-masking, hold, and park controls.
  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.

Architecture

The register file contains four 8-bit registers. Read access is purely combinational. Write operations occur on the positive clock edge.

### Port Definitions

  • Port A (Read): Combinational read access. No enable signal required.
  • Port B (Write High): High-priority write port. Always takes precedence over Port C.
  • Port C (Write Low): Low-priority write port. Suppressed if Port B writes to the same address.

### Control Modes

  • Hold Mode (hold_en): Freezes all write operations. The register file state remains unchanged.
  • Park Mode (park_en): Forces Port C writes to address 0, regardless of the wr_addr_c input. Port B is unaffected.

### Priority Logic If Port B and Port C target the same address in the same cycle:

  1. Port B write is executed.
  2. Port C write is suppressed.

Ports

SignalDirectionWidthDescription
clkInput1Clock input
rst_nInput1Active-low reset
rd_addr_aInput2Read address for Port A
rd_data_aOutput8Read data from Port A
wr_addr_bInput2Write address for Port B
wr_data_bInput8Write data for Port B
wr_mask_bInput8Write mask for Port B (1=write, 0=no-op)
wr_en_bInput1Write enable for Port B
wr_addr_cInput2Write address for Port C
wr_data_cInput8Write data for Port C
wr_mask_cInput8Write mask for Port C (1=write, 0=no-op)
wr_en_cInput1Write enable for Port C

Verification

The testbench covers six key scenarios. Basic write and read operations are verified for both ports. Write priority is confirmed when both ports target the same address. Bit masking functionality is tested with partial masks. Hold enable is verified to prevent state updates. Park enable is verified to redirect Port C writes to address 0.

Test CaseDescriptionResult
TC1Basic Write Port BPASS
TC2Basic Write Port CPASS
TC3Write Priority (B overrides C)PASS
TC4Bit MaskingPASS
TC5Hold EnablePASS
TC6Park EnablePASS

More in Memory & FIFOs

All Memory & FIFOs blocks