MiniRISC is a simple educational CPU simulator built as a student project to better understand how real processors work under the hood.
It follows the RISC (Reduced Instruction Set Computer) design philosophy and includes a basic 5-stage pipeline similar to classic MIPS architecture.
The goal of this project is to implement a minimal yet functional CPU core that supports:
- Basic arithmetic and logic operations (ADD, SUB, ADDI)
- Simple memory access (LW, SW)
- Branch and jump instructions (BEQ, J, JR)
- A 5-stage instruction pipeline (Fetch β Decode β Execute β Memory Access β Write Back)
- cpu.c / cpu.h β Main CPU structure, including registers, memory, program counter (PC), and control logic.
- instruction.h β Defines the instruction format and opcode constants.
- cpu_execute.c β Executes decoded instructions (the ALU stage).
- pipeline.c / pipeline.h β Implements a simple 5-stage pipeline simulation: Fetch, Decode, Execute, Memory Access, Write Back.
- memory.c / memory.h β Handles memory operations such as load and store, and manages access to the CPUβs memory space.
- main.c β The main entry point; builds the system and runs an example program on the CPU.
gcc src/*.c -o build/minirisc
./build/minirisc