diff options
author | matt <matt@221aa14e-8319-0410-a670-987f0aec2ac5> | 2007-03-20 02:13:06 +0000 |
---|---|---|
committer | matt <matt@221aa14e-8319-0410-a670-987f0aec2ac5> | 2007-03-20 02:13:06 +0000 |
commit | 2d3721456fb3a428136ec6054d3bf09c0645bbb5 (patch) | |
tree | 5f17b0674b1697afc2011b65d16f33fd9694868a /sdr_lib/cic_decim.v | |
parent | 25d5b9c9f72f34c0bf9205c74847660ac90d3349 (diff) | |
download | uhd-2d3721456fb3a428136ec6054d3bf09c0645bbb5.tar.gz uhd-2d3721456fb3a428136ec6054d3bf09c0645bbb5.tar.bz2 uhd-2d3721456fb3a428136ec6054d3bf09c0645bbb5.zip |
proper shifting for the cic decim now keeps signals roughly leveled
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@4784 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'sdr_lib/cic_decim.v')
-rwxr-xr-x | sdr_lib/cic_decim.v | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/sdr_lib/cic_decim.v b/sdr_lib/cic_decim.v index d7e5310b8..6c20416f1 100755 --- a/sdr_lib/cic_decim.v +++ b/sdr_lib/cic_decim.v @@ -24,7 +24,7 @@ module cic_decim ( clock,reset,enable,rate,strobe_in,strobe_out,signal_in,signal_out); parameter bw = 16; parameter N = 4; - parameter log2_of_max_rate = 8; + parameter log2_of_max_rate = 7; parameter maxbitgain = N * log2_of_max_rate; input clock; @@ -82,25 +82,8 @@ module cic_decim wire [bw+maxbitgain-1:0] signal_out_unnorm = pipeline[N-1]; - // Output Scaling to same width as input - function [2:0] log_ceil; - input [7:0] val; - log_ceil = val[6] ? 3'd7 : val[5] ? 3'd6 : val[4] ? 3'd5 : - val[3] ? 3'd4 : val[2] ? 3'd3 : val[1] ? 3'd2 : 3'd1; - endfunction // log_ceil - - wire [2:0] shift = log_ceil(rate); - - always @* - case(shift) - 3'd2 : signal_out = signal_out_unnorm[2*N+bw-1:2*N]; // Decim by 4 - 3'd3 : signal_out = signal_out_unnorm[3*N+bw-1:3*N]; - 3'd4 : signal_out = signal_out_unnorm[4*N+bw-1:4*N]; - 3'd5 : signal_out = signal_out_unnorm[5*N+bw-1:5*N]; - 3'd6 : signal_out = signal_out_unnorm[6*N+bw-1:6*N]; - 3'd7 : signal_out = signal_out_unnorm[7*N+bw-1:7*N]; - default : signal_out = signal_out_unnorm[7*N+bw-1:7*N]; - endcase // case(shift) + cic_dec_shifter #(bw) + cic_dec_shifter(rate,signal_out_unnorm,signal_out); endmodule // cic_decim |