RNDSYM implements a symmetric round to highest magnitude; this is equivalent to the MATLAB
function
round(arg)
.
arg | RNDSYM(arg ) |
---|---|
<x.5 | x |
x.5 | x+1 |
>x.5 | x+1 |
>-x.5 | -x |
-x.5 | -x-1 |
<-x.5 | -x-1 |
The binary point of arg
is defined in the same manner as for the
RNDSIMPLE(arg) function.
A rounding constant with a binary value of 0.0111.... (or 0.499...) is added to
arg
along with a carryin, defined as the inverse sign bit of
arg
. The LSBs are removed by the process of reinterpreting the
full precision output to the specified core output width. The LSBs remain on the
accumulator. For multiply operations, the XNOR of the multiplier inputs is used
instead of the inverse sign bit of arg, performing multiply rounding toward
infinity.
When carryin is 1, this is equivalent to adding 0.00....01. This modifies the rounding constant to 0.100.. (or 0.5) and therefore the rounding direction.