RTL Studio Open IDE

0.1 · RISC-V CLASS

RV32I ISA and register ABI

Read RV32I ISA opcodes and register ABI constants from rv32_pkg and verify DUT output via simulation.

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

What you practice

RV32I ISA and register ABI (0.1). Read RV32I ISA opcodes and register ABI constants from rv32_pkg and verify DUT output via simulation. It is in RV32I ISA & register ABI — Part 0 · RV Core Warming Up 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

This lesson introduces the RV32I instruction set architecture constants and the register ABI definitions used in the RISC-V core. You will read the opcode map and register definitions from the rv32_pkg package. This foundational knowledge is essential for understanding how the CPU decodes instructions and manages data flow.

Learning objectives

  • Identify the 7-bit opcodes for major RV32I instruction types.
  • Recognize the funct3 and funct7 encodings for ALU operations.
  • Understand how the rv32_pkg package centralizes ISA constants.
  • Verify that the DUT correctly outputs the expected opcode values.

Theory

The RISC-V ISA is defined by specific bit patterns in the instruction word. The rv32_pkg package in SystemVerilog defines these patterns as localparam constants. This allows the RTL code to use readable names like OP_OP instead of magic numbers like 7'b0110011. The package covers opcodes, funct3 fields for branches and loads, and ALU control signals. Using a package ensures that all modules in the design share the same definition of the ISA. This prevents mismatches between the decoder and the execution units.

Constant NameBit ValueDescription
OP_OP7'b0110011Standard Register-Register ALU operations
OP_OPIMM7'b0010011Immediate ALU operations
OP_LOAD7'b0000011Memory load instructions
OP_STORE7'b0100011Memory store instructions
OP_BRANCH7'b1100011Branch instructions

Practice

  1. Open RtlStudio and select this chapter from the Examples list.
  2. Verify that student/rtl/design.sv imports rv32_pkg and assigns output ports (op_op, op_opimm, etc.) to the corresponding package constants.
  3. Run Simulation from the left sidebar.
  4. Read the Log panel to verify the output matches the expected ISA constants.

Summary

You explored the RV32I opcode map and register ABI definitions within the rv32_pkg package. This lesson established the foundational constants required for correct instruction encoding and register usage. Successful simulation confirmed your understanding of these critical RISC-V architecture 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 RV32I ISA and register ABI. Change the source, run the Verilog simulator again, and read the waveform without leaving the IDE. Simulation guide · Yosys guide.