Table 5.1 (continued )
n ;
x[i] (int)((0x7fff*temp)0.5);
}
}
5.6.1 Experiment 5A ± Implementation of Block FIR Filter
The difference equation (5.2.1) and Example 5.13 show that FIR filtering includes two
different processes: (1) It performs a summation of products generated by multiplying
the incoming signals with the filter coefficients. (2) The entire signal buffer is updated to
include a new sample. For an FIR filter of L coefficients, L multiplications, (L À 1)
additions, and additional data memory move operations are required for the complete
filtering operations. Refreshing the signal buffer in Example 5.13 uses the memory shift
shown in Figure 5.11. To move (L À 1) samples in the signal buffer to the next memory
location requires additional instruction cycles. These extensive operations make FIR
filtering a computation-intensive task for general-purpose microprocessors.
The TMS320C55x has three important features to support FIR filtering. It has
multiply±accumulate instructions, the circular addressing modes, and the zero-overhead
nested loops. Using multiply±accumulate instructions, the C55x can perform both
multiplication and addition with rounding options in one cycle. That is, the C55x can
complete the computation of one filter tap at each cycle. In Example 5.13, the updating
of the signal buffers by shifting data in memory requires many data-move operations. In
practice, we can use the circular buffers as shown in Figure 5.12. The FIR filtering in
Example 5.13 can be tightly placed into the loops. To reduce the overhead of loop
control, the loop counters in the TMS320C55x are handled using hardware, which can
support three levels of zero-overhead nested loops using BRC0, BRC1, and CSR
registers.
The block FIR filter in Example 5.13 can be implemented with circular buffers using
the following TMS320C55x assembly code:
mov
# MÀ1,BRC0
mov
# LÀ3,CSR
j j rptblocal sample_loop-1 ; Start the outer loop
mov
*AR0,*AR3
; Put the new sample to signal buffer
mpym *AR3,*AR1+,AC0
; Do the 1st operation
j j rpt
CSR
; Start the inner loop
macm *AR3,*AR1,AC0
macmr *AR3,*AR1,AC0
; Do the last operation
mov
hi(AC0),*AR2
; Save result in Q15 format
sample_loop
Four auxiliary registers, AR0±AR3, are used as pointers in this example. AR0 points
to the input buffer in []. The signal buffer x []containing the current input x(n) and the
L À 1 old samples is pointed at by AR3. The filter coefficients in the array h []are
pointed at by AR1. For each iteration, a new sample is placed into the signal buffer and
EXPERIMENTS USING THE TMS320C55X
227