Skip to main content
fagundesbr
Associate II
July 16, 2015
Question

machine cycles - for instruction

  • July 16, 2015
  • 1 reply
  • 865 views
Posted on July 16, 2015 at 17:05

hi there!

i´m using the Cosmic c compiler and STM8S microcontroller.

i can´t find this information:

how many machine cylces this function takes?

for(conta=0;conta<10;conta++);

it´s seem to me that the ''for'' takes 6 cycles in simulator, but i want to be sure about that.

sincerely;
    This topic has been closed for replies.

    1 reply

    luca239955_stm1_st
    Associate
    July 20, 2015
    Posted on July 20, 2015 at 12:24

    Hello,

    you have to split your problem in two parts:

    1) see what assembler is generated for your C Code

    2) measure the cycles for the assembler

    If you have measured 6 cycles for a for loop of 10 iterations either your measure is wrong or the loop was just optimized away.

    Hope it helps.

    Luca