AnsweredAssumed Answered

Timing behaviors of lpc1114fn28

Question asked by Si Gao on Feb 26, 2018
Latest reply on Mar 1, 2018 by Fall Guy

Hi,

 

I was working on a small project based on a lpc1114fn28 processor. Although my program runs successfully, I kept noticing some wired timing behaviors. For instance, if I wrote two identical functions in ASM with different names, sometimes their executing times are not exactly the same. Specifically, one function (in disassembly codes) is

 

 16a:      f3bf 8f6f              isb          sy

 16e:      681c                   ldr          r4, [r3, #0]          ; (Read SysTick)

 170:      e004                   b.n         0x17c

 172:      46c0                   nop                                      ; (mov r8, r8)

 174:      46c0                  nop                                      ; (mov r8, r8)

 176:      46c0                  nop                                      ; (mov r8, r8)

 178:      46c0                  nop                                      ; (mov r8, r8)

 17a:      46c0                  nop                                      ; (mov r8, r8)

 17c:      681d                  ldr          r5, [r3, #0] ]        ; (Read SysTick)

According to the SysTick, it takes 7 cycles. However, for the same codes in a different address 

1c8:       f3bf 8f6f              isb          sy

 1cc:       681c                  ldr          r4, [r3, #0]        ; (Read SysTick)

 1ce:      e004                  b.n         0x1da

 1d0:      46c0                  nop                                      ; (mov r8, r8)

 1d2:      46c0                  nop                                      ; (mov r8, r8)

 1d4:      46c0                  nop                                      ; (mov r8, r8)

 1d6:      46c0                  nop                                      ; (mov r8, r8)

 1d8:      46c0                  nop                                      ; (mov r8, r8)

 1da:      681d                  ldr          r5, [r3, #0]          ; (Read SysTick)

The SysTick suggested it take 5 cycles.

In theory, since b.n takes 3 cycles and ldr takes 2 cycles, it should always take 5 cycles to run the above codes. However, I constantly found that sometimes it takes 2 extra cycles. I was wondering what are these extra 2 cycles for? Any idea?

 

 

Thanks,

Si 

Outcomes