This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Installing TI dsplib in CCS6

Expert 1940 points
Other Parts Discussed in Thread: SYSBIOS, MATHLIB

Hi,

I am trying to run a example code in dsplib using CCS6.

Looks like CCS6 did find out that there is a new package available and prompted me if that need to be installed.

I let it install DSPLIB.

Then I imported the example CCS project 'FFT_SP_Example_66_LE_ELF' successfully, but when I try to build it, it is generating some build errors.

My question is can I directly install DSPLIB latest packages to CCS6 and also can I directly import the examples as CCS project into CCS6 and be able to build them?

-Girish

  • Did you do "copy to workspace" when you imported the project? That may have introduced some path errors. Can you paste the build output here or attach it as a file?
  • After searching in the forum, I followed the steps in the thread below and was able to build sample code successfully.

    https://e2e.ti.com/support/development_tools/code_composer_studio/f/81/t/88704

    However, I found that the example project is not a RTSC project. Now I am trying to build the example code file as part of my existing custom RTSC project and I am getting some linker errors. I am pasting error build log below. If it is something obvious as to why I am getting these errors, please let me know.

    gmake[1]: Nothing to be done for `all'.
    gmake[1]: Leaving directory `/home/xyz/workspace_v6_1/dsp-fft/src/sysbios'
    Build of libraries done.
    cle66 package/cfg/rpmsg_transport_pe66.c ...
    Finished building: ../rpmsg_transport.cfg

    Building file: ../fft_example_sp.c
    Invoking: C6000 Compiler
    "/home/xyz/ti/TI_CGT_C6000_7.2.12/bin/cl6x" -mv6600 -g --include_path="/home/xyz/ti/TI_CGT_C6000_7.2.12/include" --include_path="/home/xyz/ti/dsplib_c66x_3_4_0_0/packages" --include_path="/home/xyz/ti/mathlib_c66x_3_1_1_0/packages" --display_error_number --diag_warning=225 --abi=eabi --preproc_with_compile --preproc_dependency="fft_example_sp.pp" --cmd_file="./configPkg/compiler.opt" "../fft_example_sp.c"
    "../fft_example_sp.c", line 191: warning #225-D: function declared implicitly
    Finished building: ../fft_example_sp.c

    Building target: dsp-fft.xe66
    Invoking: C6000 Linker
    "/home/xyz/ti/TI_CGT_C6000_7.2.12/bin/cl6x" -mv6600 -g --display_error_number --diag_warning=225 --abi=eabi -z -m"dsp-fft.map" --stack_size=0x800 --heap_size=0x800 --warn_sections --display_error_number -i"/home/xyz/ti/TI_CGT_C6000_7.2.12/lib" -i"/home/xyz/ti/dsplib_c66x_3_4_0_0/packages" -i"/home/xyz/ti/mathlib_c66x_3_1_1_0/packages" -i"/home/xyz/ti/TI_CGT_C6000_7.2.12/include" --reread_libs --xml_link_info="dsp-fft_linkInfo.xml" --rom_model -o "dsp-fft.xe66" "./fft_example_sp.obj" -l"./configPkg/linker.cmd" -l"libc.a"
    <Linking>

    undefined first referenced
    symbol in file
    --------- ----------------
    DSPF_sp_fftSPxSP ./fft_example_sp.obj
    ti_ipc_remoteproc_ResourceTable /home/xyz/workspace_v6_1/dsp-fft/Debug/configPkg/package/cfg/rpmsg_transport_pe66.oe66

    error #10234-D: unresolved symbols remain
    error #10010: errors encountered during linking; "dsp-fft.xe66" not
    built

    >> Compilation failure
    gmake: *** [dsp-fft.xe66] Error 1
    gmake: Target `all' not remade because of errors.

    **** Build Finished ****

  • Girish Tummala said:
    However, I found that the example project is not a RTSC project. Now I am trying to build the example code file as part of my existing custom RTSC project and I am getting some linker errors

    Is it required to use "the RTSC method"?  It looks like you're using Mathlib "the regular method".  Either way should be fine.

    Can you summarize how up updated the cfg file to utilize DSPLib (e.g. have you done that yet with a "useModule" or similar)?  Have you looked in the Project Properties under the General properties in the "RTSC" tab?  There should be dsplib listed there if it has already been detected by CCS so you would have to check it to have it be included in the RTSC search path.

  • My custom project that I have been working before is a RTSC project.

    Eventually I want to be able to use the DSPLIB FFT apis and call them in my code in that custom RTSC project.

    For this reason, I decided to first build the example code file in my RTSC project, as a first step.

    Brad Griffis said:
    Can you summarize how up updated the cfg file to utilize DSPLib (e.g. have you done that yet with a "useModule" or similar)? 

    I have not updated my config file, infact the config file I am using now is the one I got from IPC sample code (rpmsg_transport.cfg)

    Brad Griffis said:
    Have you looked in the Project Properties under the General properties in the "RTSC" tab?  There should be dsplib listed there if it has already been detected by CCS so you would have to check it to have it be included in the RTSC search path.

    Yes, I have DSPLIB C66x -> 3.4.0.0 checked in the RTSC tab. I was under the assumption that just doing this should be sufficient and any other config file changes are not needed. Am I wrong in assuming that?

    Also, I am thinking the link errors I am getting might be related to some #pragmas in the example code file.

    /* Align the tables that we have to use */
    #pragma DATA_ALIGN(x_ref, 8);
    float x_ref [2*N];

    #pragma DATA_ALIGN(x_sp, 8);
    float x_sp [2*N];
    #pragma DATA_ALIGN(y_sp, 8);
    float y_sp [2*N];
    #pragma DATA_ALIGN(w_sp, 8);
    float w_sp [2*N];

    Am I supposed to do something to align data?

  • Girish Tummala said:
    I was under the assumption that just doing this should be sufficient and any other config file changes are not needed. Am I wrong in assuming that?

    That just adds the package to the XDC search path.  You still have to add a "useModule" statement to the cfg file to actually pull it into your project.

    Girish Tummala said:
    Also, I am thinking the link errors I am getting might be related to some #pragmas in the example code file.

    I think the pragmas are unrelated.

  • I added useModule statement to the cfg file and then I saw a different error.

    s: "/home/xyz/workspace_v6_1/FFT_SP_Example/app.cfg", line 18: xdc.services.global.XDCException: xdc.PACKAGE_NOT_FOUND: can't locate the package 'ti.mas.swtools' along the path:


    I searched in the forum and I think there is an issue with the MATHLIB package.

    https://e2e.ti.com/support/embedded/tirtos/f/355/t/319634

    I am using DSPLIB 3.4.0.0 and MATHLIB 3.1.1.0 and there is not 'mas' directory in MATHLIB package.

    So following the thread, I downgraded MATHLIB to version 3.0.1.1. After doing this I am not seeing this package not found error (the installed MATHLIB 3.0.1.1 has a 'mas' directory), but I am seeing another compile error.

    Invoking: C6000 Compiler
    "/home/xyz/ti/TI_CGT_C6000_7.2.12/bin/cl6x" -mv6600 -g --include_path="/home/xyz/ti/TI_CGT_C6000_7.2.12/include" --include_path="/home/xyz/ti/dsplib_c66x_3_4_0_0/packages" --include_path="/home/xyz/ti/mathlib_c66x_3_1_1_0/packages" --display_error_number --diag_warning=225 --abi=eabi --preproc_with_compile --preproc_dependency="fft_example_sp.pp" --cmd_file="./configPkg/compiler.opt" "../fft_example_sp.c"
    "/home/xyz/ti/dsplib_c66x_3_4_0_0/packages/ti/dsplib/src/DSPF_dp_lud/DSPF_dp_lud.h", line 43: fatal error #5: could not open source file "ti/dsplib/src/DSPF_dp_lud/c66/DSPF_dp_lud.h"

    After digging through the forums again, I found this thread which discussed having the same issue, but the thread shows no resolution. At this point, I think I have my CCS project is configured correctly with all the required path set properly. Do you know any possible resolution to this compile errors?

    Also why am I not able to use the latest packages DSPLIB 3.4.0.0 and MATHLIB 3.1.1.0? Are these validated for Linux?

    -Girish

  • If you had everything building with MathLib in the first place, please do NOT add stuff to the cfg file related to MathLib or you're going to introduce more errors related to "double inclusion".  Let's focus on DSPLib.  First, please specify exactly what you added to your cfg file and the corresponding error.  The errors you showed look like they're related to MathLib.

  • OK, in an attempt to start fresh, I just imported the example CCS project, FFT_SP_Example_66_LE_ELF from "/dsplib_c66x_3_4_0_0/examples" and tried building it without making any changes and I am still seeing the same errors, that I got before.

    "/home/xyz/ti/dsplib_c66x_3_4_0_0/examples/fft_sp_ex/fft_example_sp.c", line 51: fatal error #5: could not open source file "ti/dsplib/dsplib.h"

    Have you by any chance tried the same thing on your side and are able to build without any errors?

    -Girish

  • When I installed dsplib_c66x_3_4_0_0, there is a 'component' directory inside the dsplib root directory which has 'ti_dsplib_src_c66x_3_4_0_0.zip' file. I extracted this archive file and saw that it is the dsplib package itself with some examples.

    I am able to build examples successfully from this archive, when I import them in CCS v6.1.

    The thing I don't understand is, the dsplib I installed is version 3_4_0_0 and this zip file came along with the installation and is also named as the same verison 3_4_0_0, but there are so many differences among the files. Even the example files are different.

    Could you help me make sense of any of this?

    What is the purpose of this zip file inside the main installation? Why is this different, but still says verison 3_4_0_0?

    And why did the zip file compile and link without any issues, where as the root installation failed to link?

    -Girish

  • When I installed dsplib_c66x_3_4_0_0, there is a 'component' directory inside the dsplib root directory which has 'ti_dsplib_src_c66x_3_4_0_0.zip' file. I extracted this archive file and saw that it is the dsplib package itself with some examples.

    I am able to build examples successfully from this archive, when I import them in CCS v6.1.

    The thing I don't understand is, the dsplib I installed is version 3_4_0_0 and this zip file came along with the installation and is also named as the same verison 3_4_0_0, but there are so many differences among the files. Even the example files are different.

    Could you help me make sense of any of this?

    What is the purpose of this zip file inside the main installation? Why is this different, but still says verison 3_4_0_0?

    And why did the zip file compile and link without any issues, where as the root installation failed to link?

    -Girish
  • Girish Tummala said:

    The thing I don't understand is, the dsplib I installed is version 3_4_0_0 and this zip file came along with the installation and is also named as the same verison 3_4_0_0, but there are so many differences among the files. Even the example files are different.

    I just tried the following using both the Windows version of the download as well as the Linux version:

    1. Install 66x dsplib 3.4.0.0.
    2. Extract components/ti_dsplib_src_c66x_3_4_0_0.zip.
    3. Compare dsplib_c66x_3_4_0_0/components/ti with dsplib_c66x_3_4_0_0/packages/ti.

    Both cases (Windows and Linux) showed all 3278 files to be identical.  The only explanation that comes to mind is that perhaps your initial download was corrupt, but the contained zip file retained its integrity.  Can you check the md5sum of the installer?  Should be:

    66785604729c153dcad5282097dee8bf  ./exports/dsplib_c66x_3_4_0_0_Linux.bin

    FYI, the md5sums are listed on the download page for dsplib.  That's where I got the info above, and checking the version I downloaded I confirm that is the case.

  • I should have been clear in my earlier message, I was referring to examples being different. 
    I verified the md5sum and it is same as what you mentioned in your post. Also when I compared both the packages they are the same. Thanks for checking them on your side.


    Now I am able to build and run the example code 'DSPF_sp_fftSPxSP_d.c' in CCS6. This is the output I am getting when I run this code.

    DSPF_sp_fftSPxSP Iter#: 1 Intrinsic Successful SA Successful N = 8 radix = 2 natC: 6845 optC: 4177 SA: 1787
    DSPF_sp_fftSPxSP Iter#: 2 Intrinsic Successful SA Successful N = 16 radix = 4 natC: 8957 optC: 3762 SA: 1281
    DSPF_sp_fftSPxSP Iter#: 3 Intrinsic Successful SA Successful N = 32 radix = 2 natC: 19988 optC: 7624 SA: 3050
    DSPF_sp_fftSPxSP Iter#: 4 Intrinsic Successful SA Successful N = 64 radix = 4 natC: 36554 optC: 15411 SA: 5811
    DSPF_sp_fftSPxSP Iter#: 5 Intrinsic Successful SA Successful N = 128 radix = 2 natC: 87995 optC: 37349 SA: 14067
    DSPF_sp_fftSPxSP Iter#: 6 Intrinsic Successful SA Successful N = 256 radix = 4 natC: 169796 optC: 77265 SA: 28167
    DSPF_sp_fftSPxSP Iter#: 7 Intrinsic Successful SA Successful N = 512 radix = 2 natC: 403220 optC: 185274 SA: 66840
    DSPF_sp_fftSPxSP Iter#: 8 Intrinsic Successful SA Successful N = 1024 radix = 4 natC: 785960 optC: 384185 SA: 137404
    Memory: -1793984836 bytes
    Cycles: 14067 (N=128) 28167 (N=256)


    In the output printfs, I am seeing that the memory is reported as negative number of bytes. But since the output says successful, I am assuming it did run FFT on the sample values successfully.

    Also, just to validate FFT, I modified the sample code to copy the FFT output returned by 'DSPF_sp_fftSPxSP_cn()' and provide it as input to inverse FFT function 'DSPF_sp_ifftSPxSP_cn()'. I expected that the output of inverse FFT function will closely match the original sample values that are provided as input to FFT function. But that is not what I am seeing.

    Am I correct in doing this validation by passing FFT output to iFFT function? Is there any other way to validate if the FFT function is actually transforming the sample input values?

    Thanks.

  • Girish Tummala said:
    I should have been clear in my earlier message, I was referring to examples being different. 

    I compared the entire directory structure after I unzipped.  Everything was identical.  Can you name a specific file that is different?

    Girish Tummala said:
    Am I correct in doing this validation by passing FFT output to iFFT function?

    I don't see any issue there.  I believe something is wrong if you're not getting back your original sequence.

  • Brad Griffis said:
    I compared the entire directory structure after I unzipped.  Everything was identical.  Can you name a specific file that is different?

    I think I might have compared the dsplib library that I downloaded from http://www.ti.com/tool/sprc265 

  • Brad Griffis said:
    I compared the entire directory structure after I unzipped.  Everything was identical.  Can you name a specific file that is different?

    I think I might have compared the dsplib library that I downloaded from http://www.ti.com/tool/sprc265 to the zip file.

    At that time I did not realize that zip file is the actual package, instead I thought it is the entire dsplib library. This is clearly a misunderstanding on my side.

    And for the example, I was comparing 'dsplib_c66x_3_4_0_0/examples/fft_sp_ex/fft_example_sp.c' and

    'ti/dsplib/src/DSPF_sp_fftSPxSP/c66/DSPF_sp_fftSPxSP_d.c'.

    But now I understand that both of these are two different examples showing the usage of "DSPF_sp_fftSPxSP()".

    So I think this is a non issue now.

    However I would like you to take a look at the changes I made to "DSPF_sp_fftSPxSP_d.c" to call Inverse FFT function.

    I will attach my code file to this post.

    DSPF_sp_fftSPxSP_d.c
    /* ======================================================================== */
    /* DSPF_sp_fftSPxSP_d.c -- Complex Forward FFT with Mixed Radix             */
    /*                Driver code; tests kernel and reports result in stdout    */
    /*                                                                          */
    /* Rev 0.0.3                                                                */
    /*                                                                          */
    /* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/   */ 
    /*                                                                          */
    /*                                                                          */
    /*  Redistribution and use in source and binary forms, with or without      */
    /*  modification, are permitted provided that the following conditions      */
    /*  are met:                                                                */
    /*                                                                          */
    /*    Redistributions of source code must retain the above copyright        */
    /*    notice, this list of conditions and the following disclaimer.         */
    /*                                                                          */
    /*    Redistributions in binary form must reproduce the above copyright     */
    /*    notice, this list of conditions and the following disclaimer in the   */
    /*    documentation and/or other materials provided with the                */
    /*    distribution.                                                         */
    /*                                                                          */
    /*    Neither the name of Texas Instruments Incorporated nor the names of   */
    /*    its contributors may be used to endorse or promote products derived   */
    /*    from this software without specific prior written permission.         */
    /*                                                                          */
    /*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS     */
    /*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT       */
    /*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR   */
    /*  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT    */
    /*  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,   */
    /*  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT        */
    /*  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,   */
    /*  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY   */
    /*  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT     */
    /*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE   */
    /*  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.    */
    /*                                                                          */
    /* ======================================================================== */
    
    #include <xdc/runtime/System.h>
    
    #include <stdio.h>
    #include <time.h>
    #include <stdlib.h>
    #include <limits.h>
    //#include <math.h>
    #include <c6x.h>
    
    #include <ti/mathlib/mathlib.h>
    #include "DSPF_sp_fftSPxSP.h"
    #include "DSPF_sp_fftSPxSP_opt.h"
    #include "DSPF_sp_fftSPxSP_cn.h"
    
    /* Defines */
    #if defined(__TI_EABI__)
    #define kernel_size _kernel_size
    #endif
    extern char kernel_size;
    
    #define CYCLE_FORMULA_NX_PT1  128
    #define CYCLE_FORMULA_NX_PT2  256
    #define FORMULA_SIZE          2
    int     form_cycle [FORMULA_SIZE];
    
    void tw_gen    (float *w, int n);
    
    /* ======================================================================== */
    /*  Kernel-specific alignments                                              */
    /* ======================================================================== */
    #pragma DATA_ALIGN(x_i,  8);
    #pragma DATA_ALIGN(x_sa, 8);
    #pragma DATA_ALIGN(x_cn, 8);
    #pragma DATA_ALIGN(x_cn_orig, 8);
    #pragma DATA_ALIGN(x_tmp, 8);
    
    #pragma DATA_ALIGN(w,    8);
    
    #pragma DATA_ALIGN(y_i,  8);
    #pragma DATA_ALIGN(y_sa, 8);
    #pragma DATA_ALIGN(y_cn, 8);
    #pragma DATA_ALIGN(y_cn_inv, 8);
    #pragma DATA_ALIGN(brev, 8);
    
    /* ======================================================================== */
    /*  Parameters of fixed dataset.                                            */
    /* ======================================================================== */
    #define MAXN (1024)
    #define M    (2*MAXN)
    #define PAD  (16)
    #define F_TOL (1e-06)
    /* ======================================================================== */
    /*  Initialized arrays with fixed test data.                                */
    /* ======================================================================== */
    
    float x_i [M + 2 * PAD];
    float x_sa[M + 2 * PAD];
    float x_cn[M + 2 * PAD];
    float x_cn_orig[M + 2 * PAD];
    float x_tmp[M + 2 * PAD];
    
    float w   [M + 2 * PAD];
    
    float y_i [M + 2 * PAD];
    float y_sa[M + 2 * PAD];
    float y_cn[M + 2 * PAD];
    float y_cn_inv[M + 2 * PAD];
    
    /* ======================================================================== */
    /*  Generate pointers to skip beyond array padding                          */
    /* ======================================================================== */
    float *const ptr_x_i  = x_i  + PAD;
    float *const ptr_x_sa = x_sa + PAD;
    float *const ptr_x_cn = x_cn + PAD;
    float *const ptr_x_cn_orig = x_cn_orig + PAD;
    float *const ptr_x_tmp = x_tmp + PAD;
    
    float *const ptr_w    = w    + PAD;
    
    float *const ptr_y_i  = y_i  + PAD;
    float *const ptr_y_sa = y_sa + PAD;
    float *const ptr_y_cn = y_cn + PAD;
    float *const ptr_y_cn_inv = y_cn_inv + PAD;
    
    unsigned char brev[64] = {
        0x0, 0x20, 0x10, 0x30, 0x8, 0x28, 0x18, 0x38,
        0x4, 0x24, 0x14, 0x34, 0xc, 0x2c, 0x1c, 0x3c,
        0x2, 0x22, 0x12, 0x32, 0xa, 0x2a, 0x1a, 0x3a,
        0x6, 0x26, 0x16, 0x36, 0xe, 0x2e, 0x1e, 0x3e,
        0x1, 0x21, 0x11, 0x31, 0x9, 0x29, 0x19, 0x39,
        0x5, 0x25, 0x15, 0x35, 0xd, 0x2d, 0x1d, 0x3d,
        0x3, 0x23, 0x13, 0x33, 0xb, 0x2b, 0x1b, 0x3b,
        0x7, 0x27, 0x17, 0x37, 0xf, 0x2f, 0x1f, 0x3f
    };
    
    int fltcmp (const float *y1, const float *y2, int n, float tol)
    {
    	int i;
    	int flag = 0;
    
    	for (i = 0; i < n; i++)
    	{
    		if (abs (y1[i] - y2[i]) > tol)
    			flag = 1;
    	}
    	return flag;
    
    }
    
    /* ======================================================================== */
    /*  MAIN -- Top level driver for the test.                                  */
    /* ======================================================================== */
    
    void main_driver ()
    {
        int i, j, rad, N, k;
        clock_t t_start, t_stop, t_overhead, t_opt, t_i, t_cn;
        float pct_diff, max_pct_diff = 0;
    
        for (N = 8, k = 1; N <= MAXN; N = N * 2, k++)
        {
        	if(N<1024)
        	{
        		continue; //We will just run N=1024 case
        	}
    
            memset (x_i,  0x55, sizeof (x_i) );
            memset (x_sa, 0x55, sizeof (x_sa));
            memset (x_cn, 0x55, sizeof (x_cn));
            memset (x_cn_orig, 0x55, sizeof (x_cn_orig));
            memset (x_tmp, 0x55, sizeof (x_tmp));
    
            /* ---------------------------------------------------------------- */
            /* Initialize input vector temporarily.                             */
            /* ---------------------------------------------------------------- */
            for (i = 0; i < N; i++)
            {
                x_cn[PAD + 2 * i]     = sinsp (2 * 3.1415 *  50 * i / (double) N);
                x_cn[PAD + 2 * i + 1] = sinsp (2 * 3.1415 * 100 * i / (double) N);
                x_sa[PAD + 2 * i]     = x_cn[PAD + 2 * i];
                x_sa[PAD + 2 * i + 1] = x_cn[PAD + 2 * i + 1];
                x_i [PAD + 2 * i]     = x_cn[PAD + 2 * i];
                x_i [PAD + 2 * i + 1] = x_cn[PAD + 2 * i + 1];
            }
    
            /* ---------------------------------------------------------------- */
            /* Force uninitialized arrays to fixed values.                      */
            /* ---------------------------------------------------------------- */
            memset (y_i,  0xA5, sizeof (y_i) );
            memset (y_sa, 0xA5, sizeof (y_sa));
            memset (y_cn, 0xA5, sizeof (y_cn));
            memset (y_cn_inv, 0xA5, sizeof (y_cn_inv));
    
            /* ---------------------------------------------------------------- */
            /* Initialize timer for clock */
            TSCL= 0,TSCH=0;
            /* Compute the overhead of calling _itoll(TSCH, TSCL) twice to get timing info */
            /* ---------------------------------------------------------------- */
            t_start = _itoll(TSCH, TSCL);
            t_stop = _itoll(TSCH, TSCL);
            t_overhead = t_stop - t_start;
    
            /* ---------------------------------------------------------------- */
            /* Generate twiddle factors.                                        */
            /* ---------------------------------------------------------------- */
            j = 0;
            for (i = 0; i <= 31; i++)
                if ((N & (1 << i)) == 0)
                    j++;
                else
                    break;
    
            if (j % 2 == 0)
                rad = 4;
            else
                rad = 2;
    
            tw_gen (ptr_w, N);
    
        	// store CompleFFT out in pTemp..
        	memcpy (ptr_x_cn_orig, ptr_x_cn, ((M + 2 * PAD) * sizeof (float)));
            System_printf("DSPF_sp_fftSPxSP\tIter#: %d\t", k);
            t_start = _itoll(TSCH, TSCL);
            DSPF_sp_fftSPxSP_cn (N, &ptr_x_cn[0], &ptr_w[0], ptr_y_cn, brev, rad, 0, N);
            t_stop = _itoll(TSCH, TSCL);
            t_cn = (t_stop - t_start) - t_overhead;
            System_printf("Clocks for %d Complex FFT = %d\n", N, t_cn);
        	// store CompleFFT out in pTemp..
        	memcpy (ptr_x_tmp, ptr_y_cn, ((M + 2 * PAD) * sizeof (float)));
        	// Inverse FFT Calculation..
        	DSPF_sp_ifftSPxSP_cn (N, ptr_x_tmp, &ptr_w[0], ptr_y_cn_inv, brev, rad, 0, N);
        	System_printf ("Complex FFT Reconstruction for Natural C:");
        	if (fltcmp (ptr_x_cn_orig, ptr_y_cn_inv, 2 * N, F_TOL))
        		System_printf ("**FAIL**\n\n");
        	else
        		System_printf ("##PASS##\n\n");
    
    
        	t_start = _itoll(TSCH, TSCL);
            DSPF_sp_fftSPxSP_opt (N, &ptr_x_i[0], &ptr_w[0], ptr_y_i, brev, rad, 0, N);
            t_stop = _itoll(TSCH, TSCL);
            t_i = (t_stop - t_start) - t_overhead;
    
            t_start = _itoll(TSCH, TSCL);
    #ifdef __TI_COMPILER_VERSION__            // for TI compiler only
            DSPF_sp_fftSPxSP (N, &ptr_x_sa[0], &ptr_w[0], ptr_y_sa, brev, rad, 0, N);
    #endif
            t_stop = _itoll(TSCH, TSCL);
            t_opt = (t_stop - t_start) - t_overhead;
    
            /* ---------------------------------------------------------------- */
            /* compute percent difference and track max difference              */  
            /* ---------------------------------------------------------------- */
            pct_diff = 0; max_pct_diff = 0;
            for(i=0; i<N; i++) {
              pct_diff = (ptr_y_cn[i] - ptr_y_i[i]) / ptr_y_cn[i] * 100.0;
              if (pct_diff < 0) pct_diff *= -1;
              if (pct_diff > max_pct_diff) max_pct_diff = pct_diff;
            }
            if (max_pct_diff > 0.001)
                System_printf("Intrinsic Failure  max_pct_diff = %f", max_pct_diff);
            else
                System_printf("Intrinsic Successful ");
    
            pct_diff = 0; max_pct_diff = 0;
            for(i=0; i<N; i++) {
              pct_diff = (ptr_y_cn[i] - ptr_y_sa[i]) / ptr_y_cn[i] * 100.0;
              if (pct_diff < 0) pct_diff *= -1;
              if (pct_diff > max_pct_diff) max_pct_diff = pct_diff;
            }
            if (max_pct_diff > 0.001)
                System_printf("SA Failure  max_pct_diff = %f", max_pct_diff);
            else
                System_printf("SA Successful ");
    
            System_printf("\tN = %d\tradix = %d\tnatC: %d\toptC: %d\tSA: %d\n", N, rad, t_cn, t_i, t_opt);
    
            if (N == CYCLE_FORMULA_NX_PT1)
              form_cycle[0] = t_opt;
            if (N == CYCLE_FORMULA_NX_PT2)
              form_cycle[1] = t_opt;
    
        }
    
        /* Provide memory information */
    #ifdef __TI_COMPILER_VERSION__            // for TI compiler only
        System_printf("Memory:  %d bytes\n", &kernel_size);
    #endif
    
        /* Provide profiling information */
        System_printf("Cycles:  %d (N=128) %d (N=256)\n", form_cycle[0], form_cycle[1]);
    }
    
    /* Function for generating Specialized sequence of twiddle factors */
    void tw_gen (float *w, int n)
    {
        int i, j, k;
        const double PI = 3.141592654;
    
        for (j = 1, k = 0; j <= n >> 2; j = j << 2)
        {
            for (i = 0; i < n >> 2; i += j)
            {
    #ifdef _LITTLE_ENDIAN
                w[k]     = (float) sin (2 * PI * i / n);
                w[k + 1] = (float) cos (2 * PI * i / n);
                w[k + 2] = (float) sin (4 * PI * i / n);
                w[k + 3] = (float) cos (4 * PI * i / n);
                w[k + 4] = (float) sin (6 * PI * i / n);
                w[k + 5] = (float) cos (6 * PI * i / n);
    #else
                w[k]     = (float)  cos (2 * PI * i / n);
                w[k + 1] = (float) -sin (2 * PI * i / n);
                w[k + 2] = (float)  cos (4 * PI * i / n);
                w[k + 3] = (float) -sin (4 * PI * i / n);
                w[k + 4] = (float)  cos (6 * PI * i / n);
                w[k + 5] = (float) -sin (6 * PI * i / n);
    #endif
                k += 6;
            }
        }
    }
    /* ======================================================================= */
    /*  End of file:  DSPF_sp_fftSPxSP_d.c                                     */
    /* ----------------------------------------------------------------------- */
    /*            Copyright (c) 2011 Texas Instruments, Incorporated.          */
    /*                           All Rights Reserved.                          */
    /* ======================================================================= */
    

    Let me know if I am missing something in the code, that is effecting the inverse FFT output.

    Thanks,

    Girish