Attention
This documentation is a work in progress. Expect to see errors and unfinished things.
iq_inter Source File
1`timescale 1ns / 1ns
2
3// Second-order CIC interpolation of an IQ data stream
4// Expect input valid for 2 cycles (marked by active-high samp signal)
5// out of 2*N.
6// Well, this is only the integration half of the CIC filter, someone
7// else (e.g., iq_intrp4) needs to do the differentiation.
8
9module iq_inter #(
10 parameter dwi=22, // data width in
11 parameter dwo=18 // data width out
12) (
13 input clk, // timespec 8.4 ns
14 input samp,
15 input signed [dwi-1:0] in,
16 output signed [dwo-1:0] out
17);
18
19reg signed [dwi-1:0] sreg=0, sreg_d=0, int1=0, int1_d=0, int2=0, int2_d=0;
20always @(posedge clk) begin
21 sreg <= samp ? in : sreg_d;
22 sreg_d <= sreg;
23 int1 <= int1_d + sreg;
24 int1_d <= int1;
25 int2 <= int2_d + int1;
26 int2_d <= int2;
27end
28assign out = int2[dwi-1:dwi-dwo];
29
30endmodule