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.

question:using TMS320C64x DSP Library

Other Parts Discussed in Thread: SPRC542, CCSTUDIO

I have questions about the data multiplication and division computing in TMS320C64x DSP Library.
1, I want to keep the data computing including addition, subtraction,multiplication and division.
The data I have is integer 16bit while the result of the multiplication and division is 32bit such as

“int  DSP_dotprod(const short * restrict x, const short * restrict y, int nx)”.
Therefore I must use the result(32bit) of “DSP_dotprod(*)” to do addition or subtraction computing with other data(16bit). How can I fix this issue.
2, In c64x DSP library datasheet, there is saying: unless
specifically noted, DSPLIB functions use Q15 format. How can I change the
Q value, by which route?

P.S. The DSP chipset I use: TMS320C6416TG1Z

Thanks and Best Regards

  • Hi,

    If you see on page 15 of:

    http://focus.ti.com/general/docs/techdocsabstract.tsp?abstractName=sprueb8b

    The result of DSP_dotprod will be 32 bits, and that means Q31. So you can just shift the result 15 bits and you get a Q15:

     z = DSP_dotprod(x,y,n);
     z = z>>15;

     

  • [:)]Get  your point, you are correct, thanks a lot firstly.

    1, The guided file you mentioned is about the c64x+, while the type I used is c64x. There are some differences in hardware side. Therefore I choose the lib(dsp64x.lib) only used in c64x. Is c64x+.lib ok here?.

    2, For the dsp64x.lib, all the math functions are about the array and the vector, there is no function in dsp64x.lib  datasheet mentioning the element computing such as the add, minus for elements in array or vector. How to handle the element itself computing,  just "+,-,*,/" by C language?

    3, The original data type I want to compute is float. I choose the Q value(=5), i.e., change the data from float to integer and then let the DSP(c6416) compute. The Q value in dsp64x.lib is 15 by default. The problems exists if using dsp64x.lib . Could you let me know how I can fix this issue?

    Thanks for your attention and appreciate if get your comments.

    Best Regards

  • By the way, the datasheet I use is TMS320C64x DSP Library Programmer’s Reference(SPRU565B). I will also read SPEC of the c64x+.lib carefully. In c64x+.lib, since there is IQmath about element mathematical compute.

    Hope to get your comments, thanks indeed.

    Best Regards

  • Hi, Mariana:

     

       As I know, the dsp64x.lib/ dsp64xe.lib are for the fixed point computing and I have also looked into the fastrts64x.lib/ fastrts64xe.lib (for the data of float type computing).

       Run the examples (using the dsp64x.lib/ dsp64xe.lib) in my CCS environment, result is OK. But no example is for fastrts64x.lib/ fastrts64xe.lib. I can not still get the solution about the above issue. Hope to get your comments.

     

    Best Regards

  • wqyhandsome said:
    1, The guided file you mentioned is about the c64x+, while the type I used is c64x. There are some differences in hardware side. Therefore I choose the lib(dsp64x.lib) only used in c64x. Is c64x+.lib ok here?.

    I pointed you to the wrong guide, for C6416 that you are using you should use the C64x library. Sorry for missing that.

    wqyhandsome said:
    2, For the dsp64x.lib, all the math functions are about the array and the vector, there is no function in dsp64x.lib  datasheet mentioning the element computing such as the add, minus for elements in array or vector. How to handle the element itself computing,  just "+,-,*,/" by C language?

    Yes, that the basic operations are C standard.

    wqyhandsome said:
    3, The original data type I want to compute is float. I choose the Q value(=5), i.e., change the data from float to integer and then let the DSP(c6416) compute. The Q value in dsp64x.lib is 15 by default. The problems exists if using dsp64x.lib . Could you let me know how I can fix this issue?

    Not sure if I understand the question. But the DSPLIB functions are expecting Q15 (and sometimes Q31), so you need to use the format specified.

     

  • Dear Mariana:

               I see, thank you for your comments.

    Best Regards

  • Did you look at the library here: http://focus.ti.com/docs/toolsw/folders/print/sprc542.html it lets you control the Q point for variables.

    I understand you need the support on 64x. The library currently only supports 64x+. But, if the library seems useful to you, we can provide the C64x version as well

    Gagan

  • Hi Gagan:

         Thanks for your information. you are right, I want to keep the Q value variable in my application; and the IQmath in C64x+.lib can change the Q value . As I know, the C64x+ is different from C64x and I used to run a example(C64x+) in my CCS(Version:2.2) environment. I failed. Hope to get the C64x version(example better, I will run it in my CCS environment).

    Thanks for your support and Best regards

  • Hi Gagan:

       In my application, the data type is defined in unsigned int. According to the datasheet(TMS320C6000 Programmer's Guide_SPRU198G), the size of (int/unsigned int) is 32 bit.

       As I known from datasheet(TMS320C64X+ IQmath Library_SPRUGG9) as you suggested, the input and the output if the IQmath function are typical 32bit fixed point and the Q value can be changed. Thefore, I can use the typedef int _iq5 in my application.

       For data type, the functions in the c64x+ IQmath.lib are OK for me.

       Hope to get IQmath library fit in c64x (not c64x+).

       Many Thanks and Best Regards

     

  • Attached. Let me know if you face any issues.

    Gagan

    IQmath_c64x_v212.zip
  • Thanks, I will try it and show you my result about this *.lib.

    Best Regards

  • In the attached file, it is only IQmath_c64x_v212.lib.

    1, As I know, there are two Endianness: Little and Big. Which is Endianness the *.lib for, Little or Big?

    2, I tried the example used for the c64x+ (C64x+ IQMath Library - A Virtual Floating Point Engine_SPRC542); for the library, I removed the c64x+.lib and use the IQmath_c64x_v212.lib instead.

    (1), I have tried the example (dotprod, FFT, and the FIR) in CCS (version 2.2) environment (simulator and also Emulator);

    (2), All examples can not pass, (seems the file: tsc_h.asm in each example only used in c64x+), the main error message as follows:

    Warning: invalid option -+ (ignored) à I can not understand it clearly.

    Error:  Illegal mnemonic specified.

              Unexpected parallel instruction

              Operand #1, TSCH/TSCL, not legal: register

    3, Could you let me try a example about the library in c64x? I can not use the library immediately in my application because of other issues (the data be transmitted to the board (DSP chipset embedded) can not work smoothly- wrong data exists randomly.

     

     

     

     

     

  • It is little endian lib. If you need big endian as well, please let me know.
    TSCH/TSCL are 64x+ specific extensions and that is the cause of errors. Follow below steps to have dotprod example working correctly.

    Lib_RAM_tables CCS Configuration
    * Change the 'Target Version' in project build options to C64xx.
    * Remove the tsc_h.asm from project
    * Modify the _d file to remove usage of tsc. The file (attached with next post) now uses Clock APIs that will only work on Simulator. On CCS, Click on Profile->Clock->Enable
    * Remove the other libs and use the little endian lib attached with this post
    * Build and run the pjt and it should work fine

    Gagan

     

     

     

     

    IQmath_c64x_v212_v2.0.zip
  • attached the driver file. NOTE, I included the big endian lib as well in the zip provided with the previous post.

     

  • Hi Gagan:

         I have tried the example (dotprod) in CCS_simulator and followed the steps you suugested. Something may be still wrong with the SECTION setting in cmd_linker file and needed library. Below information is my test results for your reference.

        1, Still warning: invalid option -+(ignored)<--when compile

            * I can not fix the warning or not get its clear meaning either

        2, cmd_linker file: dotprod_IQ.cmd error: can not find input file 'rts64plus.lib <--when build

            * I tried to add the rts6400.lib in the project, and change the "-lrts64plus.lib(.text)"into"lrts6400.lib(.text)", and also tried to add csl6416.lib in the project, now the error message shows: illegal relocation type 050002 found in section .debug_info, file.

     Below information is the original cmd_linker file in the c64x+ dotprod example for your reference.      

    -stack 0x2000

    -heap  0x5000

    MEMORY{

      UDRAM       : o = 0x11f04000, l = 0x00010000     /* Unitialialized Data RAM */

      ERAM        : o = 0x81000000, l = 0x00100000

      UERAM       : o = 0x81100000, l = 0x05E00000

    }

    SECTIONS{

      .text        : > ERAM

      .data        : > ERAM

      .cinit       : > ERAM

      .pinit       : > ERAM

      .const       : > ERAM

      .switch      : > ERAM

      .args        : > ERAM

      .tables      : > ERAM

      .stack       : fill=0xc0ffee > ERAM

      .reset       : > ERAM

      .csl_vect    : > ERAM

      .cio           : > ERAM

      .bss           : > ERAM

      .sysmem        : > ERAM

      .far           : > ERAM

       rts_sect: {

         -lrts64plus.lib (.text)

       } > ERAM

    }

    Many thanks for your support

    Best Regards

  • - What version of CCS are you using? What version of build tools?
    - Can you provide the exact error message that you get for issue 1 that you list?
    - RTS Lib is available here C:\CCStudio_v3.3\C6000\cgtools\lib\rts6400.lib. Use the 6400 lib instead of rts64plus.lib (I assume you already understand this) 

    Can you copy paste the exact outpit from the build process?

    Thanks and sorry for these initial troubles!

     

     

     

  • Gagan:

    Q: - What version of CCS are you using? What version of build tools?

    A: The CCS verion I use is 2.2 (not 3.3);

    Q: - Can you provide the exact error message that you get for issue 1 that you list?

    A:  The attched file is the detailed information about my issue for your reference.

    Q: - RTS Lib is available here C:\CCStudio_v3.3\C6000\cgtools\lib\rts6400.lib. Use the 6400 lib instead of rts64plus.lib (I assume you already understand this) 

    A: Yes, I have already added the c6400 lib and remove the rts64plus.lib at the same time.

    c6416 dsp.lib issue.zip
  • Please don't use the 'Inline' project build configuration. Please use Lib_RAM_tables configuration.
    I would recommend moving to latest CCS version which is CCS 3.3

    Gagan

     

  • Hi Gagan:

            I met some errors when i used the IQmath_c64x_v212_e.lib.

            Below codes are some of my program:

           inputa=_IQ15(0.999);
           inputb=_IQ15(0.9999);
           res_out=_IQ15sin(inputb);

    >> warning: creating output section $build.attributes without SECTIONS
                specification

    undefined                        first referenced
     symbol                              in file
    ---------                        ----------------
    __mpy32su                        D:\\workdir\\dspworks\\lib\\IQmath_c64x_v212_e.lib
    __mpy32us                        D:\\workdir\\dspworks\\lib\\IQmath_c64x_v212_e.lib
    __mpy32u                         D:\\workdir\\dspworks\\lib\\IQmath_c64x_v212_e.lib
    >>   error: symbol referencing errors - './Debug/my_hello.out' not built

  • Hello Wang, I think there were some intrinsics left from 64x+ in the lib. I recommend you download the c code for intrinsics from here: http://tiexpressdsp.com/index.php/Run_Intrinsics_Code_Anywhere and use for the intrinsics that you get error for. So for ex, in your case, you will need to get the source for _mpy32 instructions and link that source with your code. Let me know if you face any issues doing that.

    Gagan

     

  • Hi Wang&Gagan:

        I have met the similar situation as you mentioned when using the IQmath_c64x_v212_e.lib.The issue exists in the IQ division computing.

        Below information are for your reference:

        1,coeds in my program:

           for(i=0;i<6400;i++)
           {
            x=_IQ16mpyI32(_IQ16(sdram_data1[i]),gama);
            beta[i]=_IQ16div(x,_IQ16(Sum_R));//IQ division 

          }

    2,error message:

    >> warning: creating output section $build.attributes without SECTIONS
                specification

    undefined                        first referenced
     symbol                              in file
    ---------                        ----------------
    __mpy32su                        C:\TI\myprojects\IQmath_c64x_v212_e.lib
    >>   error: illegal relocation type 050002 found in section .debug_info, file
                C:\TI\myprojects\IQmath_c64x_v212_e.lib

    Build Complete,
      1 Errors, 1 Warnings, 0 Remarks.

    3,create a Host_Intrinsics.lib; and copy content of the C6xSimulator.c to the *.lib, add the needed *.h file at the same time and the error message also exists when doing the build step.
     (1),C:\TI\myprojects\Host_Intrinsics.lib, line 8:   error:
                   illegal input character: hex 23
    (2),Host_Intrinsics.lib:   error: can't open file 'include.obj' for input,

    I can not fix the issue or find the root cause, hope to get your suggestions.

    Thanks and Best Regards

     

  • I am not sure I understand the step 3 that you describe.
    You can simply copy the _mpy32su function from C:\Program Files\Texas Instruments\c_intrinsics_host_port\c6xsim\C6xSimulator.c to your source and that should take care of the error.
    Gagan

     

     

  • Hi Gagan:

         Thanks for your information. I follow your ideas and still have questions, hope get your kindly support again.

    1, In the uint64_ll _mpy32su(Int32 a,Uint32 b), if I understand correctly, the MIN_INT16,MIN_INT32,and the MAX_UINT16 are constant. I set them by myself as belows:(1)Int16 MIN_INT16=0;(2)Int32 MIN_INT32=0;(3)Uint16 MAX_UINT16=0xff. Could you let me know whether they are right?

    2,When finished the routine and compile in my CCS environment, the warning and error message still happened. Detailed below information is for your reference:

    >> warning: creating output section $build.attributes without SECTIONS
                specification(the warning of _mpy32su has been fixed)
    >>   error: illegal relocation type 050002 found in section .debug_info, file
                C:\TI\myprojects\IQmath_c64x_v212_e.lib

    3,I checked my cmd_linker file, and find the related setting of the C64X+ IQmath user guide file(TMS320C64x+ IQmath Library_SPRUGG9) is:

    MEMORY
    {
    ERAM_01 : o = 0x81000000, l = 0x00100000
    }
    SECTIONS
    {
    .data:IQmathTables : > ERAM_01
    .text:IQmath : > ERAM_01
    }

    In my application, The SDRAM has been configurated in EMIFA(C6416) CE0:0x8000-0000~0x8fff-ffff.I set them in my cmd_linker file as the above suggestion. it is ok?

     I can not understand the waning and the error meaasage clearly. Maybe it is also relative with my CCS version(Version 2.2), just guess. Much appreciate if get your suggestions

    Best Regards

  • For 1, please see here: C:\Program Files\Texas Instruments\c_intrinsics_host_port\c6xsim\_C6xSimulator_priv.h
    Can you please move to newer version of CCS? That may be the cause of 2.
    3 is consistent with the recommendation in UG

    Gagan

     

  • Hi Gagan,

         Yes,you are right, the different CCS version is the root cause and I have tried to run my programe in CCS3.3 simulator and it run well, no error message happened. While the CCS3.3 can not connect to our target DSP board. Since our DSP board (use the XD510 USB2.0)the can not support CCS3.3 well, its design team suggest us the CCS2.2 or the  XD560plus USB2.0(for CCS3.3 well I think).

        In my application, I need to run the program in Emulator via USB interface. By now, I have tried to run the mk6x.exe (c:\ti\c6000\cgtools\bin\mk6x.exe) and can change fastrts62x64x.src(CCS3.3 ) into the *.lib(for CCS2.2). We hope to get the *.src file for the IQmath you have supplied and we will try to change it into the *.lib to see whether it is good for our application.

    Thanks for your support and we get much important help.

    Best Regards

     

  • > We hope to get the *.src file for the IQmath you have supplied and we will try to change it into the *.lib to see whether it is good for our application.
    Can you contact your local TI representative and I can work with them to enable to such support
    Gagan

     

  • Hi Gagan:

         Thanks and I will have a try and let you know if have any results.

    Best Regards

  • Gagan:

          I have fixed the issue about the dsp.lib in c6416. The dsp.lib the ccs2.2 supported is enough for my application.

    Thanks and Best Regards

  • I encountered similar error while using the IQmath library, IQmath_c64x_v212.lib (ver. 2.0)

     

    Platform: C64X (not C64Plus)

    Enviroment: CCS 3.3

    Code:

     _iq28 a;
     _iq28 b;
     _iq28 c;
     a = _IQ28(2.5);
     b = _IQ28(1.5);
     c = _IQ28sin(a);

    warning: creating output section $build.attributes without SECTIONS
    specification

    undefined first referenced
     symbol in file
    --------- ----------------
    __mpy32su D:\\8353C41210\\Software\\TI_IQMath\\IQmath_c64x_v212.lib
    __mpy32us D:\\8353C41210\\Software\\TI_IQMath\\IQmath_c64x_v212.lib
    _IQsinTable D:\\8353C41210\\Software\\TI_IQMath\\IQmath_c64x_v212.lib
    __mpy32u D:\\8353C41210\\Software\\TI_IQMath\\IQmath_c64x_v212.lib
    error: symbol referencing errors - './Debug/VisionLocalization_d.out' not
    built

    Cmd linker command

    SECTIONS
    {
     .data:IQmathTables :> SDRAM
     .text:IQmath :> SDRAM
    }

    SECTIONS
    {
     .CusInitSect :> SDRAM
     .CusDataSDSect :> SDRAM
     .CriticalCode :> ISRAM
     .CriticalData :> ISRAM
     .CriticalPointer :> ISRAM
     PACKETMEM :> SDRAM
     MMBUFFER :> SDRAM
     OBJMEM :> SDRAM
    }
    where the SDRAM originate from 0x8000-0000 with length 0x01FF-E000

    What should I do to resolve this problem?

    Could you kindly help me out? Thanks  a lot.

     

  • Cound someone help me?

    I use the IQsinXXX function in the source code, then

     compiled and linked the program but encountered the error message below:

    >> warning: creating output section $build.attributes without SECTIONS
    specification
    undefined first referenced
    symbol in file
    --------- ----------------
    _IQsinTable D:\\8353C41210\\Software\\TI_IQMath\\IQmath_c64x_v212.lib

    It seems the library distributed doesn't inclue the IQsinTable array or something?

    How can resolve the problem?

     

     

  • Hi Yen-Ting:

         1,The CCS version.

             For example, the CCS3.3 is used better than the CCS2.2 version when using some specific *.lib. Some time, the *.lib maybe run smoothly in CCS3.3 But not CCS2.2.

         2,The board itself you designed,Jtag

             When doing the Emulator, Some application board only CCS2.2 but no CCS3.3. Therefore, even you can run your *.lib in CCS3.3, but your board Emulator can not support the CCS3.3 version. You maybe can not finish your design finally.

    Suggest you consider these two points shown above and hope it useful.

    P.S. The board I used is SEED corporation:DEC6416, CCS version:2.2 and the XD510

     Best Regards

  • I've seen that linker warning before.  But I don't recall where.  I cannot reproduce it.  If I remember correctly, it is due to a bug in the linker.  Try upgrading your compiler toolset to a later version.  These links should help.

    http://tiexpressdsp.com/index.php/Compiler_Version_Numbers_and_What_They_Mean
    http://tiexpressdsp.com/index.php/Compiler_Releases .

    Thanks and regards,

    -George

     

  • Is there the equivalent of the IQmath_RAM_c64x+.lib available for c64?  When I use the IQmath_c64x library you provided (version 2.1.2) and try to use the _IQcos function, I get undefined symbol errors for __mpy32us and _IQsinTable.  I am not able to link to the c64x+ version.  I am using the header files from the c64x+ version.  

     

    Is this library officially released anywhere?  It would be nice to grab the whole package at once.

     

    Thanks,

    Susan

  • Hi Gagan,

    I'm curious if there has been an update to the 16-bit implementation of a fixed-point library, I mean to the one you have attached in your post, for C64x devices. It would be great to have such a library fully supported by TI as I believe there could be many people looking for non-32-bit implementations (C64x+ IQMath Library - A Virtual Floating Point Engine).

    Thanks!

  • There hasn`t been an update to the IQMATH library to include 16 bit implementations and we don`t have plans in near future to add this feature. Are there any specific functions in the library that you wish to use in the16 bit implementation?

    Regards,

    Rahul

  • I'm basically looking only for the format conversion utilities and the arithmetic operations, for now, implemented in 16-bit word length. Is there any way you can help me get them? Thanks!