一个非常非常非常简单的 riscv 模拟器
- 试用 copilot (copilot 比我强多了)
- 测试 cpu
将 hex 文件放在 assets 下
make run
生成 reg.log 在 build 目录下
格式
PC: 0x... Instr: 0x...
x0: 0x... ...
x4: 0x...
...
x28: 0x...
PC:.....
退出指令设置为 0xffffffff
,也就是说,需要在指令最后加上 ffffffff
退出。
另外设置了最大执行指令数量,默认为 100。
./build/emulator hex_file start_pc num_instrs log_file log_enabled