aboutsummaryrefslogtreecommitdiffstats
path: root/usrp2/sdr_lib/hb_dec.v
diff options
context:
space:
mode:
authorMatt Ettus <matt@ettus.com>2011-05-16 18:13:58 -0700
committerMatt Ettus <matt@ettus.com>2011-06-08 10:52:52 -0700
commitb88383ad6289d7056e4dc50ffc892fdd0bd115e1 (patch)
tree8538e51a7bf337e81435b78eecf08ddb9f3398e5 /usrp2/sdr_lib/hb_dec.v
parent6592deb4b1763c9b1c144a120ce86e8b07d16529 (diff)
downloaduhd-b88383ad6289d7056e4dc50ffc892fdd0bd115e1.tar.gz
uhd-b88383ad6289d7056e4dc50ffc892fdd0bd115e1.tar.bz2
uhd-b88383ad6289d7056e4dc50ffc892fdd0bd115e1.zip
dsp: clip in hb_dec to prevent the rare overflow with certain frequencies at max amplitude
Diffstat (limited to 'usrp2/sdr_lib/hb_dec.v')
-rw-r--r--usrp2/sdr_lib/hb_dec.v11
1 files changed, 7 insertions, 4 deletions
diff --git a/usrp2/sdr_lib/hb_dec.v b/usrp2/sdr_lib/hb_dec.v
index f4e09091f..562e85b6b 100644
--- a/usrp2/sdr_lib/hb_dec.v
+++ b/usrp2/sdr_lib/hb_dec.v
@@ -95,7 +95,8 @@ module hb_dec
// Data
wire [IWIDTH-1:0] data_odd_a, data_odd_b, data_odd_c, data_odd_d;
wire [IWIDTH-1:0] sum1, sum2;
- wire [OWIDTH-1:0] final_sum;
+ wire [OWIDTH:0] final_sum;
+ wire [OWIDTH-1:0] final_sum_clip;
reg [CWIDTH-1:0] coeff1, coeff2;
wire [35:0] prod1, prod2;
@@ -170,11 +171,13 @@ module hb_dec
wire [OWIDTH-1:0] bypass_data;
wire stb_final, stb_bypass;
- round_sd #(.WIDTH_IN(ACCWIDTH-4),.WIDTH_OUT(OWIDTH))
+ round_sd #(.WIDTH_IN(ACCWIDTH-3),.WIDTH_OUT(OWIDTH+1))
final_round (.clk(clk),.reset(rst),
- .in(final_sum_unrounded[ACCWIDTH-5:0]),.strobe_in(stb_out_pre[8]),
+ .in(final_sum_unrounded[ACCWIDTH-4:0]),.strobe_in(stb_out_pre[8]),
.out(final_sum), .strobe_out(stb_final));
+ clip #(.bits_in(OWIDTH+1), .bits_out(OWIDTH)) clip (.in(final_sum), .out(final_sum_clip));
+
round_sd #(.WIDTH_IN(IWIDTH),.WIDTH_OUT(OWIDTH))
bypass_round (.clk(clk),.reset(rst),
.in(data_in),.strobe_in(stb_in),
@@ -184,7 +187,7 @@ module hb_dec
always @(posedge clk)
begin
stb_out <= bypass ? stb_bypass : stb_final;
- data_out <= bypass ? bypass_data : final_sum;
+ data_out <= bypass ? bypass_data : final_sum_clip;
end
endmodule // hb_dec