📄 bfp_adj.asm
字号:
/******************************************************************************
Calling Parameters
Radix-2 DIT FFT stage results in inplacereal and inplaceimag
NOTE: this code assumes inplaceimag immediately follows inplacereal in memory!
Return Parameters
inplacereal and inplaceimag adjusted for bit growth
Altered Registers
I0,I1,AX0,AY0,AR,MX0,MY0,MR,CNTR
Altered Memory
inplacereal, inplaceimag, blk_exponent
*******************************************************************************/
#define Ntimes2 255 /*N*2-1*/
#define N_div_2 64
.EXTERN inplacereal;
.EXTERN blk_exponent;
.GLOBAL bfp_adj;
/* program memory code */
.section/pm program;
bfp_adj: AX0=0;
DM(blk_exponent)=AX0;
AX0=CNTR;
AY0=N_div_2;
AR=AX0-AY0;
IF EQ RTS; //If last stage, return
AY0=-2;
AX0=SB;
AR=AX0-AY0; //Check for SB=-2
IF EQ RTS; //IF SB=-2, no bit growth, return
I0=inplacereal; //I0=read pointer
I1=inplacereal; //I1=write pointer
AY0=-1;
MY0=0x4000; //Set MY0 to shift 1 bit right
AR=AX0-AY0,MX0=DM(I0,M1); //Check if SB=-1; Get first sample
IF EQ JUMP strt_shift; //If SB=-1, shift block data 1 bit
AY0=-2; //Set AY0 for block exponent update
MY0=0x2000; //Set MY0 to shift 2 bits right
strt_shift: CNTR=Ntimes2; //initialize loop counter
DO shift_loop UNTIL CE; //Shift block of data
MR=MX0*MY0(RND),MX0=DM(I0,M1); //MR=shifted data,MX0=next value
shift_loop:DM(I1,M1)=MR1;
MR=MX0*MY0(RND); //Shift last data word
AY0=DM(blk_exponent); //Update block exponent and
DM(I1,M1)=MR1,AR=AY0-AX0; //store last shifted sample
DM(blk_exponent)=AR;
rts;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -