What you practice
The rv32i_core module interface (5.2). Connect the rv32i_core module to memory interfaces and verify execution of a simple program. It is in rv32i_core module shell — Part 5 · Core Capstone 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 rv32i_core module to its memory interfaces in the top-level design. This lesson focuses on freezing the core port list to ensure correct communication between the CPU and memory. Mastering this interface is essential for building a functional RISC-V processor.
Learning objectives
- Instantiate the
rv32i_coremodule in the top-level design. - Connect the instruction memory (
imem) and data memory (dmem) interfaces. - Verify the core halts correctly on an
ECALLinstruction. - Inspect debug signals like
debug_pcanddebug_x10in the testbench.
Theory
The rv32i_core module acts as the central processing unit for the RISC-V implementation. It requires a clock, reset, and interrupt signal to operate correctly. The core communicates with memory through separate address and data buses for instructions and data. The instruction memory provides the current instruction word to the core. The data memory handles read and write operations based on the core's control signals. The testbench monitors the halted signal to determine when the program execution is complete. Debug signals allow you to inspect the program counter and register values during simulation.
| Signal | Direction | Description |
|---|---|---|
clk | Input | System clock signal for synchronous logic. |
rst_n | Input | Active-low reset signal to initialize the core. |
irq_i | Input | Interrupt request signal from external peripherals. |
imem_addr | Output | Address bus for instruction memory access. |
imem_rdata | Input | Data bus receiving instructions from memory. |
dmem_addr | Output | Address bus for data memory access. |
dmem_wdata | Output | Data bus for writing data to memory. |
dmem_we | Output | Write enable mask for data memory bytes. |
dmem_re | Output | Read enable signal for data memory. |
dmem_rdata | Input | Data bus receiving data from memory. |
halted | Output | Indicates when the core has stopped execution. |
debug_pc | Output | Current program counter for debugging. |
Practice
- Open RtlStudio and select this chapter to load the workspace.
- Open
student/tb/tb_top.svin the editor to view the top-level design and testbench. - Open
student/rtl/ip/riscv/rv32i_core.svto see the core implementation. - Open
student/tb/tb_top.svto view the testbench structure and stimulus. - Ensure the
rv32i_coreinstanceu_coreinstudent/tb/tb_top.svis connected correctly. - Connect the
imem_addrandimem_rdataports to therv32i_imeminstance instudent/tb/tb_top.sv. - Connect the
dmem_addr,dmem_wdata,dmem_we,dmem_re, anddmem_rdataports to therv32i_dmeminstance instudent/tb/tb_top.sv. - Run Simulation from the sidebar and check the Log panel for results.
Summary
You successfully froze the rv32i_core interface by connecting the clock, reset, interrupt, and memory ports to the instruction and data memory modules. This practice reinforced the critical contract between the CPU and system memory for correct instruction fetching and data access. Running the simulation confirmed that the core executes instructions and halts appropriately on an ECALL. This stable interface definition is essential for integrating the core into larger system designs.
© 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
- Open the RV32I lesson in the IDE. Fetch, decode, and execute are source you can simulate.
- Run Verilator and watch PC, the instruction, and the register write on the waveform.
- Treat a program printout as done only after the ISA step this lesson names matches the wave.
- 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 The rv32i_core module interface. Change the source, run the Verilog simulator again, and read the waveform without leaving the IDE. Simulation guide · Yosys guide.