Hellow all, 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. e.g. Temp = P2; // Takes (??) cycles Array[Counter] = Temp; // Takes (??) cycles If(SignBit == 1) // Takes (??) cycles Temp = 0xF0; // Takes (??) cycles else 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! :-(
In the uVision 2.0 for 8051, how to determine the exact No. of cycles taken to execute a C Language statement? The following knowledgebase article terlls one way to do this. http://www.keil.com/support/docs/971.htm Given that performane analyzer works only on complete functions, not on a single line basis. That is not correct. The performance analyzer works on ranges of code as well as functions. To define a range in the Performance Analyzer Dialog, you must specify the starting address, a comma (','), and the ending address. You may use file/line number IDs if you like, For example \main\23 refers to line 23 in the main source file. Jon