
Altera Corporation 
 3
FS 5: round Data Word Rounder
Functional 
Description
The 
parameterized input and output widths.
round
 function implements a data word rounder that provides 
The 
WIDTHR
the output width. The 
another 
WIDTHR
round
 function performs the following calculation:
round
 function rounds a 
-bit number, where 
WIDTHI
WIDTHI
 function can also add the rounded result to 
bit-wide number without increasing logic usage. The 
-bit number down to a 
 is the input width and 
WIDTHR
 is 
round
-
result[(WIDTHR–1)..0]
dataa[WIDTHI-WIDTHR–1]
 = 
dataa[(WIDTHI–1)..(WIDTHI-WIDTHR)]
 + 
datab[] 
 + 
For example, if the number being rounded is 00101.011
B
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
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
, the number is 
). When the 
).
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 
saturated to a 16-bit word. The signal is then fed to the 
where it is rounded to an 8-bit word. At this point, the data word is ready 
for conversion to an analog video signal.
saturate
 function, where it is 
round
 function, 
Figure 2. Digital Video Channel
f
For information on saturation, refer to 
Functional Specification 6 (saturate 
Data Word Saturator)
. For information on color space conversion, refer to 
RGB2YCrCb & YCrCb2RGB Color Space Converters Data Sheet
.
Analog
Video
Signa
l
D/A
Converter
Round
Function
Saturate
Function
YCrCb2RGB
Function
17
8
8
8
16
8
y
cr
cb