Memory & FIFOs
4x8 1W1R Register File (Comb Read)
A 4-deep by 8-bit wide register file with synchronous write and combinational read ports.
About this block
Simulate it in the Verilog IDE
4x8 1W1R Register File (Comb Read) 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-deep by 8-bit wide register file with 1 Write port and 1 Read port. It is designed for small on-chip storage requirements where low-latency reads are critical.
This IP provides a lightweight, combinational-read register file suitable for low-latency applications. It features synchronous writing, asynchronous reset, and a simple interface. The design is fully verified with a testbench that checks reset behavior, write/read integrity, and data persistence.
- Choose Open in IDE. RTL Studio loads the packaged workspace for 4x8 1W1R Register File (Comb Read).
- Read the Verilog module in the editor. The catalog line for this block: A 4-deep by 8-bit wide register file with synchronous write and combinational read ports.
- 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.
Architecture
The design consists of a simple memory array (mem[0:3]) of 8-bit registers.
- Write Logic: On the positive edge of
clk, ifweis high, the value ondinis written to the address specified bywaddr. - Read Logic: The output
doutis directly assigned tomem[raddr], providing zero-latency combinational read. - Reset Logic: When
rst_nis low, all memory elements are asynchronously cleared to 0.
Ports
| Port Name | Direction | Width | Description |
|---|---|---|---|
clk | Input | 1 | Clock input for synchronous write |
rst_n | Input | 1 | Active-low asynchronous reset |
we | Input | 1 | Write enable signal |
waddr | Input | 2 | Write address (0-3) |
din | Input | 8 | Data input for write |
raddr | Input | 2 | Read address (0-3) |
dout | Output | 8 | Data output from read |
Verification
The provided testbench (tb/tb_regfile_4x8_1w1r_comb_read.v) verifies the following behaviors:
- Reset: Ensures all registers initialize to zero upon assertion of
rst_n. - Write/Read Integrity: Writes specific values to addresses 0, 1, and 3, and reads them back to verify data integrity.
- Unwritten Address: Verifies that unwritten addresses (e.g., address 2) remain zero.
- Persistence: Confirms that written data persists across multiple clock cycles.
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
- 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
- Count-Based Sync FIFO with Dual Ready/Valid