For this ARM assembly code:
AREA Prog, CODE, READONLY
ENTRY
COUNT EQU 128
func
MOV R1, #0
loop
CMP R1, #COUNT
BGE exit
LDR R2, [R3, R1, LSL #2];
ADD RO, RO, R2;
ADD R1, R1, #2
B loop
MOV PC, LR
(a) How many bytes of memory does this program occupy? [2 marks]
(b) Data processing instructions take one clock cycle and control flow and memory access instructions take 3 clock cycles. If the above code is running on a system clocked at 100 MHz frequency, what is the time taken in seconds to run the above code? [5 marks]
(c) Optimise and re-write the above assembly program so that only one branch instruction is used. [6 marks]
(d) For your optimised code in (c), what is the code size and execution time? [6 marks]