diff options
author | Josh Blum <josh@joshknows.com> | 2011-07-08 12:14:53 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-07-08 12:14:53 -0700 |
commit | 4ea6f7431e09d9f27ecaa1c1b187d2c2f613e8f4 (patch) | |
tree | d2e66eb4e5f7cf7f8ab033f5482a6f2477aa88b6 /usrp2/sdr_lib/round_sd.v | |
parent | dd41da159157afe417e7f3b77ba30e189eb510fe (diff) | |
parent | fbc01138d5f943b06ce1bf3f746287b9d6c7789d (diff) | |
download | uhd-4ea6f7431e09d9f27ecaa1c1b187d2c2f613e8f4.tar.gz uhd-4ea6f7431e09d9f27ecaa1c1b187d2c2f613e8f4.tar.bz2 uhd-4ea6f7431e09d9f27ecaa1c1b187d2c2f613e8f4.zip |
Merge branch 'b100_shrink' into next
Diffstat (limited to 'usrp2/sdr_lib/round_sd.v')
-rw-r--r-- | usrp2/sdr_lib/round_sd.v | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/usrp2/sdr_lib/round_sd.v b/usrp2/sdr_lib/round_sd.v new file mode 100644 index 000000000..aeeb3502f --- /dev/null +++ b/usrp2/sdr_lib/round_sd.v @@ -0,0 +1,22 @@ + + +module round_sd + #(parameter WIDTH_IN=18, + parameter WIDTH_OUT=16) + (input clk, input reset, + input [WIDTH_IN-1:0] in, input strobe_in, + output [WIDTH_OUT-1:0] out, output strobe_out); + + localparam ERR_WIDTH = WIDTH_IN - WIDTH_OUT + 1; + + wire [ERR_WIDTH-1:0] err; + wire [WIDTH_IN-1:0] err_ext, sum; + + sign_extend #(.bits_in(ERR_WIDTH),.bits_out(WIDTH_IN)) ext_err (.in(err), .out(err_ext)); + + add2_and_clip_reg #(.WIDTH(WIDTH_IN)) add2_and_clip_reg + (.clk(clk), .rst(reset), .in1(in), .in2(err_ext), .strobe_in(strobe_in), .sum(sum), .strobe_out(strobe_out)); + + round #(.bits_in(WIDTH_IN),.bits_out(WIDTH_OUT)) round_sum (.in(sum), .out(out), .err(err)); + +endmodule // round_sd |