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

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

Updated radio controller/bridge v1.21a with support for bypassing interp/dec filters from software; filters can still be excluded from hardware with a parameter

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