cancel
Showing results for 
Search instead for 
Did you mean: 

machine cycles - for instruction

fagundesbr
Associate II
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;
1 REPLY 1
luca239955_stm1_st
Senior II
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