summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usrp2/sdr_lib/round.v18
1 files changed, 13 insertions, 5 deletions
diff --git a/usrp2/sdr_lib/round.v b/usrp2/sdr_lib/round.v
index 5b83981c6..26d5a4cf4 100644
--- a/usrp2/sdr_lib/round.v
+++ b/usrp2/sdr_lib/round.v
@@ -32,12 +32,20 @@ module round
output [bits_out-1:0] out,
output [bits_in-bits_out:0] err);
- wire round_corr;
- wire round_corr_trunc = 0;
- wire round_corr_rtz = (in[bits_in-1] & |in[bits_in-bits_out-1:0]);
- wire round_corr_nearest = in[bits_in-bits_out-1];
- wire round_corr_nearest_safe = (~in[bits_in-1] & (&in[bits_in-2:bits_out])) ? 0 :
+ wire round_corr,round_corr_trunc,round_corr_rtz,round_corr_nearest,round_corr_nearest_safe;
+
+ assign round_corr_trunc = 0;
+ assign round_corr_rtz = (in[bits_in-1] & |in[bits_in-bits_out-1:0]);
+ assign round_corr_nearest = in[bits_in-bits_out-1];
+
+ generate
+ if(bits_in-bits_out > 1)
+ assign round_corr_nearest_safe = (~in[bits_in-1] & (&in[bits_in-2:bits_out])) ? 0 :
round_corr_nearest;
+ else
+ assign round_corr_nearest_safe = round_corr_nearest;
+ endgenerate
+
assign round_corr = round_to_nearest ? round_corr_nearest_safe :
trunc ? round_corr_trunc :