Texas Instruments MSP50C6xx Calculator User Manual


 
Special Filter Instructions
4-60
N tap filters ideally require 2N multiplyaccumulates. Four instructions are
provided to compute this equation: FIR, FIRK, COR and CORK. All filter
instructions require overflow modes to be reset since these instructions have
built in overflow hardware. In addition, these instructions must be used with a
RPT instruction.
FIR and FIRK instructions perform 16-x-16 bit multiplies and 32-bit
accumulation in 2 clock cycles (per tap). The FIR/FIRK instruction takes 2N
clock cycles (for N taps) to execute (once inside the RPT loop). FIRK is useful
for fixed filters and requires the minimum amount of data memory. However,
the DP register may need to be context saved and restored since the filter
coefficients are in ROM. FIR is useful for adaptive filtering or applications
where coefficients are provided from an external source. FIR does not require
a context save and restore for the DP register since both the buffer and the
coefficients are in RAM.
COR and CORK instructions perform 16-x-16 bit multiplies and 48-bit
accumulation in 3 clock cycles (per tap). Once inside the RPT loop, the total
number of clock cycles for an N tap filter is 3N. The COR and CORK
instructions are identical in operation and arguments to FIR and FIRK.
However, an additional 16-bit extended accumulate cycle is added to prevent
the arithmetic overflow common in auto correlation filters.
FIR (COR) Instructions: The execution of the filter instructions is shown in
Figure 46. To use FIR (COR) instructions, some initial setup is required.
Consecutive Rx pair {Rx
even
, Rx
even
+1} should be chosen with Rx
even
pointing
to the RAM sample buffer array and Rx
even
+1 pointing to the RAM coefficient
array. The MR register should be loaded with the first coefficient, h[0]. FIR
(COR) can now execute with a repeat instruction for N taps. The value of
Rx
even
is incremented during execution. After execution, the last value of
Rx
even
points to the sample buffer location where the next sample can be
stored.
FIRK (CORK) Instructions: FIRK (CORK) instructions work exactly the same
was as FIR(COR) instructions, however, the coefficient array is located in
program memory (ROM). Instead of loading Rx
even
+1 with the pointer to
coefficient array in RAM, the data pointer, DP, is loaded with the value of the
coefficient array.
Circular Buffering:The easiest way to understand circular buffering is by
example. Suppose a filter, h[n], has three coefficients. Then, theoretically, to
calculate one output sample of the filter, the buffer should contain the current
sample plus the past 2 samples. Since the output, y[k], for a three tap filter is,
y[k] = h[0]•×[k] + h[1]•×[k1] + h[2]•×[k2]
On the C614, the circular buffer must contain N+1 samples. In the above ex-
ample, the buffer must contain four locations (which is one more location than