source: PlatformSupport/CustomPeripherals/pcores/radio_bridge_v1_30_a/hdl/verilog/radio_bridge.v

Last change on this file was 1705, checked in by murphpo, 12 years ago
File size: 12.2 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    dac_spi_data,
85    dac_spi_cs,
86    dac_spi_clk,
87
88    radio_spi_clk,
89    radio_spi_data,
90    radio_spi_cs,
91
92    radio_SHDN,
93    radio_TxEn,
94    radio_RxEn,
95    radio_RxHP,
96    radio_24PA,
97    radio_5PA,
98    radio_ANTSW,
99    radio_LED,
100    radio_RX_ADC_DCS,
101    radio_RX_ADC_DFS,
102    radio_RX_ADC_PWDNA,
103    radio_RX_ADC_PWDNB,
104    radio_DIPSW,
105    radio_RSSI_ADC_CLAMP,
106    radio_RSSI_ADC_HIZ,
107    radio_RSSI_ADC_SLEEP,
108    radio_RSSI_ADC_D,
109
110    radio_LD,
111    radio_RX_ADC_OTRA,
112    radio_RX_ADC_OTRB,
113    radio_RSSI_ADC_OTR,
114    radio_DAC_PLL_LOCK,
115    radio_DAC_RESET
116);
117
118parameter C_FAMILY = "virtex2p";
119
120/**********************/
121/* Clock & Data Ports */
122/**********************/
123input   converter_clock_in;
124output  converter_clock_out;
125
126input   user_RSSI_ADC_clk;
127output  radio_RSSI_ADC_clk;
128output  [0:9] user_RSSI_ADC_D;
129
130input   user_EEPROM_IO_T;
131input   user_EEPROM_IO_O;
132output  user_EEPROM_IO_I;
133
134output  user_TxModelStart;
135
136output  [0:15] radio_DAC_I;
137output  [0:15] radio_DAC_Q;
138
139input   [0:13] radio_ADC_I;
140input   [0:13] radio_ADC_Q;
141
142input   [0:15] user_DAC_I;
143input   [0:15] user_DAC_Q;
144
145output  [0:13] user_ADC_I;
146output  [0:13] user_ADC_Q;
147
148input   [0:1] user_RxRF_gain;
149input   [0:4] user_RxBB_gain;
150
151input   [0:5] user_Tx_gain;
152
153/* radio_B is a 7-bit bus */
154/* In Rx mode, radio_B[0:1] = RF gain, radio_B[2:6] = baseband gain */
155/* In Tx mode, radio_B[1:6] = gain, radio_B[0] is unused */
156output  [0:6] radio_B;
157
158input   user_SHDN_external;
159input   user_RxEn_external;
160input   user_TxEn_external;
161input   user_RxHP_external;
162
163/*******************************************/
164/* Radio Controller <-> Radio Bridge Ports */
165/*******************************************/
166input   controller_logic_clk;
167input   controller_spi_clk;
168input   controller_spi_data;
169input   controller_radio_cs;
170input   controller_dac_cs;
171
172input   controller_SHDN;
173input   controller_TxEn;
174input   controller_RxEn;
175input   controller_RxHP;
176input   controller_24PA;
177input   controller_5PA;
178input   [0:1] controller_ANTSW;
179input   [0:2] controller_LED;
180input   controller_RX_ADC_DCS;
181input   controller_RX_ADC_DFS;
182input   controller_RX_ADC_PWDNA;
183input   controller_RX_ADC_PWDNB;
184input   controller_RSSI_ADC_CLAMP;
185input   controller_RSSI_ADC_HIZ;
186input   controller_RSSI_ADC_SLEEP;
187input   controller_DAC_RESET;
188input   controller_TxStart;
189
190output  [0:3] controller_DIPSW;
191output  [0:9] controller_RSSI_ADC_D;
192output  controller_LD;
193output  controller_RX_ADC_OTRA;
194output  controller_RX_ADC_OTRB;
195output  controller_RSSI_ADC_OTR;
196output  controller_DAC_PLL_LOCK;
197
198output  controller_SHDN_external;
199output  controller_RxEn_external;
200output  controller_TxEn_external;
201output  controller_RxHP_external;
202
203/**************************************/
204/* Radio Bridge <-> Radio Board Ports */
205/**************************************/
206output  dac_spi_data;
207output  dac_spi_cs;
208output  dac_spi_clk;
209
210output  radio_spi_clk;
211output  radio_spi_data;
212output  radio_spi_cs;
213
214output  radio_SHDN;
215output  radio_TxEn;
216output  radio_RxEn;
217output  radio_RxHP;
218output  radio_24PA;
219output  radio_5PA;
220output  [0:1] radio_ANTSW;
221output  [0:2] radio_LED;
222output  radio_RX_ADC_DCS;
223output  radio_RX_ADC_DFS;
224output  radio_RX_ADC_PWDNA;
225output  radio_RX_ADC_PWDNB;
226output  radio_RSSI_ADC_CLAMP;
227output  radio_RSSI_ADC_HIZ;
228output  radio_RSSI_ADC_SLEEP;
229output  radio_DAC_RESET;
230
231input   [0:9] radio_RSSI_ADC_D;
232input   radio_LD;
233input   radio_RX_ADC_OTRA;
234input   radio_RX_ADC_OTRB;
235input   radio_RSSI_ADC_OTR;
236input   radio_DAC_PLL_LOCK;
237input   [0:3] radio_DIPSW;
238
239inout   radio_EEPROM_IO;
240
241//All the I/O will be registered using IOB registers
242reg radio_RSSI_ADC_clk;
243//reg   [0:9] user_RSSI_ADC_D;
244reg [0:15] radio_DAC_I;
245reg [0:15] radio_DAC_Q;
246
247reg [0:13] user_ADC_I;
248reg [0:13] user_ADC_Q;
249
250reg [0:13] radio_ADC_I_nReg;
251reg [0:13] radio_ADC_Q_nReg;
252
253reg [0:6] radio_B;
254reg [0:3] controller_DIPSW;
255//reg   [0:9] controller_RSSI_ADC_D;
256reg controller_LD;
257reg controller_RX_ADC_OTRA;
258reg controller_RX_ADC_OTRB;
259reg controller_RSSI_ADC_OTR;
260reg controller_DAC_PLL_LOCK;
261reg dac_spi_data;
262reg dac_spi_cs;
263reg dac_spi_clk;
264reg radio_spi_clk;
265reg radio_spi_data;
266reg radio_spi_cs;
267reg radio_SHDN;
268reg radio_TxEn;
269reg radio_RxEn;
270reg radio_RxHP;
271reg radio_24PA;
272reg radio_5PA;
273reg [0:1] radio_ANTSW;
274reg [0:2] radio_LED;
275reg radio_RX_ADC_DCS;
276reg radio_RX_ADC_DFS;
277reg radio_RX_ADC_PWDNA;
278reg radio_RX_ADC_PWDNB;
279reg radio_RSSI_ADC_CLAMP;
280reg radio_RSSI_ADC_HIZ;
281reg radio_RSSI_ADC_SLEEP;
282reg radio_DAC_RESET;
283
284//Drive the clock out to the ADC/DACs
285//synthesis attribute IOB of converter_clock_out IS true;
286OFDDRRSE OFDDRRSE_inst (
287    .Q(converter_clock_out),      // Data output (connect directly to top-level port)
288    .C0(converter_clock_in),    // 0 degree clock input
289    .C1(~converter_clock_in),    // 180 degree clock input
290    .CE(1'b1),    // Clock enable input
291    .D0(1'b1),    // Posedge data input
292    .D1(1'b0),    // Negedge data input
293    .R(1'b0),      // Synchronous reset input
294    .S(1'b0)       // Synchronous preset input
295);
296
297//Pass the Tx start signal through to the user port
298// This is an internal signal, so it won't be registered here
299assign  user_TxModelStart = controller_TxStart;
300
301// Pass user_external signals to the controller
302assign controller_SHDN_external = user_SHDN_external;
303assign controller_RxEn_external = user_RxEn_external;
304assign controller_TxEn_external = user_TxEn_external;
305assign controller_RxHP_external = user_RxHP_external;
306
307
308//Make the gain mux default to the Tx settings, unless Rx is active
309//The Tx gain needs to be zero when TxEn is raised
310//The radio controller outputs zero for TxGain by default
311wire    [0:6] radio_B_preReg;
312//assign radio_B_preReg = radio_RxEn ? {user_RxRF_gain, user_RxBB_gain} : {1'b0, user_Tx_gain};
313assign radio_B_preReg = controller_RxEn ? {user_RxRF_gain, user_RxBB_gain} : {1'b0, user_Tx_gain};
314
315
316/********************************************/
317/* Instantiate the IOBUF for EEPROM Devices */
318/********************************************/
319IOBUF #(
320    .DRIVE(8),
321    .SLEW("SLOW")
322    ) xIOBUF (
323    .T(user_EEPROM_IO_T),
324    .I(user_EEPROM_IO_O),
325    .O(user_EEPROM_IO_I),
326    .IO(radio_EEPROM_IO)
327);
328
329//Capture the incoming ADC signals on the negative
330// edge of the converter clock
331//synthesis attribute IOB of radio_ADC_I_nReg IS true;
332//synthesis attribute IOB of radio_ADC_Q_nReg IS true;
333always @( negedge converter_clock_in )
334begin
335    radio_ADC_I_nReg <= radio_ADC_I;
336    radio_ADC_Q_nReg <= radio_ADC_Q;
337end
338
339
340always @( posedge converter_clock_in )
341begin
342    /*******************************************/
343    /* PHY Cores <-> Radio Board */
344    /*******************************************/
345    radio_B <= radio_B_preReg;
346
347    radio_RSSI_ADC_clk <= user_RSSI_ADC_clk;
348
349    user_ADC_I <= radio_ADC_I_nReg;
350    user_ADC_Q <= radio_ADC_Q_nReg;
351
352    radio_DAC_I <= user_DAC_I;
353    radio_DAC_Q <= user_DAC_Q;
354end
355
356
357//Use the clock provied by the radio_controller to register its I/O
358// This will be a copy of the PLB clock for the controller's bus
359// It may be different than the converter clock (probably faster, but usually still synchronous)
360always @( posedge controller_logic_clk )
361begin
362    /*******************************************/
363    /* Radio Controller -> Radio Board Drivers */
364    /*******************************************/
365    dac_spi_clk <= controller_spi_clk;
366    dac_spi_data <= controller_spi_data;
367    dac_spi_cs <= controller_dac_cs;
368    radio_spi_clk <= controller_spi_clk;
369    radio_spi_data <= controller_spi_data;
370    radio_spi_cs <= controller_radio_cs;
371    radio_SHDN <= controller_SHDN;
372    radio_TxEn <= controller_TxEn;
373    radio_RxEn <= controller_RxEn;
374    radio_RxHP <= controller_RxHP;
375    radio_24PA <= controller_24PA;
376    radio_5PA <= controller_5PA;
377    radio_ANTSW <= controller_ANTSW;
378    radio_LED <= controller_LED;
379    radio_RX_ADC_DCS <= controller_RX_ADC_DCS;
380    radio_RX_ADC_DFS <= controller_RX_ADC_DFS;
381    radio_RX_ADC_PWDNA <= controller_RX_ADC_PWDNA;
382    radio_RX_ADC_PWDNB <= controller_RX_ADC_PWDNB;
383    radio_RSSI_ADC_CLAMP <= controller_RSSI_ADC_CLAMP;
384    radio_RSSI_ADC_HIZ <= controller_RSSI_ADC_HIZ;
385    radio_RSSI_ADC_SLEEP <= controller_RSSI_ADC_SLEEP;
386
387    /*******************************************/
388    /* Radio Board -> Radio Controller Drivers */
389    /*******************************************/
390    controller_DIPSW <= radio_DIPSW;
391    controller_LD <= radio_LD;
392    controller_RX_ADC_OTRA <= radio_RX_ADC_OTRA;
393    controller_RX_ADC_OTRB <= radio_RX_ADC_OTRB;
394    controller_RSSI_ADC_OTR <= radio_RSSI_ADC_OTR;
395    controller_DAC_PLL_LOCK <= radio_DAC_PLL_LOCK;
396    radio_DAC_RESET <= controller_DAC_RESET;
397end
398
399//Delay the user's RSSI clk input by 1 cycle
400reg user_RSSI_ADC_clk_d1;
401always @( posedge controller_logic_clk )
402begin
403    user_RSSI_ADC_clk_d1 <= user_RSSI_ADC_clk;
404end
405
406//Capture the RSSI ADC data in the IOB input registers
407//synthesis attribute IOB of radio_RSSI_ADC_D_d1 IS true;
408//synthesis attribute KEEP of radio_RSSI_ADC_D_d1 IS true;
409reg [9:0] radio_RSSI_ADC_D_d1;
410always @( posedge controller_logic_clk )
411begin
412    //Use rising edge of user-supplied RSSI ADC clock as CE for the RSS ADC data register
413    if(user_RSSI_ADC_clk_d1 & ~user_RSSI_ADC_clk)
414    begin
415        radio_RSSI_ADC_D_d1 <= radio_RSSI_ADC_D;
416    end
417end
418
419
420assign controller_RSSI_ADC_D = radio_RSSI_ADC_D_d1;
421assign user_RSSI_ADC_D = radio_RSSI_ADC_D_d1;
422
423//Use XST attributes to force the registers for these signals into the IOBs
424//synthesis attribute IOB of radio_RSSI_ADC_clk IS true;
425//synthesis attribute IOB of radio_DAC_I IS true;
426//synthesis attribute IOB of radio_DAC_Q IS true;
427//synthesis attribute IOB of radio_B IS true;
428//synthesis attribute IOB of controller_DIPSW IS true;
429//synthesis attribute IOB of controller_LD IS true;
430//synthesis attribute IOB of controller_RX_ADC_OTRA IS true;
431//synthesis attribute IOB of controller_RX_ADC_OTRB IS true;
432//synthesis attribute IOB of controller_RSSI_ADC_OTR IS true;
433//synthesis attribute IOB of controller_DAC_PLL_LOCK IS true;
434//synthesis attribute IOB of dac_spi_cs IS true;
435
436//synthesis attribute IOB of dac_spi_data IS true;
437//synthesis attribute IOB of dac_spi_clk IS true;
438//synthesis attribute IOB of radio_spi_clk IS true;
439//synthesis attribute IOB of radio_spi_data IS true;
440
441//synthesis attribute KEEP of dac_spi_data IS true;
442//synthesis attribute KEEP of dac_spi_clk IS true;
443//synthesis attribute KEEP of radio_spi_clk IS true;
444//synthesis attribute KEEP of radio_spi_data IS true;
445
446//synthesis attribute IOB of radio_spi_cs IS true;
447//synthesis attribute IOB of radio_SHDN IS true;
448//synthesis attribute IOB of radio_TxEn IS true;
449//synthesis attribute IOB of radio_RxEn IS true;
450//synthesis attribute IOB of radio_RxHP IS true;
451//synthesis attribute IOB of radio_24PA IS true;
452//synthesis attribute IOB of radio_5PA IS true;
453//synthesis attribute IOB of radio_ANTSW IS true;
454//synthesis attribute IOB of radio_LED IS true;
455//synthesis attribute IOB of radio_RX_ADC_DCS IS true;
456//synthesis attribute IOB of radio_RX_ADC_DFS IS true;
457//synthesis attribute IOB of radio_RX_ADC_PWDNA IS true;
458//synthesis attribute IOB of radio_RX_ADC_PWDNB IS true;
459//synthesis attribute IOB of radio_RSSI_ADC_CLAMP IS true;
460//synthesis attribute IOB of radio_RSSI_ADC_HIZ IS true;
461//synthesis attribute IOB of radio_RSSI_ADC_SLEEP IS true;
462//synthesis attribute IOB of radio_DAC_RESET IS true;
463
464endmodule
Note: See TracBrowser for help on using the repository browser.