Attention

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

iq_intrp4 Source File

 1`timescale 1ns / 1ns
 2
 3// Pull apart and interpolate a four-way interpolated IQ stream
 4// into its individual components
 5module iq_intrp4(
 6     input clk,
 7     input sync,
 8     input signed [21:0] in,
 9     output signed [17:0] out1,
10     output signed [17:0] out2,
11     output signed [17:0] out3,
12     output signed [17:0] out4
13);
14
15reg sync1=0;
16always @(posedge clk) sync1 <= sync;
17wire samp = sync | sync1;
18
19wire signed [25:0] in_e=in;  // sign-extend four extra bits
20wire signed [25:0] d_out;
21doublediff #(.dw(26), .dsr_len(8)) dd(.clk(clk), .d_in(in_e), .g_in(1'b1), .d_out(d_out));
22
23wire signed [25:0] in4 = d_out;
24reg signed [25:0] in1=0, in2=0, in2_d=0, in3=0, in3_d=0, in4_d=0;
25always @(posedge clk) begin
26     in4_d <= in4;  in3 <= in4_d;
27     in3_d <= in3;  in2 <= in3_d;
28     in2_d <= in2;  in1 <= in2_d;
29end
30
31iq_inter #(.dwi(26), .dwo(18)) di1(.clk(clk), .samp(samp), .in(in1), .out(out1));
32iq_inter #(.dwi(26), .dwo(18)) di2(.clk(clk), .samp(samp), .in(in2), .out(out2));
33iq_inter #(.dwi(26), .dwo(18)) di3(.clk(clk), .samp(samp), .in(in3), .out(out3));
34iq_inter #(.dwi(26), .dwo(18)) di4(.clk(clk), .samp(samp), .in(in4), .out(out4));
35
36endmodule