This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ARM cortex 3

Can anyone explain what this code is doing


LDMIA r0,{r5-r9} ; get the next 5 data values to be filtered
ADD r5,r5,r9 ; sum x[-2] with x[2]
ADD r6,r6,r8 ; sum x[-1] with x[1]
ADD r9,r5,r6 ; sum x[-2]+x[2] with x[-1]+x[1]
ADD r7,r7,r9,LSR #1 ; sum x[0] with (x[-2]+x[2]+x[-1]+x[1])/2
MOV r7,r7,LSR #2 ; form (x[0] + (x[-2]+x[-1]+x[1]+x[2])/2)/4
STR r7,[r3],#4 ; save calculated filtered value, move to next output data item
ADD r0,r0,#4 ; move to start of next 5 input data values
SUBS r4,r4,#1 ; move on to next set of 5 inputs
BPL filter_loop ; continue until last set of 5 inputs reached

Parents Reply Children
No data