aboutsummaryrefslogtreecommitdiffstats
path: root/usrp2/sdr_lib
diff options
context:
space:
mode:
authorMatt Ettus <matt@ettus.com>2011-10-13 17:20:17 -0700
committerMatt Ettus <matt@ettus.com>2011-10-26 15:57:22 -0700
commit59c4a2bfc2fc4d9f6f98628b28f4eff6151d6844 (patch)
tree735c588ab2d2d980fc86a43fed9fba115f40d1fd /usrp2/sdr_lib
parent6e2c70c914ad8d454ad575257ed16cbd8f59c052 (diff)
downloaduhd-59c4a2bfc2fc4d9f6f98628b28f4eff6151d6844.tar.gz
uhd-59c4a2bfc2fc4d9f6f98628b28f4eff6151d6844.tar.bz2
uhd-59c4a2bfc2fc4d9f6f98628b28f4eff6151d6844.zip
dsp: make rounding a single bit work again
Diffstat (limited to 'usrp2/sdr_lib')
-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 :