Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5131

Bare metal, Assembly language • Is this blinker code supposed to run any faster on 1200MHz core?

$
0
0

Code:

...ldr r2, =0x3FFFFFFFmov r4, #0delay:   add r4, r4 #1   cmp r4, r2   bne delayblinker:   mov r4, #0   cmp r3, #0   beq led_off   sub r3, r3, #1   / led ON /led_off:   add r3, r3, #1   / led OFF /
And I measure: LED ON for 8.07 sec, LED OFF for 8.09 sec (human factor) (icache turned on, branch prediction on/off has no effect)
Although theoretically I expected the delay loop to be only 5 cycles. Add, cmp, and branch is 1+1+3 (with enabled cache).
5*0x3FFFFFFF=5368709115
5368709115/1200000000=4.47 sec

Statistics: Posted by MaximBondaruk — Tue Apr 02, 2024 3:05 pm



Viewing all articles
Browse latest Browse all 5131

Trending Articles