Fir Filter Inner Loop - Texas Instruments TMS320C6000 Programmer's Manual

Hide thumbs Also See for TMS320C6000:
Table of Contents

Advertisement

Memory Banks

6.12.1 FIR Filter Inner Loop

Example 6–65. Final Assembly Code for Inner Loop of FIR Filter
LOOP:
ADD
||
ADD
||
MPY
||
MPY
||[B2]
B
||
LDH
||
LDH
ADD
||
ADD
||
MPY
||
MPY
||[B2]
SUB
||
LDH
||
LDH
6-120
Example 6–65 shows the inner loop from the final assembly in Example 6–64.
The LDHs from the h array are in parallel with LDHs from the x array. If x[1] is
on an even halfword (bank 0) and h[0] is on an odd halfword (bank 1),
Example 6–65 has no memory conflicts. However, if both x[1] and h[0] are on
an even halfword in memory (bank 0) and they are in the same memory block,
every cycle incurs a memory pipeline stall and the loop runs at half the speed.
.L2X
A8,B9,B9
.L1
A7,A9,A9
.M2
B1,B0,B7
.M1X
B1,A1,A8
.S2
LOOP
.D1
*A5++[2],A1
.D2
*B5++[2],B1
.L1X
B7,A9,A9
.L2
B8,B9,B9
.M2X
A0,B0,B8
.M1
A0,A1,A7
.S2
B2,1,B2
.D2
*B4++[2],B0
.D1
*A4++[2],A0
It is not always possible to fully control how arrays are aligned, especially if one
of the arrays is passed into a function as a pointer and that pointer has different
alignments each time the function is called. One solution to this problem is to
write an FIR filter that avoids memory hits, regardless of the x and h array align-
ments.
If accesses to the even and odd elements of an array (h or x) are scheduled
on the same cycle, the accesses are always on adjacent memory banks. Thus,
to write an FIR filter that never has memory hits, even and odd elements of the
same array must be scheduled on the same loop cycle.
; sum1 += x1 * h0
; sum0 += x0 * h0
;* x1 * h1
;* x1 * h0
;** branch to inner loop
;**** h0 = h[i]
;**** x1 = x[j+i+1]
; sum0 += x1 * h1
; sum1 += x0 * h1
;* x0 * h1
;** x0 * h0
;*** decrement inner loop cntr
;**** h1 = h[i+1]
;**** x0 = x[j+i+2]

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents