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_pkgpackage 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 Name | Bit Value | Description |
|---|---|---|
OP_OP | 7'b0110011 | Standard Register-Register ALU operations |
OP_OPIMM | 7'b0010011 | Immediate ALU operations |
OP_LOAD | 7'b0000011 | Memory load instructions |
OP_STORE | 7'b0100011 | Memory store instructions |
OP_BRANCH | 7'b1100011 | Branch instructions |
Practice
- Open RtlStudio and select this chapter from the Examples list.
- Verify that
student/rtl/design.svimportsrv32_pkgand assigns output ports (op_op,op_opimm, etc.) to the corresponding package constants. - Run Simulation from the left sidebar.
- 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
- 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 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.