RTL Studio Open IDE

3.6 · RISC-V CLASS

LSU and data memory integration

Connect the LSU to the local data RAM and run a store followed by a load to verify data integrity.

Video coming soon. This lesson page stays at the same URL when the lecture publishes.

What you practice

LSU and data memory integration (3.6). Connect the LSU to the local data RAM and run a store followed by a load to verify data integrity. It is in LSU + DMEM top — Part 3 · Load/Store & Local Memory of the RISC-V RV32I Core Masterclass.

The RV32I core is Verilog you simulate in the browser IDE. Verilator runs the program; the waveform shows PC, the instruction, and the register write.

What you will learn

You will connect the Load/Store Unit (LSU) to the local data memory (DMEM) in the dut module. This integration allows the processor to write data to memory and read it back correctly. Understanding this interface is critical for implementing the RV32I load and store instructions.

Learning objectives

  • Wire the LSU outputs to the DMEM inputs in student/rtl/design.sv.
  • Connect the DMEM read data back to the LSU inputs.
  • Run a simulation to verify a store-then-load sequence.
  • Interpret simulation logs to confirm data integrity.

Theory

The LSU generates control signals to manage data flow between the CPU core and memory. The memread signal enables a memory read operation. The memwrite signal enables a memory write operation. The byte_en signal selects which bytes of the 32-bit word are written. The addr signal provides the memory address. The store_data signal provides the data to be written. The mem_rdata signal carries data read from memory. The load_data signal presents the read data to the CPU core. Proper wiring ensures that the LSU commands are executed by the DMEM.

Practice

  1. Open RtlStudio and select chapter 3.6 from the Examples or Lecture list.
  2. Confirm files appear in the Explore tree under student/ and golden/.
  3. Open student/rtl/design.sv in the editor.
  4. Locate the u_lsu instance and replace the __TODO__[0] placeholders with the correct port connections from the dut module inputs and internal wires.
  5. Ensure the u_dmem instance is correctly connected to the u_lsu outputs.
  6. Open student/tb/tb_top.sv to review the testbench stimulus.
  7. Click Simulation in the sidebar and run the simulation.
  8. Check the Log panel for INFO: messages and the final INFO: PASS line.

Summary

You successfully integrated the Load/Store Unit with the local data memory by wiring control signals and data paths in design.sv. This exercise demonstrated how the LSU handles address alignment and byte enables to facilitate correct store and load operations. Verifying the simulation confirmed that data written to memory is accurately retrieved, validating the functional connectivity of the RV32I components.

© 2026 RtlStudio. Licensed under CC BY-NC-ND 4.0. Commercial use and modifications by third parties are not permitted.

Run it in the Verilog IDE

  1. Open the RV32I lesson in the IDE. Fetch, decode, and execute are source you can simulate.
  2. Run Verilator and watch PC, the instruction, and the register write on the waveform.
  3. Treat a program printout as done only after the ISA step this lesson names matches the wave.
  4. Change the RTL in the editor, rerun Verilator, and read the waveform again in the same tab.

The lesson is done when the simulation matches LSU and data memory integration. Change the source, run the Verilog simulator again, and read the waveform without leaving the IDE. Simulation guide · Yosys guide.