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.

CCS/LAUNCHXL-F280049C: LAUNCHXL-F280049C-Uderflow condition

Part Number: LAUNCHXL-F280049C


Tool/software: Code Composer Studio

Hi,

    I,m using the CLA of 280040.

    What,s the underflow & overflow condition?

    When I use "MADDF32", the result is Inf or -Inf ,but it doesn,t set LVF or LUF  in MSTF. Why?

   How can I meet the underflow & overflow condition, when I use  the instruction  "MADDF"?

  • Hi,

    I have informed the concerned people regarding this query. As they are on vacation until July 8th 2019, please give us additional time for the response.

    Please refer https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/790234?-FAQ-CLA-Can-the-CLA-interrupt-the-C28x-CPU-

    Thanks, Katta

  • FRANKY KONG said:
      When I use "MADDF32", the result is Inf or -Inf ,but it doesn,t set LVF or LUF  in MSTF. Why?

    Can you confirm that you are using MADDF32 and not MADD32? 

    Per the device technical reference manual, the MADD32 instruction does not change the overflow/underflow flags but the MADDF32 instruction does

    Regards

    Lori

  • I am using  "MADDF32" , not MADD32.

    Will the LVF will be set when the result is Inf? And the LUF will be set when the result met -Inf?

    The LVF will set when I calculate 1/0.

  • Franky,

    Thank you for providing the details.  I will investigate and get back to you.  I'll let you know by end of Wednesday what I've found out.

    Regards

    Lori

  • Franky,

    The IEEE standard specifies that infinity + any value = infinity.  Since this is exactly represented the flags are not set. 

    A few key points:

    • The FPU doesn't set LUF/LVF flags input exception. Only if the output cannot be represented.
    • ADD treats NaN as infinity
    • ADD treats Dnorm as 0
    • Anything + infinity = infinity

    To see the flags set, use the largest normal number and add a very small number to it.  Likewise take a tiny number and add a tiny negative number.  Two examples are given below for the FPU.  The CLA will have the same results.

    Ex:
    
           MOVIZ   R0,  #0x0080
           MOVXI   R0H, #0x0001              ; tiny positive # (1.75....e-38)
           ADDF32  R2H, R0H, #0x8080   ; add tiny neg # (-1.17.....e-38), LUF set
    Ex:
           MOVIZ   R0,  #0x7F7F
           MOVXI   R0H, #0xFFFF             ; largest positive normal # (3.38....e+38)
           ADDF32  R2H, R0H, #0x7F7F   ; large positive normal #, LVF set

    If you are trying to perform a limit check on input values (i.e. limit them to a number just smaller than infinity) then you could do something like this:

    float       ValA;
    float       ValB;
    float       ValC;
    
       ValA = if(ValA > MAX_LIMIT)? ValA : MAX_LIMIT;
       ValA = if(ValA < MIN_LIMIT)? ValA : MIN_LIMIT;
                   
       ValB = if(ValB > MAX_LIMIT)? ValB : MAX_LIMIT;
       ValB = if(ValB < MIN_LIMIT)? ValB : MIN_LIMIT;
     
       ValA = ValA + ValB;          // LVF will be set if any overflow occurs.
    

    Regards

    Lori