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.

TMS320F28065: How to use roundf function in CLA

Part Number: TMS320F28065


Please help me on how to use roundf function which are available in math.h. 

roundf function is working outside CLA.

When used within CLA, I'm getting implicitly declared warning. 

  • Hi Ravi,

    We do not support math.h functions on the CLA. These are only available for the C28x.

    However, we do have instructions and intrinsics in the CLA to perform float to integer conversions. 1) You can use the __mf32toi16r() intrinsic or the __mf32toui16r() intrinsic. 2) You should be able to typecast a float to an integer and assign it to an integer, the compiler should issue a single cycle convert operation. You can find the intrinsics in the C2000 Optimizing C/C++ Compiler User Guide in Section 10.

    www.ti.com/lit/spru514

    Finally, in the MSTF register, there is a RNDF32 bit where you can select a rounding mode. You can view the disassembly to confirm the instruction is being used.

    Hope this helps.

    Regards,
    sal