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

Last change on this file was 1416, checked in by sgupta, 14 years ago

radio bridge 1.22 bug test

File size: 12.8 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
118//Parameter to choose which set of rate change filters to use
119// Default is 4 (40MHz converter clock, 10MHz actual bandwidth)
120// Value of 1 bypasses filters altogether; this is the original radio_bridge mode
121// May add support for rate change = 2 in the future (requires new filter core)
122// 16-bit datatype to play nice with BSB parameterization
123//parameter rate_change = 16'h0004;
124
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_logic_clk;
174input   controller_spi_clk;
175input   controller_spi_data;
176input   controller_radio_cs;
177input   controller_dac_cs;
178
179input   controller_SHDN;
180input   controller_TxEn;
181input   controller_RxEn;
182input   controller_RxHP;
183input   controller_24PA;
184input   controller_5PA;
185input   [0:1] controller_ANTSW;
186input   [0:2] controller_LED;
187input   controller_RX_ADC_DCS;
188input   controller_RX_ADC_DFS;
189input   controller_RX_ADC_PWDNA;
190input   controller_RX_ADC_PWDNB;
191input   controller_RSSI_ADC_CLAMP;
192input   controller_RSSI_ADC_HIZ;
193input   controller_RSSI_ADC_SLEEP;
194input   controller_DAC_RESET;
195input   controller_TxStart;
196
197output  [0:3] controller_DIPSW;
198output  [0:9] controller_RSSI_ADC_D;
199output  controller_LD;
200output  controller_RX_ADC_OTRA;
201output  controller_RX_ADC_OTRB;
202output  controller_RSSI_ADC_OTR;
203output  controller_DAC_PLL_LOCK;
204
205output  controller_SHDN_external;
206output  controller_RxEn_external;
207output  controller_TxEn_external;
208output  controller_RxHP_external;
209
210/**************************************/
211/* Radio Bridge <-> Radio Board Ports */
212/**************************************/
213output  dac_spi_data;
214output  dac_spi_cs;
215output  dac_spi_clk;
216
217output  radio_spi_clk;
218output  radio_spi_data;
219output  radio_spi_cs;
220
221output  radio_SHDN;
222output  radio_TxEn;
223output  radio_RxEn;
224output  radio_RxHP;
225output  radio_24PA;
226output  radio_5PA;
227output  [0:1] radio_ANTSW;
228output  [0:2] radio_LED;
229output  radio_RX_ADC_DCS;
230output  radio_RX_ADC_DFS;
231output  radio_RX_ADC_PWDNA;
232output  radio_RX_ADC_PWDNB;
233output  radio_RSSI_ADC_CLAMP;
234output  radio_RSSI_ADC_HIZ;
235output  radio_RSSI_ADC_SLEEP;
236output  radio_DAC_RESET;
237
238input   [0:9] radio_RSSI_ADC_D;
239input   radio_LD;
240input   radio_RX_ADC_OTRA;
241input   radio_RX_ADC_OTRB;
242input   radio_RSSI_ADC_OTR;
243input   radio_DAC_PLL_LOCK;
244input   [0:3] radio_DIPSW;
245
246inout   radio_EEPROM_IO;
247
248//All the outputs will be registered using IOB registers
249reg radio_RSSI_ADC_clk;
250reg [0:9] user_RSSI_ADC_D;
251reg [0:15] radio_DAC_I;
252reg [0:15] radio_DAC_Q;
253
254reg [0:13] user_ADC_I;
255reg [0:13] user_ADC_Q;
256
257reg [0:13] radio_ADC_I_nReg;
258reg [0:13] radio_ADC_Q_nReg;
259
260reg [0:6] radio_B;
261reg [0:3] controller_DIPSW;
262reg [0:9] controller_RSSI_ADC_D;
263reg controller_LD;
264reg controller_RX_ADC_OTRA;
265reg controller_RX_ADC_OTRB;
266reg controller_RSSI_ADC_OTR;
267reg controller_DAC_PLL_LOCK;
268reg dac_spi_data;
269reg dac_spi_cs;
270reg dac_spi_clk;
271reg radio_spi_clk;
272reg radio_spi_data;
273reg radio_spi_cs;
274reg radio_SHDN;
275reg radio_TxEn;
276reg radio_RxEn;
277reg radio_RxHP;
278reg radio_24PA;
279reg radio_5PA;
280reg [0:1] radio_ANTSW;
281reg [0:2] radio_LED;
282reg radio_RX_ADC_DCS;
283reg radio_RX_ADC_DFS;
284reg radio_RX_ADC_PWDNA;
285reg radio_RX_ADC_PWDNB;
286reg radio_RSSI_ADC_CLAMP;
287reg radio_RSSI_ADC_HIZ;
288reg radio_RSSI_ADC_SLEEP;
289reg radio_DAC_RESET;
290
291//Drive the clock out to the ADC/DACs
292//synthesis attribute IOB of converter_clock_out IS true;
293OFDDRRSE OFDDRRSE_inst (
294    .Q(converter_clock_out),      // Data output (connect directly to top-level port)
295    .C0(converter_clock_in),    // 0 degree clock input
296    .C1(~converter_clock_in),    // 180 degree clock input
297    .CE(1'b1),    // Clock enable input
298    .D0(1'b1),    // Posedge data input
299    .D1(1'b0),    // Negedge data input
300    .R(1'b0),      // Synchronous reset input
301    .S(1'b0)       // Synchronous preset input
302);
303
304//Pass the Tx start signal through to the user port
305// This is an internal signal, so it won't be registered here
306assign  user_TxModelStart = controller_TxStart;
307
308// Pass user_external signals to the controller
309assign controller_SHDN_external = user_SHDN_external;
310assign controller_RxEn_external = user_RxEn_external;
311assign controller_TxEn_external = user_TxEn_external;
312assign controller_RxHP_external = user_RxHP_external;
313
314
315//Make the gain mux default to the Tx settings, unless Rx is active
316//The Tx gain needs to be zero when TxEn is raised
317//The radio controller outputs zero for TxGain by default
318wire    [0:6] radio_B_preReg;
319assign radio_B_preReg = radio_RxEn ? {user_RxRF_gain, user_RxBB_gain} : {1'b0, user_Tx_gain};
320
321
322/********************************************/
323/* Instantiate the IOBUF for EEPROM Devices */
324/********************************************/
325IOBUF xIOBUF(
326    .T(user_EEPROM_IO_T),
327    .I(user_EEPROM_IO_O),
328    .O(user_EEPROM_IO_I),
329    .IO(radio_EEPROM_IO)
330);
331
332//Capture the incoming ADC signals on the negative
333// edge of the converter clock
334//synthesis attribute IOB of radio_ADC_I_nReg IS true;
335//synthesis attribute IOB of radio_ADC_Q_nReg IS true;
336always @( negedge converter_clock_in )
337begin
338    radio_ADC_I_nReg <= radio_ADC_I;
339    radio_ADC_Q_nReg <= radio_ADC_Q;
340end
341
342
343always @( posedge converter_clock_in )
344begin
345    /*******************************************/
346    /* PHY Cores <-> Radio Board */
347    /*******************************************/
348    radio_B <= radio_B_preReg;
349
350    radio_RSSI_ADC_clk <= user_RSSI_ADC_clk;
351
352    user_ADC_I <= radio_ADC_I_nReg;
353    user_ADC_Q <= radio_ADC_Q_nReg;
354
355    radio_DAC_I <= user_DAC_I;
356    radio_DAC_Q <= user_DAC_Q;
357end
358
359
360//Use the clock provied by the radio_controller to register its I/O
361// This will be a copy of the PLB clock for the controller's bus
362// It may be different than the converter clock (probably faster, but usually still synchronous)
363always @( posedge controller_logic_clk )
364begin
365    /*******************************************/
366    /* Radio Controller -> Radio Board Drivers */
367    /*******************************************/
368    dac_spi_clk <= controller_spi_clk;
369    dac_spi_data <= controller_spi_data;
370    dac_spi_cs <= controller_dac_cs;
371    radio_spi_clk <= controller_spi_clk;
372    radio_spi_data <= controller_spi_data;
373    radio_spi_cs <= controller_radio_cs;
374    radio_SHDN <= controller_SHDN;
375    radio_TxEn <= controller_TxEn;
376    radio_RxEn <= controller_RxEn;
377    radio_RxHP <= controller_RxHP;
378    radio_24PA <= controller_24PA;
379    radio_5PA <= controller_5PA;
380    radio_ANTSW <= controller_ANTSW;
381    radio_LED <= controller_LED;
382    radio_RX_ADC_DCS <= controller_RX_ADC_DCS;
383    radio_RX_ADC_DFS <= controller_RX_ADC_DFS;
384    radio_RX_ADC_PWDNA <= controller_RX_ADC_PWDNA;
385    radio_RX_ADC_PWDNB <= controller_RX_ADC_PWDNB;
386    radio_RSSI_ADC_CLAMP <= controller_RSSI_ADC_CLAMP;
387    radio_RSSI_ADC_HIZ <= controller_RSSI_ADC_HIZ;
388    radio_RSSI_ADC_SLEEP <= controller_RSSI_ADC_SLEEP;
389
390    /*******************************************/
391    /* Radio Board -> Radio Controller Drivers */
392    /*******************************************/
393    controller_DIPSW <= radio_DIPSW;
394    controller_LD <= radio_LD;
395    controller_RX_ADC_OTRA <= radio_RX_ADC_OTRA;
396    controller_RX_ADC_OTRB <= radio_RX_ADC_OTRB;
397    controller_RSSI_ADC_OTR <= radio_RSSI_ADC_OTR;
398    controller_DAC_PLL_LOCK <= radio_DAC_PLL_LOCK;
399    radio_DAC_RESET <= controller_DAC_RESET;
400end
401
402//Delay the user's RSSI clk input by 1 cycle
403reg user_RSSI_ADC_clk_d1;
404always @( posedge controller_logic_clk )
405begin
406    user_RSSI_ADC_clk_d1 <= user_RSSI_ADC_clk;
407end
408
409//Only update the RSSI input regisers on the rising edge
410// of the user-supplied RSSI clk; we'll assume the RSSI clk is
411// synchronous with the bus clock for the radio controller's PLB
412always @( posedge controller_logic_clk )
413begin
414    if(user_RSSI_ADC_clk & ~user_RSSI_ADC_clk_d1)
415    begin
416        controller_RSSI_ADC_D <= radio_RSSI_ADC_D;
417        user_RSSI_ADC_D <= radio_RSSI_ADC_D;
418    end
419end
420
421//Use XST attributes to force the registers for these signals into the IOBs
422//synthesis attribute IOB of radio_RSSI_ADC_clk IS true;
423//synthesis attribute IOB of user_RSSI_ADC_D IS true;
424//synthesis attribute IOB of radio_DAC_I IS true;
425//synthesis attribute IOB of radio_DAC_Q IS true;
426//synthesis attribute IOB of radio_B IS true;
427//synthesis attribute IOB of controller_DIPSW IS true;
428//synthesis attribute IOB of controller_RSSI_ADC_D 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_data IS true;
435//synthesis attribute IOB of dac_spi_cs IS true;
436//synthesis attribute IOB of dac_spi_clk IS true;
437//synthesis attribute IOB of radio_spi_clk IS true;
438//synthesis attribute IOB of radio_spi_data IS true;
439//synthesis attribute IOB of radio_spi_cs IS true;
440//synthesis attribute IOB of radio_SHDN IS true;
441//synthesis attribute IOB of radio_TxEn IS true;
442//synthesis attribute IOB of radio_RxEn IS true;
443//synthesis attribute IOB of radio_RxHP IS true;
444//synthesis attribute IOB of radio_24PA IS true;
445//synthesis attribute IOB of radio_5PA IS true;
446//synthesis attribute IOB of radio_ANTSW IS true;
447//synthesis attribute IOB of radio_LED IS true;
448//synthesis attribute IOB of radio_RX_ADC_DCS IS true;
449//synthesis attribute IOB of radio_RX_ADC_DFS IS true;
450//synthesis attribute IOB of radio_RX_ADC_PWDNA IS true;
451//synthesis attribute IOB of radio_RX_ADC_PWDNB IS true;
452//synthesis attribute IOB of radio_RSSI_ADC_CLAMP IS true;
453//synthesis attribute IOB of radio_RSSI_ADC_HIZ IS true;
454//synthesis attribute IOB of radio_RSSI_ADC_SLEEP IS true;
455//synthesis attribute IOB of radio_DAC_RESET IS true;
456
457endmodule
458
459//Empty module declaration for filter NGC netlist
460// See mdlsrc folder for source System Generator model
461module radio_bridge_ratechangefilter_4x_2ch_cw (
462  clk,
463  ce,
464  decfiltbypass,
465  interpfiltbypass,
466  interp_en,
467  rx_i,
468  rx_i_fullrate,
469  rx_q,
470  rx_q_fullrate,
471  tx_i,
472  tx_i_fullrate,
473  tx_q,
474  tx_q_fullrate
475);
476    input   clk;
477    input   ce;
478    input   decfiltbypass;
479    input   interpfiltbypass;
480    input   interp_en;
481    input   [13:0] rx_i_fullrate;
482    input   [13:0] rx_q_fullrate;
483    input   [15:0] tx_i;
484    input   [15:0] tx_q;
485    output  [13:0] rx_i;
486    output  [13:0] rx_q;
487    output  [15:0] tx_i_fullrate;
488    output  [15:0] tx_q_fullrate;
489endmodule
Note: See TracBrowser for help on using the repository browser.