Hi,
i am trying to do some performance measurements on the Ariane processor and therefore, I would like to use the cycle count from the RDCYCLE instruction. My code compiles fine, however, if I run it, I get a “illegal instruction” error. The following is the critical code snippet (both the CSRRS and RDCYCLE lead to the same error)
The RISC-V “Instruction Set Manual II: Privileged Architecture” states that the cycle CSR entry should be readable from user mode. I figured that this might not be the case in Ariane which would be fine if I could get to supervisor mode somehow. I looked into writing a kernel module that would give me access to the performance measures. Unfortunately, this turned out to be quite challenging since I can neither compile code on the FGPA nor use insmod to install my kernel module. Is there an easy way to get access to the cycle timer?
Thank you!
Jan
-- Edit: The same happens if I just use the built-in C time() function...
i am trying to do some performance measurements on the Ariane processor and therefore, I would like to use the cycle count from the RDCYCLE instruction. My code compiles fine, however, if I run it, I get a “illegal instruction” error. The following is the critical code snippet (both the CSRRS and RDCYCLE lead to the same error)
Code:
unsigned long get_clk(){
unsigned long timer = 0;
//__asm__ volatile("CSRRS %[result], cycle, x0\n\t" : [result]"=r"(timer)::);
__asm__("RDCYCLE %[result]\n\t" : [result]"=r"(timer)::);
return timer;
}
The RISC-V “Instruction Set Manual II: Privileged Architecture” states that the cycle CSR entry should be readable from user mode. I figured that this might not be the case in Ariane which would be fine if I could get to supervisor mode somehow. I looked into writing a kernel module that would give me access to the performance measures. Unfortunately, this turned out to be quite challenging since I can neither compile code on the FGPA nor use insmod to install my kernel module. Is there an easy way to get access to the cycle timer?
Thank you!
Jan
-- Edit: The same happens if I just use the built-in C time() function...