2 //////////////////////////////////////////////////////////////////////////////////
7 output [4:0] leds, // LED4 is shared w/INIT_B
10 output [1:0] debug_clk,
15 input exp_pps_in_p, // Diff
16 input exp_pps_in_n, // Diff
17 output exp_pps_out_p, // Diff
18 output exp_pps_out_n, // Diff
26 output reg [7:0] GMII_TXD,
27 output reg GMII_TX_EN,
28 output reg GMII_TX_ER,
30 input GMII_TX_CLK, // 100mbps clk
41 input PHY_INTn, // open drain
43 input PHY_CLK, // possibly use on-board osc
54 output reg [15:0] ser_t,
77 input dac_lock, // unused for now
86 input clk_func, // FIXME is an input to control the 9510
90 input clk_fpga_p, // Diff
91 input clk_fpga_n, // Diff
101 // TX side SPI -- tx_db, tx_adc, tx_dac, 9777
138 // FPGA-specific pins connections
139 wire aux_clk = PHY_CLK;
141 wire clk_fpga, dsp_clk, clk_div, dcm_out, wb_clk, clock_ready;
143 IBUFGDS clk_fpga_pin (.O(clk_fpga),.I(clk_fpga_p),.IB(clk_fpga_n));
144 defparam clk_fpga_pin.IOSTANDARD = "LVPECL_25";
147 IBUFDS exp_pps_in_pin (.O(exp_pps_in),.I(exp_pps_in_p),.IB(exp_pps_in_n));
148 defparam exp_pps_in_pin.IOSTANDARD = "LVDS_25";
151 OBUFDS exp_pps_out_pin (.O(exp_pps_out_p),.OB(exp_pps_out_n),.I(exp_pps_out));
152 defparam exp_pps_out_pin.IOSTANDARD = "LVDS_25";
154 reg [5:0] clock_ready_d;
155 always @(posedge aux_clk)
156 clock_ready_d[5:0] <= {clock_ready_d[4:0],clock_ready};
158 wire dcm_rst = ~&clock_ready_d & |clock_ready_d;
159 wire clk_muxed = clock_ready ? clk_fpga : aux_clk;
161 wire adc_on_a, adc_on_b, adc_oe_a, adc_oe_b;
162 assign adc_oen_a = ~adc_oe_a;
163 assign adc_oen_b = ~adc_oe_b;
164 assign adc_pdn_a = ~adc_on_a;
165 assign adc_pdn_b = ~adc_on_b;
168 DCM DCM_INST (.CLKFB(dsp_clk),
187 defparam DCM_INST.CLK_FEEDBACK = "1X";
188 defparam DCM_INST.CLKDV_DIVIDE = 2.0;
189 defparam DCM_INST.CLKFX_DIVIDE = 1;
190 defparam DCM_INST.CLKFX_MULTIPLY = 4;
191 defparam DCM_INST.CLKIN_DIVIDE_BY_2 = "FALSE";
192 defparam DCM_INST.CLKIN_PERIOD = 10.000;
193 defparam DCM_INST.CLKOUT_PHASE_SHIFT = "NONE";
194 defparam DCM_INST.DESKEW_ADJUST = "SYSTEM_SYNCHRONOUS";
195 defparam DCM_INST.DFS_FREQUENCY_MODE = "LOW";
196 defparam DCM_INST.DLL_FREQUENCY_MODE = "LOW";
197 defparam DCM_INST.DUTY_CYCLE_CORRECTION = "TRUE";
198 defparam DCM_INST.FACTORY_JF = 16'h8080;
199 defparam DCM_INST.PHASE_SHIFT = 0;
200 defparam DCM_INST.STARTUP_WAIT = "FALSE";
202 BUFG dspclk_BUFG (.I(dcm_out), .O(dsp_clk));
203 BUFG wbclk_BUFG (.I(clk_div), .O(wb_clk));
205 // I2C -- Don't use external transistors for open drain, the FPGA implements this
206 IOBUF scl_pin(.O(scl_pad_i), .IO(SCL), .I(scl_pad_o), .T(scl_pad_oen_o));
207 IOBUF sda_pin(.O(sda_pad_i), .IO(SDA), .I(sda_pad_o), .T(sda_pad_oen_o));
209 // LEDs are active low outputs
211 assign leds = ~leds_int; // drive low to turn on leds
214 wire miso, mosi, sclk_int;
215 assign {sclk,sdi} = (~sen_clk | ~sen_dac) ? {sclk_int,mosi} : 2'b0;
216 assign {sclk_tx_db,sdi_tx_db} = ~sen_tx_db ? {sclk_int,mosi} : 2'b0;
217 assign {sclk_tx_dac,sdi_tx_dac} = ~sen_tx_dac ? {sclk_int,mosi} : 2'b0;
218 assign {sclk_tx_adc,sdi_tx_adc} = ~sen_tx_adc ? {sclk_int,mosi} : 2'b0;
219 assign {sclk_rx_db,sdi_rx_db} = ~sen_rx_db ? {sclk_int,mosi} : 2'b0;
220 assign {sclk_rx_dac,sdi_rx_dac} = ~sen_rx_dac ? {sclk_int,mosi} : 2'b0;
221 assign {sclk_rx_adc,sdi_rx_adc} = ~sen_rx_adc ? {sclk_int,mosi} : 2'b0;
223 assign miso = (~sen_clk & sdo) | (~sen_dac & sdo) |
224 (~sen_tx_db & sdo_tx_db) | (~sen_tx_adc & sdo_tx_adc) |
225 (~sen_rx_db & sdo_rx_db) | (~sen_rx_adc & sdo_rx_adc);
227 wire GMII_TX_EN_unreg, GMII_TX_ER_unreg;
228 wire [7:0] GMII_TXD_unreg;
229 wire GMII_GTX_CLK_int;
231 always @(posedge GMII_GTX_CLK_int)
233 GMII_TX_EN <= GMII_TX_EN_unreg;
234 GMII_TX_ER <= GMII_TX_ER_unreg;
235 GMII_TXD <= GMII_TXD_unreg;
238 OFDDRRSE OFDDRRSE_gmii_inst
239 (.Q(GMII_GTX_CLK), // Data output (connect directly to top-level port)
240 .C0(GMII_GTX_CLK_int), // 0 degree clock input
241 .C1(~GMII_GTX_CLK_int), // 180 degree clock input
242 .CE(1), // Clock enable input
243 .D0(0), // Posedge data input
244 .D1(1), // Negedge data input
245 .R(0), // Synchronous reset input
246 .S(0) // Synchronous preset input
249 wire ser_tklsb_unreg, ser_tkmsb_unreg;
250 wire [15:0] ser_t_unreg;
253 always @(posedge ser_tx_clk_int)
255 ser_tklsb <= ser_tklsb_unreg;
256 ser_tkmsb <= ser_tkmsb_unreg;
257 ser_t <= ser_t_unreg;
260 assign ser_tx_clk = clk_fpga;
262 reg [15:0] ser_r_int;
263 reg ser_rklsb_int, ser_rkmsb_int;
265 always @(posedge ser_rx_clk)
268 ser_rklsb_int <= ser_rklsb;
269 ser_rkmsb_int <= ser_rkmsb;
273 OFDDRRSE OFDDRRSE_serdes_inst
274 (.Q(ser_tx_clk), // Data output (connect directly to top-level port)
275 .C0(ser_tx_clk_int), // 0 degree clock input
276 .C1(~ser_tx_clk_int), // 180 degree clock input
277 .CE(1), // Clock enable input
278 .D0(0), // Posedge data input
279 .D1(1), // Negedge data input
280 .R(0), // Synchronous reset input
281 .S(0) // Synchronous preset input
284 u2_core u2_core(.dsp_clk (dsp_clk),
286 .clock_ready (clock_ready),
287 .clk_to_mac (clk_to_mac),
290 .debug (debug[31:0]),
291 .debug_clk (debug_clk[1:0]),
292 .exp_pps_in (exp_pps_in),
293 .exp_pps_out (exp_pps_out),
294 .GMII_COL (GMII_COL),
295 .GMII_CRS (GMII_CRS),
296 .GMII_TXD (GMII_TXD_unreg[7:0]),
297 .GMII_TX_EN (GMII_TX_EN_unreg),
298 .GMII_TX_ER (GMII_TX_ER_unreg),
299 .GMII_GTX_CLK (GMII_GTX_CLK_int),
300 .GMII_TX_CLK (GMII_TX_CLK),
301 .GMII_RXD (GMII_RXD[7:0]),
302 .GMII_RX_CLK (GMII_RX_CLK),
303 .GMII_RX_DV (GMII_RX_DV),
304 .GMII_RX_ER (GMII_RX_ER),
307 .PHY_INTn (PHY_INTn),
308 .PHY_RESETn (PHY_RESETn),
310 .ser_enable (ser_enable),
311 .ser_prbsen (ser_prbsen),
312 .ser_loopen (ser_loopen),
313 .ser_rx_en (ser_rx_en),
314 .ser_tx_clk (ser_tx_clk_int),
315 .ser_t (ser_t_unreg[15:0]),
316 .ser_tklsb (ser_tklsb_unreg),
317 .ser_tkmsb (ser_tkmsb_unreg),
318 .ser_rx_clk (ser_rx_clk),
319 .ser_r (ser_r_int[15:0]),
320 .ser_rklsb (ser_rklsb_int),
321 .ser_rkmsb (ser_rkmsb_int),
322 .cpld_start (cpld_start),
323 .cpld_mode (cpld_mode),
324 .cpld_done (cpld_done),
325 .cpld_din (cpld_din),
326 .cpld_clk (cpld_clk),
327 .cpld_detached (cpld_detached),
328 .adc_a (adc_a[13:0]),
329 .adc_ovf_a (adc_ovf_a),
330 .adc_on_a (adc_on_a),
331 .adc_oe_a (adc_oe_a),
332 .adc_b (adc_b[13:0]),
333 .adc_ovf_b (adc_ovf_b),
334 .adc_on_b (adc_on_b),
335 .adc_oe_b (adc_oe_b),
336 .dac_a (dac_a[15:0]),
337 .dac_b (dac_b[15:0]),
338 .scl_pad_i (scl_pad_i),
339 .scl_pad_o (scl_pad_o),
340 .scl_pad_oen_o (scl_pad_oen_o),
341 .sda_pad_i (sda_pad_i),
342 .sda_pad_o (sda_pad_o),
343 .sda_pad_oen_o (sda_pad_oen_o),
344 .clk_en (clk_en[1:0]),
345 .clk_sel (clk_sel[1:0]),
346 .clk_func (clk_func),
347 .clk_status (clk_status),
353 .sen_tx_db (sen_tx_db),
354 .sen_tx_adc (sen_tx_adc),
355 .sen_tx_dac (sen_tx_dac),
356 .sen_rx_db (sen_rx_db),
357 .sen_rx_adc (sen_rx_adc),
358 .sen_rx_dac (sen_rx_dac),
359 .io_tx (io_tx[15:0]),
360 .io_rx (io_rx[15:0]),
363 .RAM_CE1n (RAM_CE1n),
364 .RAM_CENn (RAM_CENn),
369 .uart_tx_o (uart_tx_o),
370 //.uart_rx_i (uart_rx_i),