Tool/software: Code Composer Studio
Hi,
I tried to test how many CPU cycles it takes to read from a register, using the code below. But the result is around 119 cycles simply to read a register. I believe this is not correct, so what might be wrong?
Code is on L2 RAM, Many thanks
#include <c6x.h>
unsigned int start, stop;
unsigned int test = 0;
int main(void)
{
TSCL = 0; // need to write to it to start counting
start = TSCL;
// critical code
test = *((volatile unsigned int *)(0x02220020)); // SOC_TMR_2_REGS + TMR_INTCTLSTAT
stop = TSCL;
stop -= start; // stop will have the total number of CPU cycles
for(;;)
{
}
}