DSPRelated.com
Forums

fft & new dsp group

Started by Unknown January 13, 2004
Hi all,

A new group for Hungarian DSP users:
Subscribe:
Owner:
Web: http://lista.prim.hu

Usful informations:
There is an fft program example in the book "ADSP-218x DSP Istruction Set
Reference" on the page 3-14. It is Radix-2 Decimation-In-Time fft. I found
some errors in it, missing instuctions, worng register and fractional mode
using, srcambling errors etc... I'm trying to fix it, but I can't
understand, how the block exponent scaling works. The code is below. The
rows which i don't understand are questionmaked in the comment. The MAC is
used for shifting a word one or two bit right. But in real, it shifts the
words by two or four bits right. What is the reason for it? Why is 1 or 2
bit is written in the comments, and why shifts the MAC 2 or 4 bits right?

If somebody need the full code, plz wirte me! (not fully corrected yet!)

Thanks and regards
Sandor

.GLOBAL bfp_adj;
bfp_adj:
AY0 = DM(_stage_cnt); // check for last stage
AR = AY0 -1;
IF EQ RTS; // if last, rts

AY0 = -2;
AX0 = SB;
AR = AX0 - AY0; // check for sb=-2
IF EQ RTS; // if sb=-2, no bit growth, rts

I0 = inplacereal; // read ptr
I1 = inplacereal; // write ptr
AY0 = -1;
MY0 = 0X4000; // set my0 to shift 1 bit right ????
AR = AX0 - AY0 , MX0 = DM(I0,M1); //check if sb=-1
IF EQ JUMP strt_shift; //get 1st sample
AY0 = -2; // set ay0 for block exponent update
MY0 = 0X2000; // set my0 to shift 2 bits right ????

strt_shift:
ax1 = DM(_Ntimes2_1); // Ntimes2 - 1
CNTR = ax1;
DO shift_loop UNTIL CE;
MR = MX0 * MY0(RND), MX0 = DM(I0,M1);//mr=shifted data,mx0=next value
shift_loop: DM(I1,M1) = MR1; //shifted data

MR = MX0 * MY0(RND); //shift last data word
AX0 = DM(blk_exponent); //update block exponent
DM(I1,M1) = MR1, AR = AX0 - AY0; //and store last shifted sample
DM(blk_exponent) = AR;
RTS;