Personal tools
You are here: Home Forums M16C Time cost of for(i=0; i<10; i++);

Time cost of for(i=0; i<10; i++);

Up to M16C

Time cost of for(i=0; i<10; i++);

Posted by Javio at August 14. 2008

Dear all,


I am new to renesas and I am a little beat lost. I would like the time cost of:


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


I want exactly to know how many clock cycles there are per loop in order to calculate the time cost.


Also I would like to know if there is any kind of code simulation tool (not an emulator) available.


Thank you very much

Javier

Re: Time cost of for(i=0; i<10; i++);

Posted by FrankL at August 14. 2008

There is a simulator always included in the compiler package. So if you ijnstalled the compiler you have a simulator.

However, this simulator is NOT cycle accurate. The simulator always counts best case cycles, not real execution times.

There is no simple way to say how long the execution of above loop takes. It depends on a number of parameters:

- Which assembler code is generated?

- Is the code aligned to even or odd addresses?

- What is the status of the instruction queue at the beginning of this loop?

- Is the data in near or far memory?

- If i is 16 bit or more, is it placed at an even or odd address?

For these reasons I would not try to calculate executuion time, but rather use an oscillosope to measure it.

Re: Time cost of for(i=0; i<10; i++);

Posted by Javio at August 14. 2008

Thank you very much, I do this.


Javio

Powered by Ploneboard