This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Measuring clock cycles on C6678 EVM

Hello all,

I'm just starting (really just starting) getting up and running on the C6678LE EVM. I'm trying to single step through a very simple "Hello World!" type program and follow the number of CPU cycles as it goes along using the clock tool ("Run -> Clock ->Enable").

The clock cycles are always incremented by multiple of "6" instead of "1" (sometimes more, depending on cache miss I suppose).

Any idea what I'm doing wrong?

Thanks

  • Hi,

    IMHO this depend on the CPU internal pipe: 5 stage + 1 instruction execution = 6 cycle for a single step one cycle instruction.  When using break point and not single step I found that the overhead became 5+5. I suppose its due to a starting overhead of 5 (first instruction reach the execution stage) and a final of 5 to flush the pipe. Try for instance to measure 10 NOP and then 100 NOPs: you'll find a fixed overhead of 10 (see http://e2e.ti.com/support/development_tools/compiler/f/343/p/244489/857057.aspx#857057)

  • Hello Alberto,

    You were absolutely right. If i use breakpoints between a sequence of instructions, I measure the number of expected clock cycles plus about 10 extra cycles. It seems to fluctuate a little bit sometimes, but on average it is consistent.

    The conclusion is that single stepping cannot be used to measure execution time accurately (contrary to using the simulator), and that using breakpoints can introduce small timing inaccuracies that you have to take into account. That's good to know.

    Thanks again, I would probably never have figured it out by myself.