hehao98/RISCV-Simulator
关于
A Simple RISC-V CPU Simulator with 5 Stage Pipeline, Branch Prediction and Cache Simulation
学习与教育可以做什么
- Supporting 54 RISC-V instructions from the RV64I instruction set.
- Branch perdiction module with a set of branch perdicton algorithms.
- Simulation of five stage pipeline like that in the "Computer Organization and Design, Hardware/Software Interface" Book.
- Simulation of cache and various cache eviction strategies.
实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文RISC-V Simulator
A Simple RISC-V CPU Simulator with 5 Stage Pipeline, Branch Prediction and Cache Simulation
It is a simple RISC-V Emulator suppprting user mode RV64I instruction set, from PKU Computer Architecture Labs, Spring 2019. I made my project open source in the hope that others can learn from my code about how to make a CPU Emulator and get a deeper understanding in computer architecture. As it is implemented entirely from scratch (with no code from Prof or TA), I think it's fine to make it open source.
Note that this is just a toy for learning and is NOT a robust and full solution to RISC-V CPU Emulation. Use qemu for that purpose instead.
Features
- Supporting 54 RISC-V instructions from the RV64I instruction set.
- Branch perdiction module with a set of branch perdicton algorithms.
- Simulation of five stage pipeline like that in the "Computer Organization and Design, Hardware/Software Interface" Book.
- Simulation of cache and various cache eviction strategies.
Compile
mkdir build
cd build
cmake ..
make
Usage
./Simulator riscv-elf-file-name [-v] [-s] [-d] [-b strategy]
Parameters:
-vfor verbose output, can redirect output to file for further analysis-sfor single step execution, often used in combination with-v.-dfor creating memory and register history dump indump.txt-bfor branch perdiction strategy (defaultBTFNT), accepted parameters areAT,NT,BTFNTandBPB.- AT: Always Taken
- NT: Always Not Taken
- BTFNT: Back Taken Forward Not Taken
- BPB: Branch Prediction Buffer (2 bit history information)
There are a number of reference RISC-V ELFs and its corresponding assembly code in the riscv-elf/ folder.
Documentation (In Chinese)
See the doc/ folder.
Also, you can see the corresponding blog.
探索相关项目
加载中…