You are currently viewing IDFT 8 Point DIT using TMS320C6745 DSP

IDFT 8 Point DIT using TMS320C6745 DSP

Spread the love

Aim

To perform the 8 point IDFT using DIT process from a given discrete sequence in TMS320C6745 KIT.

Requirements

☞CCS v4

TMS320C6745 KIT

☞USB Cable

☞5V Adapter 

Theory

The algorithm for ifft(X) is the same as the algorithm for fft(X), except for a sign change and a scale factor of n = length(X). As for fft, the execution time for ifft depends on the length of the transform. It is fastest for powers of two. It is almost as fast for lengths that have only small prime factors. It is typically several times slower for lengths that are prime or which have large prime factors.

FFT algorithms can be used to compute an inverse DFT without any change in algorithm. The inverse DFT of an N-point sequence X(k) , k = 0,1, 2, . . . . ., N-1 is defined as IDFT formula

Procedure for build a project on IDFT 8 Point DIT using TMS320C6745 DSP

1. Open Code Composer Studio v4 .

2. In WorkSpace Launcher.

BROWSE → Select the project location and make one new folder, MAKE NEW FOLDER → Type the Workspace name, OK → OK.

3. FILE ⇒ NEW ⇒ CCS PROJECT

☞Project name: Type your project name.

☞Tick use default location. → NEXT

☞Project type C6000.

☞Tick Debug And Release. → NEXT → NEXT.

☞Output type: Executable.

☞Device Variant : generic – TMS320C6745.

☞Device Endianness : little

☞Code Generation Tools: TI v6.1.12.

☞Run time support library: automatic.

☞Target content: none. →FINISH

4.FILE ⇒ NEW ⇒ SOURCE FILE

☞Source file: Type your projectname.c( .c extension is must ).

☞Type the program.

FILE → SAVE.

5. Paste the following board library files in workspace location.

☞Common folder (contains header files)

☞Gel folder (contains gel file)

☞Library folder(contains library files)

6. Paste the Linker file in the project location.(linker file is available in cd)

Note: Those folders and linker file are availble at cd.

7. PROJECT ⇒ PROPERTIES ⇒ C/C++ BUILD → BASIC OPTION

☞Target processor version(–silicon version, -mv)    :   6400+ OK.

