/* This C language subroutine is the core Floating point, inverse Discrete Fourier Transform (DFT) routine called by various library routines. The Run Time Library for the C Language. Gordon A. Sterling (617) 461 - 3076 DSP Development Tools Engineering Created on 5/10/90 Updated on 5/94 by AS #include
float *___idftcore(float real_in[], float imag_in[], \ float real_out[], float imag_out[]) */ #include "lib_glob.h" #include "trn_glob.h" .SEGMENT/CODE Code_Space_Name; .FILE RTL_FILENAME; .GLOBAL ____idftcore; ____idftcore: R2=dma_i; put(R2); R2=dma_m; put(R2); R2=dma_l; put(R2); R2=dmb_i; put(R2); R2=dmb_l; put(R2); R2=dmc_i; put(R2); R2=dmc_l; put(R2); R2=pma_i; put(R2); R2=pma_l; put(R2); R2=MODE1; put(R2); put(R3); put(R5); put(R6); put(R7); put(R9); put(R10); put(R11); put(R13); put(R14); put(R15); BIT CLR MODE1 65536; /*Set 40-bit mode*/ R12=PASS R4, R10=R12; R11=PASS R8, readparam4(R9); R15=PASS R4; /*Hold N for now (set by caller)*/ R13=PASS R8; /*Hold imag coeffs for now (set by caller)*/ R14=LSHIFT R4 BY -2; /*Compute N/4*/ R14=R8+R14; /*Hold real coeffs ptr*/ dm_lnt=0; /*Clear length registers*/ dma_l=0; /*Clear length registers*/ dmb_l=0; /*Clear length registers*/ dmc_l=0; /*Clear length registers*/ dm_ptr=R12; /*Point to real input data*/ dmc_i=R11; /*Point to imag input data*/ dma_i=R10; /*Point to real output array*/ dmb_i=R9; /*Point to imag output array*/ pm_bse=R14; /*Point to real twiddle factors*/ pma_b=R13; /*Point to imag twiddle factors*/ R11=LSHIFT R15 BY -1; /*Compute N/2*/ pm_lnt=R11; /*Set length register for twids*/ R7=R7-R7, pma_l=R11; /*Two DAGs are needed for twids*/ R11=R14-1; /*Inner loop executes one less time*/ LCNTR=R14, DO bin_loop UNTIL LCE; R8=R8-R8, pm_mdf=R7; /*Clear imag accumulator, set modify*/ R9=R9-R9, F0=DM(dm_ptr,dm_1), F5=PM(pm_ptr, pm_mdf);/*Clear real accumulator*/ F12=F0*F5, F1=DM(dmc_i, dm_1), F4=PM(pma_i, pm_mdf);/*Compute C*X*/ LCNTR=R11, DO compute_bin UNTIL LCE; /*Inner loop N-1 times*/ F13=F0*F4, F9=F9+F12, F0=DM(dm_ptr, dm_1); /*Compute X*S, real += CX*/ F12=F1*F5, F8=F8+F13, F5=PM(pm_ptr, pm_mdf); /*Compute Y*C, imag += SX*/ F13=F1*F4, F8=F8+F12, F4=PM(pma_i, pm_mdf); /*Compute Y*S, imag += CY*/ compute_bin: F12=F0*F5, F9=F9-F13, F1=DM(dmc_i, dm_1); /*real -= YS*/ F13=F0*F4, F9=F9+F12; F12=F1*F5, F8=F8+F13; F13=F1*F4, F8=F8+F12; F9=F9-F13, DM(dmb_i, dm_1)=F8; /*Write out imag*/ bin_loop: R7=R7+1, DM(dma_i, dm_1)=F9; /*Write out real*/ restore_state: R0=PASS R10, FETCH_RETURN /*Point to real output*/ get(R15,1); get(R14,2); get(R13,3); get(R11,4); get(R10,5); get(R9,6); get(R7,7); get(R6,8); get(R5,9); get(R3,10); get(MODE1,11); get(R2,12); pma_l=R2; get(R2,13); pma_i=R2; get(R2,14); dmc_l=R2; get(R2,15); dmc_i=R2; get(R2,16); dmb_l=R2; get(R2,17); dmb_i=R2; get(R2,18); dma_l=R2; get(R2,19); dma_m=R2; get(R2,20); dma_i=R2; RETURN (DB); RESTORE_STACK RESTORE_FRAME .ENDSEG;