|
1 | | -# RISC-V ISA Simulator |
| 1 | +# RISC-V Core Simulator (RV64IM) |
2 | 2 |
|
3 | | -This project is a course assignment for the **Computer Architecture and Organization Lab** at **Peking University** in the **Fall semester of 2025**, developed as an extension of the framework provided by the course. |
| 3 | +> **Supporting Single-Cycle (ISS), Multi-Cycle, and 5-Stage Pipeline Models** |
4 | 4 |
|
5 | | -## ✨ Features |
| 5 | +This project is a course assignment for the **Computer Architecture and Organization Lab** at **Peking University** (Fall 2025). It goes beyond a simple ISA simulator by implementing three distinct CPU microarchitecture models to demonstrate the evolution of processor design. |
6 | 6 |
|
7 | | -* Implements a majority of the instructions from the RV64IM instruction set. |
8 | | -* Implements the **`exit`** and **`write`** system calls (with `write` currently supporting output only to **stdout**), and enables the use of **`printf`** within the virtual RISC-V environment. |
9 | | -* Includes a simple built-in debugger with support for single-stepping, printing registers, and scanning memory. |
10 | | -* Supports function call tracing (**ftrace**). |
11 | | -* Supports instruction execution history logging (**itrace**). |
| 7 | +## ✨ Key Features |
| 8 | + |
| 9 | +### 🏗️ Microarchitecture Models |
| 10 | +* **Instruction Set Simulator (ISS):** A functional simulator for the **RV64IM** instruction set, serving as the "Golden Reference" for correctness. |
| 11 | +* **Multi-Cycle Model:** Implements a **Finite State Machine (FSM)** driven CPU that breaks instruction execution into 5 sequential stages (IF, ID, EX, MEM, WB). |
| 12 | +* **5-Stage Pipeline:** A complex **Pipelined CPU** design featuring: |
| 13 | + * **Hazard Handling:** Data Hazards (RAW) resolution via **Data Forwarding** and Load-Use Stalls (Bubbles). |
| 14 | + * **Control Logic:** Branch prediction and flushing mechanisms. |
| 15 | + * **Pipeline Registers:** Full implementation of IF/ID, ID/EX, EX/MEM, and MEM/WB state registers. |
| 16 | + |
| 17 | +### 🛠️ Runtime & Debugging Ecosystem |
| 18 | +* **System Calls:** Implements `ecall` handlers for `exit` and `write` (stdout), enabling standard C library functions like **`printf`** to run on bare metal. |
| 19 | +* **Interactive Debugger:** A built-in **GDB-style** debugger (REPL) supporting breakpoints, single-stepping, and register/memory inspection. |
| 20 | +* **Advanced Tracing:** |
| 21 | + * **itrace:** Instruction-level trace logging powered by **LLVM** disassembly. |
| 22 | + * **ftrace:** Function call graph tracing utilizing **Libelf** for symbol table parsing. |
| 23 | + |
| 24 | +--- |
12 | 25 |
|
13 | 26 | ``` |
14 | 27 | . |
@@ -204,3 +217,4 @@ make clean |
204 | 217 | | Debug mode | `make debug T=dummy` | |
205 | 218 | | Clean build files | `make clean` | |
206 | 219 |
|
| 220 | + |
0 commit comments