Altera Corporation 3
FS 5: round Data Word Rounder
Functional
Description
The
round
function implements a data word rounder that provides
parameterized input and output widths.
The
round
function rounds a
WIDTHI
-bit number down to a
WIDTHR
-bit number, where
WIDTHI
is the input width and
WIDTHR
is
the output width. The
round
function can also add the rounded result to
another
WIDTHR
-
bit-wide number without increasing logic usage. The
round
function performs the following calculation:
result[(WIDTHR–1)..0]
=
dataa[(WIDTHI–1)..(WIDTHI-WIDTHR)]
+
dataa[WIDTHI-WIDTHR–1]
+
datab[]
For example, if the number being rounded is 00101.011
B
, the number is
rounded down to 00101
B
because the fractional part of the number (i.e.,
the bits to the right of the binary point) is less than 0.5 (0.100
B
). When the
bit directly to the right of the binary point is 1, a 1 is added to the result
because the fractional part of the number is greater than 0.5 (0.100
B
).
Figure 2 is a simplified illustration of an 8-bit color channel in a digital
video system. In this example, color space conversion is performed using
the
YCrCb2RGB
function. Depending on the input values to the
YCrCb2RGB
function, the multiplication used in the color conversion may
result in a 17-bit data word that rolls over. To avoid data word roll over,
this 17-bit digital video signal is fed to the
saturate
function, where it is
saturated to a 16-bit word. The signal is then fed to the
round
function,
where it is rounded to an 8-bit word. At this point, the data word is ready
for conversion to an analog video signal.
Figure 2. Digital Video Channel
f
For information on saturation, refer to
Functional Specification 4 (saturate
Data Word Saturator)
. For information on color space conversion, refer to
RGB2YCrCb & YCrCb2RGB Color Space Converters Data Sheet
.
Analog
Video
Signal
D/A
Converter
Round
Function
Saturate
Function
YCrCb2RGB
Function 17
8
8
8
16 8
y
cr
cb