Attention

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

iq_mixer_multichannel Source File

 1`timescale 1ns / 1ns
 2
 3/** IQ_MIXER_MULTICHANNEL **
 4    Convenience wrapper that instantiates a generic number of mixer pairs
 5    for IQ or near-IQ mixing.
 6    Inputs are flattened vectors of the individual channels.
 7
 8*/
 9
10module iq_mixer_multichannel #(
11   parameter NORMALIZE = 0,
12   parameter NCHAN     = 2,  // Number of input channels
13   parameter DWI       = 16, // Width of ADC input
14   parameter DAVR      = 4,  // Guard bits to keep in the output
15   parameter DWLO      = 18  // Width of sin/cos input
16) (
17   input                                clk,
18   input  signed [NCHAN*DWI-1:0]        adc,
19   input  signed [DWLO-1:0]             cos,
20   input  signed [DWLO-1:0]             sin,
21   output signed [NCHAN*(DWI+DAVR)-1:0] mixout_i,
22   output signed [NCHAN*(DWI+DAVR)-1:0] mixout_q
23);
24
25   genvar ch_id;
26   generate for (ch_id=0; ch_id < NCHAN; ch_id=ch_id+1) begin : g_mixer_sin_cos
27
28      mixer #(
29         .NORMALIZE (NORMALIZE),
30         .dwi       (DWI),
31         .davr      (DAVR),
32         .dwlo      (DWLO)
33      )
34      i_mixer_cos
35      (
36         .clk    (clk),
37         .adcf   (adc[(ch_id+1)*DWI-1: ch_id*DWI]),
38         .mult   (cos),
39         .mixout (mixout_i[(ch_id+1)*(DWI+DAVR)-1: ch_id*(DWI+DAVR)])
40      );
41
42      mixer #(
43         .NORMALIZE (NORMALIZE),
44         .dwi       (DWI),
45         .davr      (DAVR),
46         .dwlo      (DWLO)
47      )
48      i_mixer_sin
49      (
50         .clk    (clk),
51         .adcf   (adc[(ch_id+1)*DWI-1: ch_id*DWI]),
52         .mult   (sin),
53         .mixout (mixout_q[(ch_id+1)*(DWI+DAVR)-1: ch_id*(DWI+DAVR)])
54      );
55
56   end endgenerate
57endmodule