The processor architecture I am working with has a time tag counter that I wanna read out to make performance measurements. The time tag counter is memory mapped to the address 0x90000008. I used the following routine to read the value from the time tage counter, however the difference in the print out is always zero. Anyone an idea what I am missing?
char* const ADDR = (char *) 0x90000008;
unsigned long cycle_count_val() {
unsigned long res;
asm volatile (
"set ADDR, %%l0 \n\t"
"ld [%%l0], %0 \n\t"
: "=r" (res)
:
: "%l0"
);
return res;
}
....
unsigned long start = cycle_count_val();
execute_benchmark();
unsigned long end = cycle_count_val();
printf("Benchmark performance(in clock cycles) = %ld \r\n", end-start);
Many thanks for your help, Phil
我认为您无需求助于assmber-为什么您不能只阅读以下内容:
uint32_t tbr = (*((uint32_t volatile *) 0x90000008))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.