Outer Loop Conditionally Executed With Inner Loop
6-142
Example 6–76. Linear Assembly for FIR With Outer Loop Conditionally Executed
With Inner Loop (Continued)
MPY
h23,x23,p02
; p02 = h[i+2]*x[j+i+2]
ADD
p02,sum01,sum02
; sum0 += p02
MPYH
h23,x23,p03
; p03 = h[i+3]*x[j+i+3]
ADD
p03,sum02,sum03
; sum0 += p03
MPY
h45,x45,p04
; p04 = h[i+4]*x[j+i+4]
ADD
p04,sum03,sum04
; sum0 += p04
MPYH
h45,x45,p05
; p05 = h[i+5]*x[j+i+5]
ADD
p05,sum04,sum05
; sum0 += p05
MPY
h67,x67,p06
; p06 = h[i+6]*x[j+i+6]
ADD
p06,sum05,sum06
; sum0 += p06
MPYH
h67,x67,p07
; p07 = h[i+7]*x[j+i+7]
ADD
p07,sum06,sum07
; sum0 += p07
[!sctr]
MVK
4,sctr
; reset store lp cntr
[pctr]
SUB
pctr,1,pctr
; dec pointer reset lp cntr
[!pctr]
SUB
x,rstx2,x
; reset x ptr
[!pctr]
SUB
x_1,rstx1,x_1
; reset x_1 ptr
[!pctr]
SUB
h,rsth1,h
; reset h ptr
[!pctr]
SUB
h_1,rsth2,h_1
; reset h_1 ptr
[!pctr]
MVK
4,pctr
; reset pointer reset lp cntr
[octr]
SUB
octr,1,octr
; dec outer lp cntr
[octr]
B
LOOP
; Branch outer loop
6.14.6 Translating C Code to Linear Assembly (Inner Loop and Outer Loop)
Example 6–77 shows the linear assembly with functional units assigned. (As
in Example 6–68 on page 6-125, symbolic names now have an A or B in front
of them to signify the register file where they reside.) Although this allocation
is one of many possibilities, one goal is to keep the 1X and 2X paths to a
minimum. Even with this goal, you have five 2X paths and seven 1X paths.
One requirement that was assumed when the functional units were chosen
was that all the sum0 values reside on the same side (A in this case) and all
the sum1 values reside on the other side (B). Because you are scheduling
eight accumulates for both sum0 and sum1 in an 8-cycle loop, each ADD must
be scheduled immediately following the previous ADD. Therefore, it is undesir-
able for any sum0 ADDs to use the same functional units as sum1 ADDs.
One MV instruction was added to get x01 on the B side for the MPYLH p10
instruction.