| `timescale 1ns / 1ns |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| module cic_multichannel #( |
| parameter n_chan=12, |
|
|
| |
| parameter di_dwi=16, |
| parameter di_rwi=32, |
| |
| |
| parameter di_noise_bits=4, |
| |
|
|
| parameter shift_delay=0, |
|
|
| parameter cc_outw=20, |
| parameter cc_halfband=1, |
| parameter cc_use_delay=0, |
| parameter cc_shift_base=0, |
| parameter cc_shift_wi=4 |
| ) ( |
| |
| input clk, |
| input reset, |
| input stb_in, |
| input [n_chan*di_dwi-1:0] d_in, |
| input cic_sample, |
|
|
| |
| input cc_sample, |
| input [cc_shift_wi-1:0] cc_shift, |
|
|
| |
| output di_stb_out, |
| output [di_rwi-1:0] di_sr_out, |
|
|
| |
| output cc_stb_out, |
| output signed [cc_outw-1:0] cc_sr_out |
| ); |
| |
| reg [1:0] reset_r=0; |
|
|
| always @(posedge clk) begin |
| reset_r <= {reset_r[0],reset}; |
| end |
|
|
| |
| |
| |
|
|
| wire [n_chan*di_rwi-1:0] di_out; |
|
|
| genvar ch_id; |
| generate for (ch_id=0; ch_id < n_chan; ch_id=ch_id+1) begin : g_d_int |
|
|
| double_inte_smp #( |
| .dwi (di_dwi), |
| .dwo (di_rwi)) |
| i_double_inte ( |
| .clk (clk), |
| .reset (reset_r[1]), |
| .stb_in (stb_in), |
| .in (d_in[(ch_id+1)*di_dwi-1:ch_id*di_dwi]), |
| .out (di_out[(ch_id+1)*di_rwi-1:ch_id*di_rwi]) |
| ); |
|
|
| end endgenerate |
|
|
| |
| |
| |
|
|
| wire [di_rwi-1:0] sr_out_l; |
| wire stb_out_l; |
|
|
| serializer_multichannel #( |
| .n_chan (n_chan), |
| .dw (di_rwi)) |
| i_serializer_multich ( |
| .clk (clk), |
| .sample_in (cic_sample), |
| .data_in (di_out), |
| .gate_out (stb_out_l), |
| .stream_out (sr_out_l) |
| ); |
|
|
| |
| |
| |
| wire [di_rwi-1:0] sr_out_shift; |
| wire stb_out_shift, stb_out_shift_l; |
|
|
| reg_delay #( |
| .dw (di_rwi+1), |
| .len (shift_delay*n_chan)) |
| i_shift_delay ( |
| .clk (clk), |
| .reset (reset), |
| .gate (stb_out_l), |
| .din ({sr_out_l, stb_out_l}), |
| .dout ({sr_out_shift, stb_out_shift_l}) |
| ); |
|
|
| assign stb_out_shift = stb_out_shift_l & stb_out_l; |
|
|
| |
| assign di_stb_out = stb_out_shift; |
| assign di_sr_out = sr_out_shift; |
|
|
| |
| |
| |
| `ifdef SIMULATE |
| |
| initial begin |
| if (cc_halfband && cc_outw != 20) begin |
| $display("ERROR: Output width of CC filt must be 20 when using the Half-Band filter"); |
| $finish; |
| end |
| end |
| `endif |
|
|
| ccfilt #( |
| .dw (di_rwi-di_noise_bits), |
| .outw (cc_outw), |
| .shift_wi (cc_shift_wi), |
| .shift_base (cc_shift_base), |
| .dsr_len (n_chan), |
| .use_hb (cc_halfband), |
| .use_delay (cc_use_delay)) |
| i_ccfilt |
| ( |
| .clk (clk), |
| .reset (reset), |
| .sr_in (sr_out_shift[di_rwi-1:(di_noise_bits)]), |
| .sr_valid (stb_out_shift&cc_sample), |
| .shift (cc_shift), |
| .result (cc_sr_out), |
| .strobe (cc_stb_out) |
| ); |
|
|
| endmodule |
|
|