Skip to content
Snippets Groups Projects
Commit ad09a2e9 authored by Eric Kooistra's avatar Eric Kooistra
Browse files

Added g_round_even support, default FALSE for backwards compatibility.

parent 40619fc1
No related branches found
No related tags found
1 merge request!168Add support for round half to even via g_round_even. Not yet fully tested....
......@@ -57,9 +57,10 @@ ENTITY common_requantize IS
g_lsb_w : INTEGER := 4; -- when > 0, number of LSbits to remove from in_dat
-- when < 0, number of LSBits to insert as a gain before resize to out_dat'LENGTH
-- when 0 then no effect
g_lsb_round : BOOLEAN := TRUE; -- when true ROUND else TRUNCATE the input LSbits
g_lsb_round_clip : BOOLEAN := FALSE; -- when true round clip to +max to avoid wrapping to output -min (signed) or 0 (unsigned) due to rounding
g_msb_clip : BOOLEAN := TRUE; -- when true CLIP else WRAP the input MSbits
g_lsb_round : BOOLEAN := TRUE; -- when TRUE round else truncate the input LSbits
g_lsb_round_clip : BOOLEAN := FALSE; -- when TRUE round clip to +max to avoid wrapping to output -min (signed) or 0 (unsigned) due to rounding
g_lsb_round_even : BOOLEAN := FALSE; -- when TRUE round to even, else round away from zero
g_msb_clip : BOOLEAN := TRUE; -- when TRUE CLIP else WRAP the input MSbits
g_msb_clip_symmetric : BOOLEAN := FALSE; -- when TRUE clip signed symmetric to +c_smax and -c_smax, else to +c_smax and c_smin_symm
-- for wrapping when g_msb_clip=FALSE the g_msb_clip_symmetric is ignored, so signed wrapping is done asymmetric
g_gain_w : NATURAL := 0; -- do not use, must be 0, use negative g_lsb_w instead
......@@ -101,6 +102,7 @@ BEGIN
g_representation => g_representation,
g_round => g_lsb_round,
g_round_clip => g_lsb_round_clip,
g_round_even => g_lsb_round_even,
g_pipeline_input => 0,
g_pipeline_output => g_pipeline_remove_lsb,
g_in_dat_w => g_in_dat_w,
......
......@@ -43,7 +43,7 @@ ENTITY common_round IS
g_representation : STRING := "SIGNED"; -- SIGNED (round +-0.5 away from zero to +- infinity) or UNSIGNED rounding (round 0.5 up to + inifinity)
g_round : BOOLEAN := TRUE; -- when TRUE round the input, else truncate the input
g_round_clip : BOOLEAN := FALSE; -- when TRUE clip rounded input >= +max to avoid wrapping to output -min (signed) or 0 (unsigned)
g_round_even : BOOLEAN := FALSE; -- when TRUE round even
g_round_even : BOOLEAN := FALSE; -- when TRUE round to even, else round away from zero
g_pipeline_input : NATURAL := 0; -- >= 0
g_pipeline_output : NATURAL := 1; -- >= 0, use g_pipeline_input=0 and g_pipeline_output=0 for combinatorial output
g_in_dat_w : NATURAL := 36;
......
......@@ -34,14 +34,15 @@ USE common_lib.common_pkg.ALL;
ENTITY dp_requantize IS
GENERIC (
g_complex : BOOLEAN := TRUE; -- when true, the re and im field are processed, when false, the data field is processed
g_complex : BOOLEAN := TRUE; -- when TRUE, the re and im field are processed, when false, the data field is processed
g_representation : STRING := "SIGNED"; -- SIGNED (round +-0.5 away from zero to +- infinity) or UNSIGNED rounding (round 0.5 up to + inifinity)
g_lsb_w : INTEGER := 4; -- when > 0, number of LSbits to remove from in_dat
-- when < 0, number of LSBits to insert as a gain before resize to out_dat'LENGTH
-- when 0 then no effect
g_lsb_round : BOOLEAN := TRUE; -- when true ROUND else TRUNCATE the input LSbits
g_lsb_round_clip : BOOLEAN := FALSE; -- when true round clip to +max to avoid wrapping to output -min (signed) or 0 (unsigned) due to rounding
g_msb_clip : BOOLEAN := TRUE; -- when true CLIP else WRAP the input MSbits
g_lsb_round : BOOLEAN := TRUE; -- when TRUE round else truncate the input LSbits
g_lsb_round_clip : BOOLEAN := FALSE; -- when TRUE round clip to +max to avoid wrapping to output -min (signed) or 0 (unsigned) due to rounding
g_lsb_round_even : BOOLEAN := FALSE; -- when TRUE round to even, else round away from zero
g_msb_clip : BOOLEAN := TRUE; -- when TRUE CLIP else WRAP the input MSbits
g_msb_clip_symmetric : BOOLEAN := FALSE; -- when TRUE clip signed symmetric to +c_smax and -c_smax, else to +c_smax and c_smin_symm
-- for wrapping when g_msb_clip=FALSE the g_msb_clip_symmetric is ignored, so signed wrapping is done asymmetric
g_gain_w : NATURAL := 0; -- do not use, must be 0, use negative g_lsb_w instead
......@@ -88,7 +89,8 @@ BEGIN
g_representation => g_representation,
g_lsb_w => g_lsb_w,
g_lsb_round => g_lsb_round,
g_lsb_round_clip => g_lsb_round_clip,
g_lsb_round_clip => g_lsb_round_clip,
g_lsb_round_even => g_lsb_round_even,
g_msb_clip => g_msb_clip,
g_msb_clip_symmetric => g_msb_clip_symmetric,
g_pipeline_remove_lsb => g_pipeline_remove_lsb,
......@@ -113,7 +115,8 @@ BEGIN
g_representation => g_representation,
g_lsb_w => g_lsb_w,
g_lsb_round => g_lsb_round,
g_lsb_round_clip => g_lsb_round_clip,
g_lsb_round_clip => g_lsb_round_clip,
g_lsb_round_even => g_lsb_round_even,
g_msb_clip => g_msb_clip,
g_msb_clip_symmetric => g_msb_clip_symmetric,
g_pipeline_remove_lsb => g_pipeline_remove_lsb,
......@@ -133,7 +136,8 @@ BEGIN
g_representation => g_representation,
g_lsb_w => g_lsb_w,
g_lsb_round => g_lsb_round,
g_lsb_round_clip => g_lsb_round_clip,
g_lsb_round_clip => g_lsb_round_clip,
g_lsb_round_even => g_lsb_round_even,
g_msb_clip => g_msb_clip,
g_msb_clip_symmetric => g_msb_clip_symmetric,
g_pipeline_remove_lsb => g_pipeline_remove_lsb,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment