2 //////////////////////////////////////////////////////////////////////////////////
10 output [1:0] debug_clk,
13 input exp_pps_in_p, // Diff
14 input exp_pps_in_n, // Diff
15 output exp_pps_out_p, // Diff
16 output exp_pps_out_n, // Diff
24 output reg [7:0] GMII_TXD,
25 output reg GMII_TX_EN,
26 output reg GMII_TX_ER,
28 input GMII_TX_CLK, // 100mbps clk
39 input PHY_INTn, // open drain
41 input PHY_CLK, // possibly use on-board osc
60 output reg [15:0] ser_t,
70 output cpld_start, // AA9
71 output cpld_mode, // U12
72 output cpld_done, // V12
73 input cpld_din, // AA14 Now shared with CFG_Din
74 input cpld_clk, // AB14 serial clock
100 input clk_func, // FIXME is an input to control the 9510
104 input clk_fpga_p, // Diff
105 input clk_fpga_n, // Diff
151 // FPGA-specific pins connections
152 wire aux_clk = PHY_CLK;
153 //wire cpld_detached = RAM_A[14]; // FIXME Hacked on with Blue Wire
154 wire cpld_detached = SDA_force; // FIXME Hacked on with Blue Wire
156 wire clk_fpga, dsp_clk, clk_div, dcm_out, wb_clk, clock_ready;
158 IBUFGDS clk_fpga_pin (.O(clk_fpga),.I(clk_fpga_p),.IB(clk_fpga_n));
159 defparam clk_fpga_pin.IOSTANDARD = "LVPECL_25";
162 IBUFDS exp_pps_in_pin (.O(exp_pps_in),.I(exp_pps_in_p),.IB(exp_pps_in_n));
163 defparam exp_pps_in_pin.IOSTANDARD = "LVDS_25";
166 OBUFDS exp_pps_out_pin (.O(exp_pps_out_p),.OB(exp_pps_out_n),.I(exp_pps_out));
167 defparam exp_pps_out_pin.IOSTANDARD = "LVDS_25";
169 reg [5:0] clock_ready_d;
170 always @(posedge aux_clk)
171 clock_ready_d[5:0] <= {clock_ready_d[4:0],clock_ready};
173 wire dcm_rst = ~&clock_ready_d & |clock_ready_d;
174 wire clk_muxed = clock_ready ? clk_fpga : aux_clk;
176 wire adc_on_a, adc_on_b, adc_oe_a, adc_oe_b;
177 assign adc_oen_a = ~adc_oe_a;
178 assign adc_oen_b = ~adc_oe_b;
179 assign adc_pdn_a = ~adc_on_a;
180 assign adc_pdn_b = ~adc_on_b;
183 DCM DCM_INST (.CLKFB(dsp_clk),
202 defparam DCM_INST.CLK_FEEDBACK = "1X";
203 defparam DCM_INST.CLKDV_DIVIDE = 2.0;
204 defparam DCM_INST.CLKFX_DIVIDE = 1;
205 defparam DCM_INST.CLKFX_MULTIPLY = 4;
206 defparam DCM_INST.CLKIN_DIVIDE_BY_2 = "FALSE";
207 defparam DCM_INST.CLKIN_PERIOD = 10.000;
208 defparam DCM_INST.CLKOUT_PHASE_SHIFT = "NONE";
209 defparam DCM_INST.DESKEW_ADJUST = "SYSTEM_SYNCHRONOUS";
210 defparam DCM_INST.DFS_FREQUENCY_MODE = "LOW";
211 defparam DCM_INST.DLL_FREQUENCY_MODE = "LOW";
212 defparam DCM_INST.DUTY_CYCLE_CORRECTION = "TRUE";
213 defparam DCM_INST.FACTORY_JF = 16'h8080;
214 defparam DCM_INST.PHASE_SHIFT = 0;
215 defparam DCM_INST.STARTUP_WAIT = "FALSE";
217 BUFG dspclk_BUFG (.I(dcm_out), .O(dsp_clk));
218 BUFG wbclk_BUFG (.I(clk_div), .O(wb_clk));
220 // I2C -- Don't use external transistors for open drain, the FPGA implements this
221 IOBUF scl_pin(.O(scl_pad_i), .IO(SCL), .I(scl_pad_o), .T(scl_pad_oen_o));
222 IOBUF sda_pin(.O(sda_pad_i), .IO(SDA), .I(sda_pad_o), .T(sda_pad_oen_o));
224 // LEDs are active low outputs
225 wire led1_int, led2_int;
226 assign led1 = ~led1_int;
227 assign led2 = ~led2_int;
230 wire miso, mosi, sclk_int;
231 assign {sclk,sdi} = (~sen_clk | ~sen_dac) ? {sclk_int,mosi} : 2'b0;
232 assign {sclk_tx_db,sdi_tx_db} = ~sen_tx_db ? {sclk_int,mosi} : 2'b0;
233 assign {sclk_tx_dac,sdi_tx_dac} = ~sen_tx_dac ? {sclk_int,mosi} : 2'b0;
234 assign {sclk_tx_adc,sdi_tx_adc} = ~sen_tx_adc ? {sclk_int,mosi} : 2'b0;
235 assign {sclk_rx_db,sdi_rx_db} = ~sen_rx_db ? {sclk_int,mosi} : 2'b0;
236 assign {sclk_rx_dac,sdi_rx_dac} = ~sen_rx_dac ? {sclk_int,mosi} : 2'b0;
237 assign {sclk_rx_adc,sdi_rx_adc} = ~sen_rx_adc ? {sclk_int,mosi} : 2'b0;
239 assign miso = (~sen_clk & sdo) | (~sen_dac & sdo) |
240 (~sen_tx_db & sdo_tx_db) | (~sen_tx_adc & sdo_tx_adc) |
241 (~sen_rx_db & sdo_rx_db) | (~sen_rx_adc & sdo_rx_adc);
243 wire GMII_TX_EN_unreg, GMII_TX_ER_unreg;
244 wire [7:0] GMII_TXD_unreg;
245 wire GMII_GTX_CLK_int;
247 always @(posedge GMII_GTX_CLK_int)
249 GMII_TX_EN <= GMII_TX_EN_unreg;
250 GMII_TX_ER <= GMII_TX_ER_unreg;
251 GMII_TXD <= GMII_TXD_unreg;
254 OFDDRRSE OFDDRRSE_gmii_inst
255 (.Q(GMII_GTX_CLK), // Data output (connect directly to top-level port)
256 .C0(GMII_GTX_CLK_int), // 0 degree clock input
257 .C1(~GMII_GTX_CLK_int), // 180 degree clock input
258 .CE(1), // Clock enable input
259 .D0(0), // Posedge data input
260 .D1(1), // Negedge data input
261 .R(0), // Synchronous reset input
262 .S(0) // Synchronous preset input
265 wire ser_tklsb_unreg, ser_tkmsb_unreg;
266 wire [15:0] ser_t_unreg;
269 always @(posedge ser_tx_clk_int)
271 ser_tklsb <= ser_tklsb_unreg;
272 ser_tkmsb <= ser_tkmsb_unreg;
273 ser_t <= ser_t_unreg;
276 assign ser_tx_clk = clk_fpga;
278 reg [15:0] ser_r_int;
279 reg ser_rklsb_int, ser_rkmsb_int;
281 always @(posedge ser_rx_clk)
284 ser_rklsb_int <= ser_rklsb;
285 ser_rkmsb_int <= ser_rkmsb;
289 OFDDRRSE OFDDRRSE_serdes_inst
290 (.Q(ser_tx_clk), // Data output (connect directly to top-level port)
291 .C0(ser_tx_clk_int), // 0 degree clock input
292 .C1(~ser_tx_clk_int), // 180 degree clock input
293 .CE(1), // Clock enable input
294 .D0(0), // Posedge data input
295 .D1(1), // Negedge data input
296 .R(0), // Synchronous reset input
297 .S(0) // Synchronous preset input
300 u2_basic u2_basic(.dsp_clk (dsp_clk),
302 .clock_ready (clock_ready),
303 .clk_to_mac (clk_to_mac),
307 .debug (debug[31:0]),
308 .debug_clk (debug_clk[1:0]),
309 .exp_pps_in (exp_pps_in),
310 .exp_pps_out (exp_pps_out),
311 .GMII_COL (GMII_COL),
312 .GMII_CRS (GMII_CRS),
313 .GMII_TXD (GMII_TXD_unreg[7:0]),
314 .GMII_TX_EN (GMII_TX_EN_unreg),
315 .GMII_TX_ER (GMII_TX_ER_unreg),
316 .GMII_GTX_CLK (GMII_GTX_CLK_int),
317 .GMII_TX_CLK (GMII_TX_CLK),
318 .GMII_RXD (GMII_RXD[7:0]),
319 .GMII_RX_CLK (GMII_RX_CLK),
320 .GMII_RX_DV (GMII_RX_DV),
321 .GMII_RX_ER (GMII_RX_ER),
324 .PHY_INTn (PHY_INTn),
325 .PHY_RESETn (PHY_RESETn),
327 .ser_enable (ser_enable),
328 .ser_prbsen (ser_prbsen),
329 .ser_loopen (ser_loopen),
330 .ser_rx_en (ser_rx_en),
331 .ser_tx_clk (ser_tx_clk_int),
332 .ser_t (ser_t_unreg[15:0]),
333 .ser_tklsb (ser_tklsb_unreg),
334 .ser_tkmsb (ser_tkmsb_unreg),
335 .ser_rx_clk (ser_rx_clk),
336 .ser_r (ser_r_int[15:0]),
337 .ser_rklsb (ser_rklsb_int),
338 .ser_rkmsb (ser_rkmsb_int),
339 .cpld_start (cpld_start),
340 .cpld_mode (cpld_mode),
341 .cpld_done (cpld_done),
342 .cpld_din (cpld_din),
343 .cpld_clk (cpld_clk),
344 .cpld_detached (cpld_detached),
345 .adc_a (adc_a[13:0]),
346 .adc_ovf_a (adc_ovf_a),
347 .adc_on_a (adc_on_a),
348 .adc_oe_a (adc_oe_a),
349 .adc_b (adc_b[13:0]),
350 .adc_ovf_b (adc_ovf_b),
351 .adc_on_b (adc_on_b),
352 .adc_oe_b (adc_oe_b),
353 .dac_a (dac_a[15:0]),
354 .dac_b (dac_b[15:0]),
355 .scl_pad_i (scl_pad_i),
356 .scl_pad_o (scl_pad_o),
357 .scl_pad_oen_o (scl_pad_oen_o),
358 .sda_pad_i (sda_pad_i),
359 .sda_pad_o (sda_pad_o),
360 .sda_pad_oen_o (sda_pad_oen_o),
361 .clk_en (clk_en[1:0]),
362 .clk_sel (clk_sel[1:0]),
363 .clk_func (clk_func),
364 .clk_status (clk_status),
370 .sen_tx_db (sen_tx_db),
371 .sen_tx_adc (sen_tx_adc),
372 .sen_tx_dac (sen_tx_dac),
373 .sen_rx_db (sen_rx_db),
374 .sen_rx_adc (sen_rx_adc),
375 .sen_rx_dac (sen_rx_dac),
376 .io_tx (io_tx[15:0]),
377 .io_rx (io_rx[15:0]),
380 .RAM_CE1n (RAM_CE1n),
381 .RAM_CENn (RAM_CENn),
393 endmodule // u2_fpga_top