Texas Instruments MSP50C6xx User Manual
Page 151
Special Filter Instructions
4-65
Assembly Language Instructions
Important Note About Setting the STAT Register
It is very important to consider the initial value of the filterSTAT_tag variable.
Failure to set up the filterSTAT_tag variable can cause incorrect results in FIR/
COR operations. Overflow mode must always be reset. The overflow bit of the
STAT register may not be set.
For samples or filter coefficients that are signed, the sign extension mode bit
must also be set. Use the following set up for the filterSTAT_tag variable,
rovm
; Mandatory
; –– Any addition modes can be set hereafter ––
sxm
; For signed samples, coefficients, filter output
mov
*filterSTAT_tag,STAT
The FIRK/CORK instructions are almost identical to the FIR/COR instructions.
The main difference is that the filter coefficients are placed in ROM instead of
RAM. In other words, the filter coefficients are in a look-up table. As a result,
the R1 register is not used. Before a FIRK/CORK instruction executes, the
data pointer register, DP, must be set by the following code,
rovm
;reset overflow mode
mov
R5, –2 * N
;circular buffer length (3 words)
mov
A0,FIRK_COEFFS
; Loads address of lookup table
mov
A0,*A0
; Loads first coefficient to A0 and
sets DP
mov
MR,A0
; Load first coefficient in to MR
register
In the sequence of code above, the DP register points to the first filter coeffi-
cient (in program memory located at FIRK_COEFFS). This happens during
the mov A0,*A0 instruction. In addition, the DP register automatically incre-
ments to the next address. It should be pointing to the second filter coefficient
in program memory. If the contents of the DP register are used somewhere
else in the program, a context save and restore must be performed on the DP
register for each FIRK/CORK instruction. See the chapter 4 section called,
Lookup Instructions. During FIRK/CORK execution, the MR register is loaded
with the contents of the DP register, the DP register increments, pointing to the
next filter coefficient, and the multiply-accumulate is performed.
The remaining FIRK/CORK code is almost the same as the FIR/COR code.
mov
R0,*startOfBuff
;R0 points to start of circular
buffer
mov
AP0,0
;set up room for the
mov
STR,0
;32 bit output sample (AC0 and
AC1)
zacs
A0
; STR should be 1 for COR/CORK
instructions