ceil(arg-0.5)
.
arg | RNDSIMPLE(arg ) |
---|---|
<x.5 | x |
x.5 | x |
>x.5 | x+1 |
>-x.5 | -x |
-x.5 | -x-1 |
<-x.5 | -x-1 |
The binary point of arg
is defined by the full precision output width and the
specified core output width; the core output is taken from the upper MSBs of the DSP
Slice output with the remaining LSBs considered as the fractional portion. The
binary point is taken as full precision p_width
-
p_width
.
A rounding constant with a binary value of 0.0111...(or 0.499...) is added to
arg
and the LSBs removed by the process of reinterpreting the
full precision output to the specified core output width. The LSBs remain on the
accumulator.
Arg
can include CARRYIN. This enables CARRYIN to determine the rounding
direction. The assertion of CARRYIN is equivalent to adding 0.00...01. This modifies
the rounding constant to 0.100.. (or 0.5) and therefore the rounding direction. This
can be used to implement random rounding.