Attention
This documentation is a work in progress. Expect to see errors and unfinished things.
double_inte Source File
1`timescale 1ns / 1ns
2// 2 steps of CIC integration. Reset to 0
3// *** N.B: USES AN UNDOCUMENTED IMPLIED DIVIDE-BY-TWO
4
5module double_inte #(
6 parameter dwi=16, // data width in
7 parameter dwo=28 // data width out
8 // output is n bits more than the input, where 2^n should be
9 // more than the cic factor^2.
10 // In the case 47^2=2209, adding 12 bits is OK.
11) (
12 input clk, // timespec 8.4 ns
13 input signed [dwi-1:0] in, // possibly muxed
14 output signed [dwo-1:0] out,
15 input reset // reset integrator to 0
16);
17
18
19reg [1:0] reset_r = 0;
20always @(posedge clk) begin
21 reset_r <= {reset_r[0], reset};
22end
23reg signed [dwo-1:0] int1 = 0, int2 = 0;
24reg ignore=0;
25always @(posedge clk) begin
26 {int1, ignore} <= |reset_r ? 0 : ($signed({int1, 1'b1}) + in);
27 int2 <= |reset_r ? 0 : (int2 + int1);
28end
29assign out = int2;
30
31endmodule