Reply by Robert Willy August 1, 20152015-08-01
On Saturday, August 1, 2015 at 3:37:59 PM UTC-7, Robert Willy wrote:
> Hi, > > I learn to use trace on ARM A8 cpu with a simple TI XDS100v2 emulator. The > trace data looks puzzling to me. See below message on trace window: > > > > ../hello.c,main,0x40303164,"PUSH {R3, LR}", ,0,19,Start of trace, > ../hello.c,main,0x40303166,"MOVS R0, #5" , ,19,80,Entered debug state when halting debug-mode is enabled, > ../hello.c,main,0x40303168,"STR R0, [SP]", ,99,73,, > ../hello.c,main,0x4030316A,"LDR R0, [SP]", ,172,0,, > ../hello.c,main,0x4030316C,BL 0x4030344C,,172,154,, > ../asm_func.s,$../asm_func.s:5:20$(),0x4030344C,"LDR R1, 0x40303460", ,326,74,, > > The first number in every row is on the 'Cycle' column, while the second > number is on the 'Delta Cycle' column. The source file content is like this: > > .global asmfunc > .global gvar > asmfunc: > LDR r1, gvar_a > LDR r2, [r1, #0] > ADD r0, r0, r2 > STR r0, [r1, #0] > MOV pc, lr > gvar_a .field gvar, 32 > > ............ > #include <stdio.h> > extern int asmfunc(int a); /* declare external asm function */ > int gvar = 0; /* define global variable */ > > > int main(void) { > int I = 5; > I = asmfunc(I); /* call function normally */ > > if (I<5) > printf("Hello World 1!\n"); > else > printf("Hello World 2!\n"); > return 0; > } > > In fact, the trace content is the first several line code of the main(). > It is very simple. I think that CPU runs it very quickly, but the cycle > number is very high. This is unbelievable to me. > Can you help me on the meaning of the number of the cycle number and delta > cycles? > > > I have got many answers from previous posts. They are very helpful to me and others as well. > > Thanks,
I forgot to add that the cycle number column is as follows: 0 19 99 172 ... I just notice that there is a comment 'Enter debug state while...' on the second row. Does that mean no pipeline operation is used for these lines? That would use so many cycles? It still looks too many cycles even no pipeline. Thanks,
Reply by Robert Willy August 1, 20152015-08-01
Hi,

I learn to use trace on ARM A8 cpu with a simple TI XDS100v2 emulator. The 
trace data looks puzzling to me. See below message on trace window:



 ../hello.c,main,0x40303164,"PUSH {R3, LR}", ,0,19,Start of trace,
 ../hello.c,main,0x40303166,"MOVS R0, #5"  , ,19,80,Entered debug state when halting debug-mode is enabled,
 ../hello.c,main,0x40303168,"STR  R0, [SP]", ,99,73,,
 ../hello.c,main,0x4030316A,"LDR  R0, [SP]", ,172,0,,
 ../hello.c,main,0x4030316C,BL    0x4030344C,,172,154,,
 ../asm_func.s,$../asm_func.s:5:20$(),0x4030344C,"LDR R1, 0x40303460", ,326,74,,

The first number in every row is on the 'Cycle' column, while the second
 number is on the 'Delta Cycle' column. The source file content is like this:

		.global asmfunc
		.global gvar
asmfunc:
		LDR r1, gvar_a
		LDR r2, [r1, #0]
		ADD r0, r0, r2
		STR r0, [r1, #0]
		MOV pc, lr
gvar_a .field gvar, 32

............
#include <stdio.h>
extern int asmfunc(int a); /* declare external asm function */
int gvar = 0; /* define global variable */


int main(void) {
    int I = 5;
    I = asmfunc(I); /* call function normally */

    if (I<5)
    	printf("Hello World 1!\n");
    else
    	printf("Hello World 2!\n");
	return 0;
}

In fact, the trace content is the first several line code of the main().
It is very simple. I think that CPU runs it very quickly, but the cycle
number is very high. This is unbelievable to me.
Can you help me on the meaning of the number of the cycle number and delta
cycles?


I have got many answers from previous posts. They are very helpful to me and others as well.

Thanks,