User`s guide

Inline Assembly Language and Intrinsics
Intrinsic Functions
167Targeting MC56F83xx/DSP5685x Controllers
Rounding
The intrinsic function of the rounding group is:
round
round
Rounds a 32-bit fractional value into a 16-bit result. When an accumulator is the
destination, zeroes out the LSP portion.
Assumptions
OMR’s R bit was set to 1 at least 3 cycles before this code, that is, 2’s complement
rounding, not convergent rounding.
OMR’s SA bit was set to 1 at least 3 cycles before this code, that is, saturation on data
ALU results enabled.
Prototype
Word16 round(Word32 lvar1)
Example
long l = 0x12348002;/*if low 16 bits = 0xFFFF > 0x8000 then
add 1 */
short result;
result = round(l);
// Expected value of result: 0x1235