# template **Repository Path**: yecr/template ## Basic Information - **Project Name**: template - **Description**: 一个简易的处理器开发模板 - **Primary Language**: Unknown - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2023-02-07 - **Last Updated**: 2023-02-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #### 编译得到emu文件 ```sh make verilog ``` 即可在build中得到名为SimTop.v的仿真顶层。 ```sh make emu ``` 即可在build中得到名为emu的可执行文件。 ```sh ./build/emu -h ``` 可查看这个可执行文件的各种参数说明。 #### 加载镜像文件进行测试 emu可以通过-i参数加载镜像文件,bin目录下存放一部分测试文件,包括cpu-test、riscv-test等,还有一个开源操作系统rt-thread,这里以最简单的inst_diff为例: ```sh ./build/emu --dump-wave -i ./bin/inst_diff.bin ``` 参考输出如下: ```sh Emu compiled at Feb 17 2023, 11:21:35 key num:0 share memory id:37 The image is ./bin/inst_diff.bin Using simulated 256MB RAM dump wave to /home/yecr/rainbow/build/2023-02-17@11:22:26.vcd... --diff is not given, try to use $(NEMU_HOME)/build/riscv64-nemu-interpreter-so by default Using /home/yecr/rainbow/NEMU/build/riscv64-nemu-interpreter-so for difftest The first instruction of core 0 has commited. Difftest enabled. Core 0: HIT GOOD TRAP at pc = 0x8000000c total guest instructions = 4 instrCnt = 4, cycleCnt = 9, IPC = 0.444444 Seed=0 Guest cycle spent: 11 (this will be different from cycleCnt if emu loads a snapshot) Host time spent: 1ms ``` #### 调试 emu执行完成之后,不管对错,都会在NOOP_HOME的build目录生成后缀为.vcd的波形文件。这一点不难在emu的输出中发现。 使用gtkwave就可以打开波形文件(文件名是执行时间): ```sh gtkwave ../rainbow/build/2023-02-17@11\:22\:26.vcd ```