Attention
This documentation is a work in progress. Expect to see errors and unfinished things.
afterburner Source File
1// Synthesizes to 47 slices and 1 MULT18X18 at 166 MHz in XC3Sxxx-4 using XST-9.2.04i
2// Use parameter triple instead of preprocessor variable AFTERBURNER_TRIPLE
3// User port coeff instead of parameter coeff
4// If the port coeff is set to a constant value, should synthesize identically
5// There is a latency of 3 clock cycles (??)
6// Note: The output of the module is Offset Binary
7// [It is perhaps stupid to have that here and it should be moved into another module]
8
9// CONCEPT: The mid point along the circle of a of 2 complex numbers that already lie
10// on a circle is not a plain average. To obtain the (real/imaginary) component
11// of this mid-point one has to multiply by what is called "coeff"
12// k = 0.5*sec(theta) .. where theta is the angle between the complex numbers
13
14`timescale 1ns / 1ns
15module afterburner(
16 input clk, // timespec 6.0 ns
17 input signed [16:0] data, // This is level set data [.. a_n1, a_n2 ..]
18 input signed [15:0] coeff, // Coefficient to correct for interpolation
19 output [15:0] data_out0, // Interpolated [coeff*[..(a_n1+a_n2), (a_n2+a_n3),..]]
20 output [15:0] data_out1 // Untouched [.. a_n1, a_n2 ..]
21);
22
23parameter triple=0;
24
25// concept: a1 k*(a1+a2) a2 k*(a2+a3) a3 ...
26// where k = 0.5*sec(theta) = 0.5*sec(2*pi*11/28) = -0.63952
27// to handle 55 MHz output at 70 MHz clk (140 MS/s data rate to DAC)
28
29// num = 2 % or 8 for L-band
30// den = 11
31// coeff = floor(32768*0.5*sec(pi*num/den)+0.5)
32// 19476 % or -25019 for L-band
33
34reg signed [17:0] avg=0;
35reg signed [16:0] data1=0, data2=0, data3=0, data4=0;
36wire signed [16:0] thru = triple ? data4 : data3;
37reg signed [33:0] prod=0;
38reg signed [15:0] sat=0;
39always @(posedge clk) begin
40 data1 <= data;
41 data2 <= data1;
42 data3 <= data2;
43 data4 <= data3;
44 avg <= data + (triple ? data3 : data1);
45 prod <= avg * coeff; // scale by 32768
46 sat <= (~(|prod[33:31]) | (&prod[33:31])) ? prod[31:16] : {prod[33],{15{~prod[33]}}};
47end
48
49// send offset binary to DAC (someone else needs to instantiate the DDR output cells)
50assign data_out0 = ({~sat[15], sat[14:0]});
51assign data_out1 = ({~thru[16], thru[15:1]});
52
53endmodule