Memory & FIFOs
32x16 Synchronous Single-Port RAM
32-word by 16-bit synchronous single-port RAM with combinational read.
About this block
Simulate it in the Verilog IDE
32x16 Synchronous Single-Port RAM 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 32-word by 16-bit synchronous single-port RAM. It supports synchronous writes on the positive clock edge and combinational reads, allowing data to be available immediately at the output ports based on the current address.
This IP provides a lightweight, fully verified synchronous RAM block suitable for simple data buffering, FIFO implementations, or temporary storage in FPGA designs. It features a simple interface with no reset signal, relying on power-on initialization or external reset logic if deterministic start-up is required.
- Choose Open in IDE. RTL Studio loads the packaged workspace for 32x16 Synchronous Single-Port RAM.
- Read the Verilog module in the editor. The catalog line for this block: 32-word by 16-bit synchronous single-port RAM with 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 memory array consists of 32 registers, each 16 bits wide.
- Write Operation: Controlled by the
we(Write Enable) signal. Data is latched into the memory array on the positive edge of theclksignal whenweis high. - Read Operation: Combinational. The output
doutreflects the content of the memory location specified byaddrimmediately, without waiting for a clock edge.
This structure ensures low-latency read access while maintaining synchronous write timing.
Ports
| Port | Direction | Width | Description |
|---|---|---|---|
| clk | Input | 1 | Clock signal |
| we | Input | 1 | Write enable (active high) |
| addr | Input | 5 | Memory address (0-31) |
| din | Input | 16 | Write data input |
| dout | Output | 16 | Read data output |
Integration
To integrate this IP into your design:
- Instantiate the module
sync_ram_32x16. - Connect your system clock to
clk. - Drive
wehigh when you wish to write data to the address specified byaddr. - Read data from
doutat any time; it will reflect the last written value for the currentaddr.
Note: Since reads are combinational, ensure that addr is stable before reading dout to avoid glitches if addr changes rapidly.
Verification
The included testbench (tb_sync_ram_32x16.v) verifies the following behaviors:
- Combinational Read: Verifies that
doutupdates immediately afterdinandaddrchange, even before the clock edge. - Synchronous Write: Confirms data is stored only on the positive clock edge when
weis asserted. - Data Retention: Checks that written data persists until overwritten.
- Boundary Conditions: Tests access to the last address (index 31).
- Burst Operations: Validates sequential write and read operations.
### Expected Simulation Results
Upon running the simulation, the log should display:
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
- 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
- Count-Based Sync FIFO with Dual Ready/Valid