summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Ettus <matt@ettus.com>2011-05-15 13:55:45 -0700
committerMatt Ettus <matt@ettus.com>2011-06-08 10:52:52 -0700
commitb5283ddff6ea1564688b0db83bcb98c1b195f698 (patch)
tree9625f889880cd83d411c42aa5a6c73eff8737bb6
parentb9b183315a232b3bdd2c82ee924678612ff50e0c (diff)
downloaduhd-b5283ddff6ea1564688b0db83bcb98c1b195f698.tar.gz
uhd-b5283ddff6ea1564688b0db83bcb98c1b195f698.tar.bz2
uhd-b5283ddff6ea1564688b0db83bcb98c1b195f698.zip
dsp: register hb output
-rw-r--r--usrp2/sdr_lib/dsp_core_rx_tb.v2
-rw-r--r--usrp2/sdr_lib/hb_dec.v17
-rw-r--r--usrp2/sdr_lib/hb_dec_tb.v6
-rw-r--r--usrp2/sdr_lib/input.dat283
4 files changed, 15 insertions, 293 deletions
diff --git a/usrp2/sdr_lib/dsp_core_rx_tb.v b/usrp2/sdr_lib/dsp_core_rx_tb.v
index ff35d4027..67a558d55 100644
--- a/usrp2/sdr_lib/dsp_core_rx_tb.v
+++ b/usrp2/sdr_lib/dsp_core_rx_tb.v
@@ -50,7 +50,7 @@ module dsp_core_rx_tb();
set_stb <= 1;
@(posedge clk);
set_addr <= 2;
- set_data <= {16'd0,8'd0,8'd8}; // set decim
+ set_data <= {16'd0,8'd3,8'd1}; // set decim
set_stb <= 1;
@(posedge clk);
set_stb <= 0;
diff --git a/usrp2/sdr_lib/hb_dec.v b/usrp2/sdr_lib/hb_dec.v
index 59c66ea28..eba79b938 100644
--- a/usrp2/sdr_lib/hb_dec.v
+++ b/usrp2/sdr_lib/hb_dec.v
@@ -30,8 +30,8 @@ module hb_dec
input [8:0] cpi, // Clocks per input -- equal to the decimation ratio ahead of this block
input stb_in,
input [IWIDTH-1:0] data_in,
- output stb_out,
- output [OWIDTH-1:0] data_out);
+ output reg stb_out,
+ output reg [OWIDTH-1:0] data_out);
// Control
reg [3:0] addr_odd_a, addr_odd_b, addr_odd_c, addr_odd_d;
@@ -126,8 +126,8 @@ module hb_dec
srl #(.WIDTH(IWIDTH)) srl_odd_d
(.clk(clk),.write(write_odd),.in(data_in),.addr(addr_odd_d),.out(data_odd_d));
- add2_reg /*_and_round_reg*/ #(.WIDTH(IWIDTH)) add1 (.clk(clk),.in1(data_odd_a),.in2(data_odd_b),.sum(sum1));
- add2_reg /*_and_round_reg*/ #(.WIDTH(IWIDTH)) add2 (.clk(clk),.in1(data_odd_c),.in2(data_odd_d),.sum(sum2));
+ add2_reg #(.WIDTH(IWIDTH)) add1 (.clk(clk),.in1(data_odd_a),.in2(data_odd_b),.sum(sum1));
+ add2_reg #(.WIDTH(IWIDTH)) add2 (.clk(clk),.in1(data_odd_c),.in2(data_odd_d),.sum(sum2));
wire [IWIDTH-1:0] data_even;
reg [3:0] addr_even;
@@ -164,7 +164,7 @@ module hb_dec
signext_data_even (.in(data_even),.out(data_even_signext[ACCWIDTH-1:SHIFT_FACTOR]));
assign data_even_signext[SHIFT_FACTOR-1:0] = 0;
- add2_reg /* add2_and_round_reg */ #(.WIDTH(ACCWIDTH+1))
+ add2_reg #(.WIDTH(ACCWIDTH+1))
final_adder (.clk(clk), .in1({acc_out,1'b0}), .in2({data_even_signext,1'b0}), .sum(final_sum_unrounded));
wire [OWIDTH-1:0] bypass_data;
@@ -181,7 +181,10 @@ module hb_dec
.out(bypass_data), .strobe_out(stb_bypass));
// Output
- assign stb_out = bypass ? stb_bypass : stb_final;
- assign data_out = bypass ? bypass_data : final_sum;
+ always @(posedge clk)
+ begin
+ stb_out <= bypass ? stb_bypass : stb_final;
+ data_out <= bypass ? bypass_data : final_sum;
+ end
endmodule // hb_dec
diff --git a/usrp2/sdr_lib/hb_dec_tb.v b/usrp2/sdr_lib/hb_dec_tb.v
index 256f6085d..ac64f22a7 100644
--- a/usrp2/sdr_lib/hb_dec_tb.v
+++ b/usrp2/sdr_lib/hb_dec_tb.v
@@ -28,7 +28,7 @@ module hb_dec_tb( ) ;
reg strobe_in ;
reg signed [17:0] data_in ;
wire strobe_out ;
- wire signed [17:0] data_out ;
+ wire signed [15:0] data_out ;
initial
begin
@@ -65,8 +65,8 @@ module hb_dec_tb( ) ;
*/
- hb_dec #(.IWIDTH(18),.OWIDTH(18),.CWIDTH(18),.ACCWIDTH(24)) uut
- (.clk(clock),.rst(reset),.bypass(0),.cpi(clocks),.stb_in(strobe_in),.data_in(data_in),
+ hb_dec #(.IWIDTH(18),.OWIDTH(16),.CWIDTH(18),.ACCWIDTH(24)) uut
+ (.clk(clock),.rst(reset),.bypass(0),.run(1),.cpi(clocks),.stb_in(strobe_in),.data_in(data_in),
.stb_out(strobe_out),.data_out(data_out) );
integer i, ri, ro, infile, outfile ;
diff --git a/usrp2/sdr_lib/input.dat b/usrp2/sdr_lib/input.dat
index 1e649ac2e..486c0252f 100644
--- a/usrp2/sdr_lib/input.dat
+++ b/usrp2/sdr_lib/input.dat
@@ -6,172 +6,6 @@
0
0
0
--131072
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-131071
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-131071
-131071
-131071
-131071
-131071
-131071
-131071
-131071
-131071
-131071
-131071
-131071
-131071
-131071
-131071
-131071
-131071
-131071
-131071
-131071
-131071
-131071
-131071
-131071
-131071
-131071
-131071
-131071
-131071
-131071
-131071
-131071
-131071
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
0
0
0
@@ -206,122 +40,6 @@
0
0
0
--131072
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
--131072
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
0
0
0
@@ -339,3 +57,4 @@
0
0
0
+