Motorola DSP Developer's Kit | ![]() ![]() |
Y = mot###_decimate( X, r, nfilt, 'fir' )
Description
Function decimate
resamples data at a lower rate after lowpass FIR filtering. Input vector X is a complex vector
Input/Output
Input Parameters: complex Vector X, int r
, int nfilt
Output Parameters: complex Vector Y
Algorithm
The MEX function decimate_fir.m
calculates vector b
, vector list
, int nout
, and int nbeg
,. The CMEX function loads these parameters into dsp
memory for asm
function use.
nd = length(idata); m = size(idata,1); nout = ceil(nd/r); b = fir1(nfilt,1/r); gd = grpdelay(b,1,8); list = round(gd(1)+1.25):r:nd; lod = length(list); nlen = nout-lod; nbeg = r-(nd-list(length(list))); Assembly function decimate-fir-c.asm, and then follow these steps to calculate decimated vector Y: nfilt = nfilt+1 itemp = 2*idata(1)-idata((nfilt+1):-1:2) [odata,zf] = filter(b,1,idata,zi) odata = odata(list)
Memory & Register
r
is loaded in register N3nfilt
is loaded in register N5idata
(In the idata
area, the first half stores the real part, the second half stores the imaginary part)
idata
)) stores vector b
(In the b
area, the first half stores the real part, and the second half stores the imaginary part)
idata
)+(length of b
)) stores the vector zi/zf
(In the zi/zf
area, the first half stores the real part, and the second half stores the imaginary part)
idata
)+(length of b
)+(length of zi
)) stores nout
idata
)+(length of b
)+(length of zi
)+1) stores the length of list
idata
)+(length of b
)+(length of zi
)+2) stores the vector list
idata
r
nfilt
b
, nfilt+1
nout
lod
nbeg
nlen = nout-lod
odata
(In the odata
area, the first half stores the real part, and the second half stores the imaginary part)
odata
)) stores the vector itemp
length of itemp is 2*2*(nfilt+1)
Length of idata
is 2*
Length of odata
is 2*
Length of b
is nfilt+1
Length of zi, zf
is nfilt+1
Length of list
is lod
Length of itemp
is 2*2*(nfilt+1)
idata
(n
)r
nfilt
b
(nfilt+1
)Status Register
No status registers or bits are set explicitly during the function execution.
Data Size Limit
The input vector X length must longer than r*(nfilt+1)
. The length of vector X can't be larger than the continuous available data memory size.
Data Range Limit
The input vector X range is [-1.0, +1.0].
Precision
In the case of DSP563, precision is 21 bits.
In the case of DSP566, precision is 12 bits.
![]() | decimate-fir-r.asm | decimate-iir-r.asm | ![]() |