Attention

This documentation is a work in progress. Expect to see errors and unfinished things.

interp1 Source File

 1`timescale 1ns / 1ns
 2module interp1(
 3     input clk,
 4     input signed [17:0] x,
 5     output signed [15:0] y
 6);
 7
 8// y is double-integrated value of x
 9// x is assumed to be doubly-differentiated from the signal of interest,
10// presumably from a ROM.
11// Configured to support x updated every 47 clk cycles,
12// and limited in amplitude a little:
13// 47^2 = 2209, but keep output < 2047
14
15reg signed [29:0] i1=0, i2=0;
16always @(posedge clk) begin
17     i1 <= i1+x;
18     i2 <= i2+i1;
19end
20assign y = i2[27:12];
21
22endmodule