Master the fundamental concepts of instruction set architecture through this focused micro-challenge.
RISC-V defines a modular open ISA. RV32I provides 32 registers (x0 hardwired zero), load/store, branches, and immediate arithmetic. Emulator structure mirrors your toy CPU: fetch, decode, execute.
cLoading…
For example, ADDI x5, x0, 10 places decimal 10 into x5 using opcode 0x13.
For this exercise, you will implement decode and execute for a subset of RV32I and run small binaries linked for qemu-riscv32 or flat hex images. This task asks you to see how a clean encoding map simplifies decoder tables compared to x86.
Keep the relevant datasheet, ISA manual, or architecture textbook chapter open while you implement. When your output disagrees with the reference trace on the same program, the bug is usually a mis-decoded opcode, a stale register read, or a flag bit left unchanged after arithmetic.
For this exercise, you will use those habits while implementing the requirement in the starter code. Microarchitectural product names change across CPU generations, but the control ideas (fetch, bypass, cache lines, vector lanes) stay stable enough to debug from first principles.
Implement RISC-V RV32I emulator for base instructions.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github