From d35bbdf5a68dd8227354b4352043867f43b20b09 Mon Sep 17 00:00:00 2001 From: Matt Ettus Date: Fri, 13 May 2011 13:06:16 -0700 Subject: dsp: increase gain of small_hb_dec because it used to scale down by factor of 2. Clip if needed. --- usrp2/sdr_lib/dsp_core_rx_tb.v | 4 ++-- usrp2/sdr_lib/small_hb_dec.v | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/usrp2/sdr_lib/dsp_core_rx_tb.v b/usrp2/sdr_lib/dsp_core_rx_tb.v index c8fb33982..ff35d4027 100644 --- a/usrp2/sdr_lib/dsp_core_rx_tb.v +++ b/usrp2/sdr_lib/dsp_core_rx_tb.v @@ -46,11 +46,11 @@ module dsp_core_rx_tb(); @(negedge rst); @(posedge clk); set_addr <= 1; - set_data <= {16'd64,16'd64}; + set_data <= {16'd64,16'd64}; // set gains set_stb <= 1; @(posedge clk); set_addr <= 2; - set_data <= {16'd0,8'd3,8'd8}; + set_data <= {16'd0,8'd0,8'd8}; // set decim set_stb <= 1; @(posedge clk); set_stb <= 0; diff --git a/usrp2/sdr_lib/small_hb_dec.v b/usrp2/sdr_lib/small_hb_dec.v index ecafc2b68..14e6d755c 100644 --- a/usrp2/sdr_lib/small_hb_dec.v +++ b/usrp2/sdr_lib/small_hb_dec.v @@ -106,18 +106,22 @@ module small_hb_dec else if(go_d3) accum <= accum + {prod}; - wire [17:0] accum_rnd; + wire [18:0] accum_rnd; + wire [17:0] accum_rnd_clip; + wire stb_round; - round_sd #(.WIDTH_IN(36),.WIDTH_OUT(18)) round_acc + round_sd #(.WIDTH_IN(36),.WIDTH_OUT(19)) round_acc (.clk(clk), .reset(rst), .in(accum), .strobe_in(go_d4), .out(accum_rnd), .strobe_out(stb_round)); + clip #(.bits_in(19),.bits_out(18)) clip (.in(accum_rnd), .out(accum_rnd_clip)); + reg [17:0] final_sum; always @(posedge clk) if(bypass) final_sum <= data_in_d1; else if(stb_round) - final_sum <= accum_rnd; + final_sum <= accum_rnd_clip; assign data_out = final_sum; -- cgit v1.2.3