source: PlatformSupport/Deprecated/pcores/radio_bridge_v1_20_a/hdl/verilog/radio_bridge.v

Last change on this file was 1048, checked in by murphpo, 16 years ago

adding version of radio controller for filter testing

File size: 13.7 KB
Line 
1//////////////////////////////////////////////////////////
2// Copyright (c) 2006 Rice University           //
3// All Rights Reserved                  //
4// This code is covered by the Rice-WARP license    //
5// See http://warp.rice.edu/license/ for details    //
6//////////////////////////////////////////////////////////
7
8module radio_bridge
9(
10    converter_clock_in,
11    converter_clock_out,
12   
13    user_RSSI_ADC_clk,
14    radio_RSSI_ADC_clk,
15
16    user_RSSI_ADC_D,
17
18    user_EEPROM_IO_T,
19    user_EEPROM_IO_O,
20    user_EEPROM_IO_I,
21   
22    user_TxModelStart,
23
24    radio_EEPROM_IO,
25   
26    radio_DAC_I,
27    radio_DAC_Q,
28   
29    radio_ADC_I,
30    radio_ADC_Q,
31
32    user_DAC_I,
33    user_DAC_Q,
34   
35    user_ADC_I,
36    user_ADC_Q,
37   
38    radio_B,
39    user_Tx_gain,
40    user_RxBB_gain,
41    user_RxRF_gain,
42
43    user_SHDN_external,
44    user_RxEn_external,
45    user_TxEn_external,
46    user_RxHP_external,
47
48    controller_spi_clk,
49    controller_spi_data,
50    controller_radio_cs,
51    controller_dac_cs,
52    controller_SHDN,
53    controller_TxEn,
54    controller_RxEn,
55    controller_RxHP,
56    controller_24PA,
57    controller_5PA,
58    controller_ANTSW,
59    controller_LED,
60    controller_RX_ADC_DCS,
61    controller_RX_ADC_DFS,
62    controller_RX_ADC_PWDNA,
63    controller_RX_ADC_PWDNB,
64    controller_DIPSW,
65    controller_RSSI_ADC_CLAMP,
66    controller_RSSI_ADC_HIZ,
67    controller_RSSI_ADC_SLEEP,
68    controller_RSSI_ADC_D,
69    controller_TxStart,
70
71    controller_LD,
72    controller_RX_ADC_OTRA,
73    controller_RX_ADC_OTRB,
74    controller_RSSI_ADC_OTR,
75    controller_DAC_PLL_LOCK,
76    controller_DAC_RESET,
77
78    controller_SHDN_external,
79    controller_RxEn_external,
80    controller_TxEn_external,
81    controller_RxHP_external,
82
83    dac_spi_data,
84    dac_spi_cs,
85    dac_spi_clk,
86
87    radio_spi_clk,
88    radio_spi_data,
89    radio_spi_cs,
90
91    radio_SHDN,
92    radio_TxEn,
93    radio_RxEn,
94    radio_RxHP,
95    radio_24PA,
96    radio_5PA,
97    radio_ANTSW,
98    radio_LED,
99    radio_RX_ADC_DCS,
100    radio_RX_ADC_DFS,
101    radio_RX_ADC_PWDNA,
102    radio_RX_ADC_PWDNB,
103    radio_DIPSW,
104    radio_RSSI_ADC_CLAMP,
105    radio_RSSI_ADC_HIZ,
106    radio_RSSI_ADC_SLEEP,
107    radio_RSSI_ADC_D,
108
109    radio_LD,
110    radio_RX_ADC_OTRA,
111    radio_RX_ADC_OTRB,
112    radio_RSSI_ADC_OTR,
113    radio_DAC_PLL_LOCK,
114    radio_DAC_RESET
115);
116
117//Parameter to choose which set of rate change filters to use
118// Value of 1 bypasses filters altogether; this is the original radio_bridge mode
119// OFDM designs use value of 4 (40MHz converter clock, 10MHz actual bandwidth)
120// May add support for rate change = 2 in the future (requires new filter core)
121// 16-bit datatype to play nice with BSB parameterization
122parameter rate_change = 16'h0001;
123
124//Require parameter to play nice with EDK tools; not used in this version
125parameter C_FAMILY = "virtex2p";
126
127/**********************/
128/* Clock & Data Ports */
129/**********************/
130input   converter_clock_in;
131output  converter_clock_out;
132
133input   user_RSSI_ADC_clk;
134output  radio_RSSI_ADC_clk;
135output  [0:9] user_RSSI_ADC_D;
136
137input   user_EEPROM_IO_T;
138input   user_EEPROM_IO_O;
139output  user_EEPROM_IO_I;
140
141output  user_TxModelStart;
142
143output  [0:15] radio_DAC_I;
144output  [0:15] radio_DAC_Q;
145
146input   [0:13] radio_ADC_I;
147input   [0:13] radio_ADC_Q;
148
149input   [0:15] user_DAC_I;
150input   [0:15] user_DAC_Q;
151
152output  [0:13] user_ADC_I;
153output  [0:13] user_ADC_Q;
154
155input   [0:1] user_RxRF_gain;
156input   [0:4] user_RxBB_gain;
157
158input   [0:5] user_Tx_gain;
159
160/* radio_B is a 7-bit bus */
161/* In Rx mode, radio_B[0:1] = RF gain, radio_B[2:6] = baseband gain */
162/* In Tx mode, radio_B[1:6] = gain, radio_B[0] is unused */
163output  [0:6] radio_B;
164
165input   user_SHDN_external;
166input   user_RxEn_external;
167input   user_TxEn_external;
168input   user_RxHP_external;
169
170/*******************************************/
171/* Radio Controller <-> Radio Bridge Ports */
172/*******************************************/
173input   controller_spi_clk;
174input   controller_spi_data;
175input   controller_radio_cs;
176input   controller_dac_cs;
177
178input   controller_SHDN;
179input   controller_TxEn;
180input   controller_RxEn;
181input   controller_RxHP;
182input   controller_24PA;
183input   controller_5PA;
184input   [0:1] controller_ANTSW;
185input   [0:2] controller_LED;
186input   controller_RX_ADC_DCS;
187input   controller_RX_ADC_DFS;
188input   controller_RX_ADC_PWDNA;
189input   controller_RX_ADC_PWDNB;
190input   controller_RSSI_ADC_CLAMP;
191input   controller_RSSI_ADC_HIZ;
192input   controller_RSSI_ADC_SLEEP;
193input   controller_DAC_RESET;
194input   controller_TxStart;
195
196output  [0:3] controller_DIPSW;
197output  [0:9] controller_RSSI_ADC_D;
198output  controller_LD;
199output  controller_RX_ADC_OTRA;
200output  controller_RX_ADC_OTRB;
201output  controller_RSSI_ADC_OTR;
202output  controller_DAC_PLL_LOCK;
203
204output  controller_SHDN_external;
205output  controller_RxEn_external;
206output  controller_TxEn_external;
207output  controller_RxHP_external;
208
209/**************************************/
210/* Radio Bridge <-> Radio Board Ports */
211/**************************************/
212output  dac_spi_data;
213output  dac_spi_cs;
214output  dac_spi_clk;
215
216output  radio_spi_clk;
217output  radio_spi_data;
218output  radio_spi_cs;
219
220output  radio_SHDN;
221output  radio_TxEn;
222output  radio_RxEn;
223output  radio_RxHP;
224output  radio_24PA;
225output  radio_5PA;
226output  [0:1] radio_ANTSW;
227output  [0:2] radio_LED;
228output  radio_RX_ADC_DCS;
229output  radio_RX_ADC_DFS;
230output  radio_RX_ADC_PWDNA;
231output  radio_RX_ADC_PWDNB;
232output  radio_RSSI_ADC_CLAMP;
233output  radio_RSSI_ADC_HIZ;
234output  radio_RSSI_ADC_SLEEP;
235output  radio_DAC_RESET;
236
237input   [0:9] radio_RSSI_ADC_D;
238input   radio_LD;
239input   radio_RX_ADC_OTRA;
240input   radio_RX_ADC_OTRB;
241input   radio_RSSI_ADC_OTR;
242input   radio_DAC_PLL_LOCK;
243input   [0:3] radio_DIPSW;
244
245inout   radio_EEPROM_IO;
246
247//All the outputs will be registered using IOB registers
248reg radio_RSSI_ADC_clk;
249reg [0:9] user_RSSI_ADC_D;
250reg [0:15] radio_DAC_I;
251reg [0:15] radio_DAC_Q;
252
253reg [0:13] user_ADC_I;
254reg [0:13] user_ADC_Q;
255
256reg [0:13] radio_ADC_I_nReg;
257reg [0:13] radio_ADC_Q_nReg;
258
259reg [0:6] radio_B;
260reg [0:3] controller_DIPSW;
261reg [0:9] controller_RSSI_ADC_D;
262reg controller_LD;
263reg controller_RX_ADC_OTRA;
264reg controller_RX_ADC_OTRB;
265reg controller_RSSI_ADC_OTR;
266reg controller_DAC_PLL_LOCK;
267reg dac_spi_data;
268reg dac_spi_cs;
269reg dac_spi_clk;
270reg radio_spi_clk;
271reg radio_spi_data;
272reg radio_spi_cs;
273reg radio_SHDN;
274reg radio_TxEn;
275reg radio_RxEn;
276reg radio_RxHP;
277reg radio_24PA;
278reg radio_5PA;
279reg [0:1] radio_ANTSW;
280reg [0:2] radio_LED;
281reg radio_RX_ADC_DCS;
282reg radio_RX_ADC_DFS;
283reg radio_RX_ADC_PWDNA;
284reg radio_RX_ADC_PWDNB;
285reg radio_RSSI_ADC_CLAMP;
286reg radio_RSSI_ADC_HIZ;
287reg radio_RSSI_ADC_SLEEP;
288reg radio_DAC_RESET;
289
290//Drive the clock out to the ADC/DACs
291//synthesis attribute IOB of converter_clock_out IS true;
292OFDDRRSE OFDDRRSE_inst (
293    .Q(converter_clock_out),      // Data output (connect directly to top-level port)
294    .C0(converter_clock_in),    // 0 degree clock input
295    .C1(~converter_clock_in),    // 180 degree clock input
296    .CE(1'b1),    // Clock enable input
297    .D0(1'b1),    // Posedge data input
298    .D1(1'b0),    // Negedge data input
299    .R(1'b0),      // Synchronous reset input
300    .S(1'b0)       // Synchronous preset input
301);
302
303//Pass the Tx start signal through to the user port
304// This is an internal signal, so it won't be registered here
305assign  user_TxModelStart = controller_TxStart;
306
307// Pass user_external signals to the controller
308assign controller_SHDN_external = user_SHDN_external;
309assign controller_RxEn_external = user_RxEn_external;
310assign controller_TxEn_external = user_TxEn_external;
311assign controller_RxHP_external = user_RxHP_external;
312
313
314//Make the gain mux default to the Tx settings, unless Rx is active
315//The Tx gain needs to be zero when TxEn is raised
316//The radio controller outputs zero for TxGain by default
317wire    [0:6] radio_B_preReg;
318assign radio_B_preReg = radio_RxEn ? {user_RxRF_gain, user_RxBB_gain} : {1'b0, user_Tx_gain};
319
320wire [15:0] user_DAC_I_interpolated;
321wire [15:0] user_DAC_Q_interpolated;
322wire [13:0] radio_ADC_I_nReg_decimated;
323wire [13:0] radio_ADC_Q_nReg_decimated;
324
325/********************************************/
326/* Instantiate the rate change filters      */
327/********************************************/
328generate
329    if(rate_change == 1) //No filters
330        begin
331            assign radio_ADC_I_nReg_decimated = radio_ADC_I_nReg;
332            assign radio_ADC_Q_nReg_decimated = radio_ADC_Q_nReg;
333            assign user_DAC_I_interpolated = user_DAC_I;
334            assign user_DAC_Q_interpolated = user_DAC_Q;
335        end
336    else
337        begin
338            radio_bridge_ratechangefilter_4x_2ch_cw bridgeFilter (
339                .clk(converter_clock_in),
340                .ce(1'b1),
341
342                //Interpolate when transmitting; decimate otherwise
343                // We use the negation of RxEn instead of TxEn on purpose
344                // The timing of TxEn is controlled by the user's code
345                //  and could be delayed, asserting too close to the first I/Q
346                //  samples; RxEn is disabled long before TxEn is enabled
347                .interp_en(~controller_RxEn),
348
349                .decfiltbypass(1'b1), //FIXME! this should be configurable at runtime!
350               
351                //Full-rate I/Q signals from radio ADC
352                .rx_i_fullrate(radio_ADC_I_nReg),
353                .rx_q_fullrate(radio_ADC_Q_nReg),
354
355                //Quarter-rate I/Q signals output to user's transceiver
356                .rx_i(radio_ADC_I_nReg_decimated),
357                .rx_q(radio_ADC_Q_nReg_decimated),
358
359                //Quarter-rate I/Q signals provided by user's transceiver
360                .tx_i(user_DAC_I),
361                .tx_q(user_DAC_Q),
362
363                //Full-rate I/Q signals output to radio DAC
364                .tx_i_fullrate(user_DAC_I_interpolated),
365                .tx_q_fullrate(user_DAC_Q_interpolated)
366            );
367        end
368endgenerate
369
370/********************************************/
371/* Instantiate the IOBUF for EEPROM Devices */
372/********************************************/
373IOBUF xIOBUF(
374    .T(user_EEPROM_IO_T),
375    .I(user_EEPROM_IO_O),
376    .O(user_EEPROM_IO_I),
377    .IO(radio_EEPROM_IO)
378);
379
380//Capture the incoming ADC signals on the negative
381// edge of the converter clock
382//synthesis attribute IOB of radio_ADC_I_nReg IS true;
383//synthesis attribute IOB of radio_ADC_Q_nReg IS true;
384always @( negedge converter_clock_in )
385begin
386    radio_ADC_I_nReg <= radio_ADC_I;
387    radio_ADC_Q_nReg <= radio_ADC_Q;
388end
389
390always @( posedge converter_clock_in )
391begin
392    /*******************************************/
393    /* OFDM Cores -> Radio Board Drivers */
394    /*******************************************/
395    radio_B <= radio_B_preReg;
396
397    radio_RSSI_ADC_clk <= user_RSSI_ADC_clk;
398
399    user_ADC_I <= radio_ADC_I_nReg_decimated;
400    user_ADC_Q <= radio_ADC_Q_nReg_decimated;
401
402    radio_DAC_I <= user_DAC_I_interpolated;
403    radio_DAC_Q <= user_DAC_Q_interpolated;
404
405    /*******************************************/
406    /* Radio Controller -> Radio Board Drivers */
407    /*******************************************/
408    dac_spi_clk <= controller_spi_clk;
409    dac_spi_data <= controller_spi_data;
410    dac_spi_cs <= controller_dac_cs;
411    radio_spi_clk <= controller_spi_clk;
412    radio_spi_data <= controller_spi_data;
413    radio_spi_cs <= controller_radio_cs;
414    radio_SHDN <= controller_SHDN;
415    radio_TxEn <= controller_TxEn;
416    radio_RxEn <= controller_RxEn;
417    radio_RxHP <= controller_RxHP;
418    radio_24PA <= controller_24PA;
419    radio_5PA <= controller_5PA;
420    radio_ANTSW <= controller_ANTSW;
421    radio_LED <= controller_LED;
422    radio_RX_ADC_DCS <= controller_RX_ADC_DCS;
423    radio_RX_ADC_DFS <= controller_RX_ADC_DFS;
424    radio_RX_ADC_PWDNA <= controller_RX_ADC_PWDNA;
425    radio_RX_ADC_PWDNB <= controller_RX_ADC_PWDNB;
426    radio_RSSI_ADC_CLAMP <= controller_RSSI_ADC_CLAMP;
427    radio_RSSI_ADC_HIZ <= controller_RSSI_ADC_HIZ;
428    radio_RSSI_ADC_SLEEP <= controller_RSSI_ADC_SLEEP;
429
430    /*******************************************/
431    /* Radio Board -> Radio Controller Drivers */
432    /*******************************************/
433    controller_DIPSW <= radio_DIPSW;
434    controller_RSSI_ADC_D <= radio_RSSI_ADC_D;
435    user_RSSI_ADC_D <= radio_RSSI_ADC_D;
436    controller_LD <= radio_LD;
437    controller_RX_ADC_OTRA <= radio_RX_ADC_OTRA;
438    controller_RX_ADC_OTRB <= radio_RX_ADC_OTRB;
439    controller_RSSI_ADC_OTR <= radio_RSSI_ADC_OTR;
440    controller_DAC_PLL_LOCK <= radio_DAC_PLL_LOCK;
441    radio_DAC_RESET <= controller_DAC_RESET;
442end
443
444//Use XST attributes to force the registers for these signals into the IOBs
445//synthesis attribute IOB of radio_RSSI_ADC_clk IS true;
446//synthesis attribute IOB of user_RSSI_ADC_D IS true;
447//synthesis attribute IOB of radio_DAC_I IS true;
448//synthesis attribute IOB of radio_DAC_Q IS true;
449//synthesis attribute IOB of radio_B IS true;
450//synthesis attribute IOB of controller_DIPSW IS true;
451//synthesis attribute IOB of controller_RSSI_ADC_D IS true;
452//synthesis attribute IOB of controller_LD IS true;
453//synthesis attribute IOB of controller_RX_ADC_OTRA IS true;
454//synthesis attribute IOB of controller_RX_ADC_OTRB IS true;
455//synthesis attribute IOB of controller_RSSI_ADC_OTR IS true;
456//synthesis attribute IOB of controller_DAC_PLL_LOCK IS true;
457//synthesis attribute IOB of dac_spi_data IS true;
458//synthesis attribute IOB of dac_spi_cs IS true;
459//synthesis attribute IOB of dac_spi_clk IS true;
460//synthesis attribute IOB of radio_spi_clk IS true;
461//synthesis attribute IOB of radio_spi_data IS true;
462//synthesis attribute IOB of radio_spi_cs IS true;
463//synthesis attribute IOB of radio_SHDN IS true;
464//synthesis attribute IOB of radio_TxEn IS true;
465//synthesis attribute IOB of radio_RxEn IS true;
466//synthesis attribute IOB of radio_RxHP IS true;
467//synthesis attribute IOB of radio_24PA IS true;
468//synthesis attribute IOB of radio_5PA IS true;
469//synthesis attribute IOB of radio_ANTSW IS true;
470//synthesis attribute IOB of radio_LED IS true;
471//synthesis attribute IOB of radio_RX_ADC_DCS IS true;
472//synthesis attribute IOB of radio_RX_ADC_DFS IS true;
473//synthesis attribute IOB of radio_RX_ADC_PWDNA IS true;
474//synthesis attribute IOB of radio_RX_ADC_PWDNB IS true;
475//synthesis attribute IOB of radio_RSSI_ADC_CLAMP IS true;
476//synthesis attribute IOB of radio_RSSI_ADC_HIZ IS true;
477//synthesis attribute IOB of radio_RSSI_ADC_SLEEP IS true;
478//synthesis attribute IOB of radio_DAC_RESET IS true;
479
480endmodule
481
482//Empty module declaration for filter NGC netlist
483// See mdlsrc folder for source System Generator model
484
485module radio_bridge_ratechangefilter_4x_2ch_cw (
486  clk,
487  ce,
488  decfiltbypass,
489  interp_en,
490  rx_i,
491  rx_i_fullrate,
492  rx_q,
493  rx_q_fullrate,
494  tx_i,
495  tx_i_fullrate,
496  tx_q,
497  tx_q_fullrate
498);
499
500    input  clk;
501    input  ce;
502    input decfiltbypass;
503    input interp_en;
504    input [13:0] rx_i_fullrate;
505    input [13:0] rx_q_fullrate;
506    input [15:0] tx_i;
507    input [15:0] tx_q;
508    output [13:0] rx_i;
509    output [13:0] rx_q;
510    output [15:0] tx_i_fullrate;
511    output [15:0] tx_q_fullrate;
512
513endmodule
Note: See TracBrowser for help on using the repository browser.