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 ) i_mixer_cos (
34 .clk (clk),
35 .adcf (adc[(ch_id+1)*DWI-1: ch_id*DWI]),
36 .mult (cos),
37 .mixout (mixout_i[(ch_id+1)*(DWI+DAVR)-1: ch_id*(DWI+DAVR)])
38 );
39
40 mixer #(
41 .NORMALIZE (NORMALIZE),
42 .dwi (DWI),
43 .davr (DAVR),
44 .dwlo (DWLO)
45 ) i_mixer_sin (
46 .clk (clk),
47 .adcf (adc[(ch_id+1)*DWI-1: ch_id*DWI]),
48 .mult (sin),
49 .mixout (mixout_q[(ch_id+1)*(DWI+DAVR)-1: ch_id*(DWI+DAVR)])
50 );
51
52 end endgenerate
53endmodule