What you practice
Stitch the single-cycle datapath (5.1). Stitch the single-cycle datapath by connecting the RV32I core to instruction and data memories in student/rtl/design.sv and verify execution with the testbench. It is in Stitch fetch-exec-LSU — 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 to its instruction and data memories to form a working single-cycle processor. This step transforms isolated IP blocks into a functional system capable of executing a simple program. Understanding how to wire these components is essential for building any complex CPU design.
Learning objectives
- Instantiate
rv32i_core,rv32i_imem, andrv32i_dmemwithinstudent/rtl/design.sv. - Connect all core ports to the appropriate memory and control signals.
- Verify execution of a two-instruction program (ADDI and ECALL) using the testbench.
- Interpret simulation logs to confirm correct register updates and halt behavior.
Theory
A single-cycle processor executes one instruction per clock cycle. The core fetches an instruction from the instruction memory (IMEM) using the program counter. It then decodes the instruction and accesses the data memory (DMEM) if required. The result is written back to the register file, and the program counter updates for the next instruction. Properly wiring these interfaces ensures data flows correctly between the core and memories.
| Component | Role | Key Ports |
|---|---|---|
rv32i_core | Central processing unit | clk, rst_n, imem_addr, imem_rdata, dmem_addr, dmem_we, dmem_wdata, dmem_rdata |
rv32i_imem | Instruction storage | addr, rdata |
rv32i_dmem | Data storage | clk, addr, we, wdata, re, rdata |
Practice
- Open RtlStudio and select this chapter from the Examples or Lecture list.
- Navigate to Explore and open
student/rtl/design.sv. - Locate the
u_coreinstance and replace the__TODO__[0]placeholders with the correct signal names from the module port list. - Ensure
imem_addrconnects to the IMEM address port andimem_rdataconnects to the IMEM read data port. - Ensure
dmem_addr,dmem_wdata,dmem_we,dmem_re, anddmem_rdataare connected to the DMEM ports. - Open
student/tb/tb_top.svto observe the test program loaded into memory. - Run Simulation from the sidebar and check the Log panel for
INFO: PASS.
Summary
You successfully stitched the single-cycle datapath by instantiating and connecting the RV32I core, instruction memory, and data memory modules. This integration enabled the design to correctly fetch and execute a two-instruction program, verifying proper signal routing between components. The simulation confirmed that the core halted with the expected register values, demonstrating a functional basic processor implementation.
© 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 Stitch the single-cycle datapath. Change the source, run the Verilog simulator again, and read the waveform without leaving the IDE. Simulation guide · Yosys guide.