Memory & FIFOs
4×8 Sync RAM (Async Reset, Comb Read)
Four-word 8-bit single-port RAM with async reset clear, synchronous write, and combinational read.
About this block
Simulate it in the Verilog IDE
4×8 Sync RAM (Async Reset, 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.
A simple 4-word, 8-bit synchronous RAM module with combinational read and asynchronous reset.
This IP provides a minimal synchronous RAM block suitable for small on-chip buffering or state storage. It features:
- Depth: 4 words
- Width: 8 bits
- Write: Synchronous (positive clock edge)
- Read: Combinational (zero latency)
- Reset: Asynchronous, active-low
- Choose Open in IDE. RTL Studio loads the packaged workspace for 4×8 Sync RAM (Async Reset, Comb Read).
- Read the Verilog module in the editor. The catalog line for this block: Four-word 8-bit single-port RAM with async reset clear, synchronous write, and combinational read.
- 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 uses a Verilog register array. Writes occur only when we is high on the rising edge of clk. Reads are continuous assignments, providing immediate access to the stored data.
Ports
| Port Name | Direction | Width | Description |
|---|---|---|---|
clk | Input | 1 | Clock input for synchronous operations. |
rst_n | Input | 1 | Active-low asynchronous reset. |
addr | Input | 2 | Address input (0-3). |
we | Input | 1 | Write enable. High enables write on clock edge. |
din | Input | 8 | Data input for write operations. |
dout | Output | 8 | Data output for read operations. |
Verification
The included testbench (tb_sync_ram_4x8.v) verifies:
- Basic write/read functionality for all 4 addresses.
- Data persistence (data remains unchanged when writing to other addresses).
### Running Simulation
To run the simulation, use your preferred Verilog simulator (e.g., Icarus Verilog):
Expected Output:
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)
- 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