☞IN C/C++ BUILD, INCLUDE OPTIONS (Add dir to #include search path(–include_path,-I)) select the add icon and add the following three path by indivdually    –  “${Diag}../../common/header”    –  “${XDAIS_CG_ROOT}/packages/ti/xdais”    –  “${C6000_CSL_CG_ROOT}/include”

8. FILE ⇒ NEW ⇒ TARGET CONFIGURATION FILE

☞file name: projectname. ccxml (.ccxml extension is must)

☞Connection: Texas Instrument XDS100 v1 USB Emulator.

☞Device: TMS320C6745. (Tick the TMS320C6745)→ SAVE → TARTGET CONFIGURATION → C674X_0 → BROWSE, browse the workspace location, open the gel folder and select the GEL file. → OPEN → SAVE.

9. In C/C++ Project window, Right click the project ⇒ REBUILD PROJECT.

10. Connections

☞Connect the usb cable, PC to TMS320C6745 KIT.

☞Connect the 5v adapter.

☞Power on the kit.

11. TARGET ⇒ DEBUG ACTIVE PROJECT.

12. VIEW ⇒ MEMORY

13. In right side, memory window will open. Type the adrress to see th results.

☞Enter An Address:0xC0001000 Enter.(Sequence output)

Note : Result will display after the run and halt the processor.

14. View ⇒ Watch window ⇒ watch1.

☞Type the following array variable.    –  Xr( Sequence output)

15. DEBUG ⇒ RUN.

16. DEBUG ⇒ HALT.

17. See output memory window. X(n)

 
0xC0001000 – 00000008 

0xC0001004 – 00000008

0xC0001008 – 00000008 

0xC000100C – 00000007

0xC0001010 – 00000000

0xC0001014 – 00000000

0xC0001018 – 00000000

0xC000101C – 00000000  

18. Or see the ouput at watch window.

Note: watch window will show exact decimal values, processor memory location will show a hexadecimal values.

Program for IDFT 8 Point DIT using TMS320C6745 DSP

#include 
void Bit_reversal();
float xr[8],xi[8],s1r[8],s1i[8],s2r[8],s2i[8],Xr[8],Xi[8],Yr[8],Yi[8],tempr[8],tempi[8];
float tr[8] = {7, -0.707,  0, 0.707, 1,  0.707,  0, -0.707 };     // real part input
float ti[8] = {0,  0.707,  1, 0.707, 0, -0.707, -1, -0.707 };     // imaginary part input
const float W0r = 1,
                        W0i = 0,
                        W1r = 0.707,
                        W1i = -0.707,
                        W2r = 0,
                        W2i = -1,                       
                        W3r = -0.707,
                        W3i = -0.707;
        void main()
{
        int *Seq_out;
        int i=0,j=0;
        Seq_out = (int *)0xC0001000;
        Bit_reversal();
// stage one process
        s1r[0] = (xr[0] + xr[1]);
        s1i[0] = (xi[0] + xi[1]);
        s1r[1] = (xr[0] - xr[1]);
        s1i[1] = (xi[0] - xi[1]);
        s1r[2] = (xr[2] + xr[3]);
        s1i[2] = (xi[2] + xi[3]);
        s1r[3] = (xr[2] - xr[3]);
        s1i[3] = (xi[2] - xi[3]);
        s1r[4] = (xr[4] + xr[5]);
        s1i[4] = (xi[4] + xi[5]);
        s1r[5] = (xr[4] - xr[5]);
        s1i[5] = (xi[4] - xi[5]);
        s1r[6] = (xr[6] + xr[7]);
        s1i[6] = (xi[6] + xi[7]);
        s1r[7] = (xr[6] - xr[7]);
        s1i[7] = (xi[6] - xi[7]);
// stage two process
s2r[0] = (s1r[0] + s1r[2]);                                                                                                                                                                                                             
        s2i[0] = (s1i[0] + s1i[2]);
                tempr[0] = (s1r[3] * W2r) - (s1i[3] * W2i);
                tempi[0] = (s1r[3] * W2i) + (s1i[3] * W2r);
        s2r[1] = s1r[1] + tempr[0];
        s2i[1] = s1i[1] + tempi[0];
        s2r[2] = (s1r[0] - s1r[2]);
        s2i[2] = (s1i[0] - s1i[2]);
        s2r[3] = s1r[1] - tempr[0];
        s2i[3] = s1i[1] - tempi[0];
        s2r[4] = (s1r[4] + s1r[6]);
        s2i[4] = (s1i[4] + s1i[6]);
                tempr[1] = ((s1r[7] * W2r) - (s1i[7] * W2i));
                tempi[1] = ((s1r[7] * W2i) + (s1i[7] * W2r));
        s2r[5] = s1r[5] + tempr[1];
        s2i[5] = s1i[5] + tempi[1];
        s2r[6] = (s1r[4] - s1r[6]);
        s2i[6] = (s1i[4] - s1i[6]);
        s2r[7] = s1r[5] - tempr[1];
        s2i[7] = s1i[5] - tempi[1];
//  output
// complex multiplication for B * Wn
        Yr[0] = (s2r[4] * W0r) - (s2i[4] * W0i);
        Yi[0] = (s2r[4] * W0i) + (s2i[4] * W0r);
        Yr[1] = (s2r[5] * W1r) - (s2i[5] * W1i);
        Yi[1] = (s2r[5] * W1i) + (s2i[5] * W1r);
        Yr[2] = (s2r[6] * W2r) - (s2i[6] * W2i);
        Yi[2] = (s2r[6] * W2i) + (s2i[6] * W2r);
        Yr[3] = (s2r[7] * W3r) - (s2i[7] * W3i);
        Yi[3] = (s2r[7] * W3i) + (s2i[7] * W3r);
// complex addition for A + BWn
        for(i=0;i<4;i++)
        {
                Xr[i] = s2r[i] + Yr[i];
                Xi[i] = s2i[i] + Yi[i];
        }
// complex subtraction for A - BWn
        j=0;
        for(i=4;i<8;i++)
        {
                Xr[i] = s2r[j] - Yr[j];
                Xi[i] = s2i[j] - Yi[j];
                j++;
        }
// sending output array to memory location        
for(i=0;i<8;i++)
        {      
                *Seq_out ++= Xr[i];
        }
        for(;;);
}
void Bit_reversal()
{
        xr[0] = tr[0];
        xr[1] = tr[4];
        xr[2] = tr[2];
        xr[3] = tr[6];
        xr[4] = tr[1];
        xr[5] = tr[5];
        xr[6] = tr[3];
        xr[7] = tr[7];
        xi[0] = ti[0];
        xi[1] = ti[4];
        xi[2] = ti[2];
        xi[3] = ti[6];
        xi[4] = ti[1];
        xi[5] = ti[5];
        xi[6] = ti[3];
        xi[7] = ti[7];
}

Result

Thus, the 8 point IDFT of given complex value has performed and the result is stored at memory location(0xC0001000).

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.