RISC-V的Spike模拟器

本文记录了在使用RISC-V的Spike模拟器时遇到的问题,包括CPI始终为1的不正常现象,以及cache失效率的模拟。虽然Spike不提供精确的周期模拟,但可用于验证程序的功能正确性。同时,文章讨论了如何在Spike和pk之间共享CSR寄存器值的问题,并详细解释了csrrs指令的执行过程。
摘要由CSDN通过智能技术生成

今天遇到的问题,记录下来。
· CPI 始终等于1。这显然是不正确的。 cycle和instruction以及CPI的计算都是由PK来完成的。
pk -s 中的 sys_exit
也就是说,pk中计算的CPI和cache模型中计算失效率是不想关的。

As you are debugging, please note that spike is not meant to be a cycle-accurate simulator of the assembly code. When spike runs, memory operations “magically” resolve in a single cycle, and branches are always evaluated without delay. The ISA simulator can evaluate the functional correctness of programs, but it is not a good way to measure how long they will take to run. Such cycle-accurate simulation requires a target hardware implementation such as the one that you will compile later in the lab. [1]

· cache的失效率的模拟
这个部分还没有深入去看,cache模型的模拟应该是有模型的。

· 关于cycle 的问题
在riscv 中,时钟的获取可以通过特殊的system指令 CSR系列来读取。
1. 伪代码方式 asm volatile ("rdcycle %0":"=r"(

  • 1
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 11
    评论
评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值