2

I have implemented accelerator on Rocket chip generator using Rocc. How to compute the performance of accelerator and compare with C implementation. I have written C implementation and computing the cycles as "Cycle = End - Begin". Where end and begin are calling read_csr(mcycle). I use it by reading dhrystone.h in RISCV-test github. Is this right way to calculate the cycles ?

I am thinking of using this technique for both accelerator and C implementation. Can i use CSR for this purpose.

seldridge
  • 2,704
  • 15
  • 19
ARK91
  • 373
  • 3
  • 13

1 Answers1

3

This is a great use of the RISC-V Hardware Performance Monitors (HPMs). If you are running your benchmark in machine mode, you can read mcycle to measure the passage on cycles. If you are running in user mode, you have instructions like rdcycle to give you user-level access to the cycle counter.

Chris
  • 3,827
  • 22
  • 30