In the uVision 2.0 for 8051, how to determine the exact No. of cycles taken to execute a C Language statement? Given that performane analyzer works only on complete functions, not on a single line basis.
Temp = P2; // Takes (??) cycles
Array[Counter] = Temp; // Takes (??) cycles
If(SignBit == 1) // Takes (??) cycles
Temp = 0xF0; // Takes (??) cycles
Temp = 0x0; // Takes (??) cycles
Thanks in advance for your time.
Look at the assembler listing, and the data sheet for your particular processor.
The assembler listing will tell you precisely what instructions the compiler has used to implement your 'C' source line, and the data sheet will tell you how many clock cycles each of those instructions takes.
This will, of course, be affected by the optimiser setting - and the optimiser may "blur" the distinction between specific 'C' source lines.
At http://www.8052.com/users/awneil/8051_INSTRUCTION_SET.XLS I have posted the data for a Triscend E5 - which I believe is the same as the Dallas "accelerated" 8051 parts.
"Given that performane analyzer works only on complete functions, not on a single line basis."
I seem to remember that the manual gives the impression that the Performance Analyser can be used on any arbitrary address range, but my experience is - as you say - that it only actually works for complete fucntions! :-(
View all questions in Keil forum