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.

please fix bugs in SPRU514C intrinsics

Other Parts Discussed in Thread: CONTROLSUITE

The intrinsic section, as always, suffers from extremely poor documentation.

A particular issue involves __IQmpy and  __IQxmpy. The documentation doesn't say what they do on a high level, just what instructions they are supposed to translate into.

Also the SPRU514C documentation for __IQmpy seems to have at least one bug: The code for 0 < N < 16 says there should be an LSR64, but when I assemble I get ASR64.

 

  • namely: (attempt to figure out what they did)

           L02 = __sat(__IQxmpy(L00, L01, -12));  
           L03 = __sat(__IQxmpy(L00, L01, 12));  
           L04 = __sat(__IQmpy(L00, L01, 12)); 

    which compiles to

        .dwpsn    file "build\main.cpp",line 176,column 5,is_stmt
            MOVW      DP,#_L00
            SETC      SXM
            MOVL      XT,@_L00              ; |176|
            QMPYL     ACC,XT,@_L01          ; |176|
            SFR       ACC,#12               ; |176|
            SAT       ACC                   ; |176|
            MOVL      @_L02,ACC             ; |176|
        .dwpsn    file "build\main.cpp",line 177,column 5,is_stmt
            MOVL      XT,@_L00              ; |177|
            IMPYL     P,XT,@_L01            ; |177|
            QMPYL     ACC,XT,@_L01          ; |177|
            LSL64     ACC:P,#12             ; |177|
            SAT       ACC                   ; |177|
            MOVL      @_L03,ACC             ; |177|
        .dwpsn    file "build\main.cpp",line 178,column 5,is_stmt
            MOVL      XT,@_L00              ; |178|
            IMPYL     P,XT,@_L01            ; |178|
            QMPYL     ACC,XT,@_L01          ; |178|
            ASR64     ACC:P,#12             ; |178|
            MOVL      ACC,P                 ; |178|
            SAT       ACC                   ; |178|
            MOVL      @_L04,ACC             ; |178|

  • Jason R Sachs said:
    The intrinsic section, as always, suffers from extremely poor documentation.

    Jason,

    I agree.  The C2000 compiler guide and assembler guide are scheduled for updates late this year to be released in 1Q11.    I will file a bug report that this information needs to be updated so it does not get lost.

    Jason R Sachs said:
    A particular issue involves __IQmpy and  __IQxmpy. The documentation doesn't say what they do on a high level, just what instructions they are supposed to translate into.

    The IQmpy and IQxmpy are used by the IQmath library.  You can look there for the documentation.   (I've attached it).  It doesn't spell out the assembly it expands to, but it explains what the function is intended to do.

     

    2273.IQmath_v15c.pdf

    The full IQmath library is available in controlSUITE:  www.ti.com/controlsuite

    When you write _IQmpy(A,B) (or IQNmpy()) the IQMath library header file will change this into the __IQmpy(A,B,C) intrinsic.  So for this function take a look at the IQNmpy() information on page 45.

    When you write _IQNmpyIQX(A,B,C) it is translated to the __IQxmpy intrinsic by the IQmath header file.  So for this function take a look at the IQNmpyIQX information on page 51.

    The difference is  the arguments to IQNmpy are the same IQ format while for IQNmpyIQX the IQ values of A and B can be different.  Typically IQmpy is used.

    Cheers

    Lori

     

     

  • Lori Heustess said:

    The IQmpy and IQxmpy are used by the IQmath library.  You can look there for the documentation.   (I've attached it).  It doesn't spell out the assembly it expands to, but it explains what the function is intended to do.

    OK, thanks.


    By the way, is there any chance a 16-bit IQ math library could be added? We almost never need 32-bit precision and 32x32 multiplies. In my project we're working on motor control algorithms, and I use 16 bit numbers almost exclusively, with the exception of integrator/filter state where 32 bits are required (and the least significant bits are only there for filter/integration state; the most significant bits are the filter/integrator output) -- I have one 32x32 multiply that I am considering adding only because the dynamic range of this particular operation is hard to encapsulate in a 16x16 multiply under all circumstances.

    The memory usage and speed of the 32-bit operations are too high for our project.

  • Lori Heustess said:
    I will file a bug report that this information needs to be updated so it does not get lost.

    I've entered this as SDSCM00037665.

    -Lori