1 |
9 |
jefflieu |
// -------------------------------------------------------------------------
|
2 |
|
|
// -------------------------------------------------------------------------
|
3 |
|
|
//
|
4 |
|
|
// Revision Control Information
|
5 |
|
|
//
|
6 |
|
|
// $RCSfile: altera_tse_pcs_pma_gige.v,v $
|
7 |
|
|
// $Source: /ipbu/cvs/sio/projects/TriSpeedEthernet/src/RTL/Top_level_modules/altera_tse_pcs_pma_gige_phyip.v,v $
|
8 |
|
|
//
|
9 |
|
|
// $Revision: #13 $
|
10 |
|
|
// $Date: 2010/10/19 $
|
11 |
|
|
// Check in by : $Author: aishak $
|
12 |
|
|
// Author : Arul Paniandi
|
13 |
|
|
//
|
14 |
|
|
// Project : Triple Speed Ethernet
|
15 |
|
|
//
|
16 |
|
|
// Description :
|
17 |
|
|
//
|
18 |
|
|
// Top level PCS + PMA module for Triple Speed Ethernet PCS + PMA
|
19 |
|
|
|
20 |
|
|
//
|
21 |
|
|
// ALTERA Confidential and Proprietary
|
22 |
|
|
// Copyright 2006 (c) Altera Corporation
|
23 |
|
|
// All rights reserved
|
24 |
|
|
//
|
25 |
|
|
// -------------------------------------------------------------------------
|
26 |
|
|
// -------------------------------------------------------------------------
|
27 |
|
|
|
28 |
|
|
//Legal Notice: (C)2007 Altera Corporation. All rights reserved. Your
|
29 |
|
|
//use of Altera Corporation's design tools, logic functions and other
|
30 |
|
|
//software and tools, and its AMPP partner logic functions, and any
|
31 |
|
|
//output files any of the foregoing (including device programming or
|
32 |
|
|
//simulation files), and any associated documentation or information are
|
33 |
|
|
//expressly subject to the terms and conditions of the Altera Program
|
34 |
|
|
//License Subscription Agreement or other applicable license agreement,
|
35 |
|
|
//including, without limitation, that your use is for the sole purpose
|
36 |
|
|
//of programming logic devices manufactured by Altera and sold by Altera
|
37 |
|
|
//or its authorized distributors. Please refer to the applicable
|
38 |
|
|
//agreement for further details.
|
39 |
|
|
|
40 |
|
|
(*altera_attribute = {"-name SYNCHRONIZER_IDENTIFICATION OFF;SUPPRESS_DA_RULE_INTERNAL=\"R102,R105,D102,D101,D103\"" } *)
|
41 |
|
|
module altera_tse_pcs_pma_gige_phyip (
|
42 |
|
|
// inputs:
|
43 |
|
|
address,
|
44 |
|
|
clk,
|
45 |
|
|
gmii_tx_d,
|
46 |
|
|
gmii_tx_en,
|
47 |
|
|
gmii_tx_err,
|
48 |
|
|
mii_tx_d,
|
49 |
|
|
mii_tx_en,
|
50 |
|
|
mii_tx_err,
|
51 |
|
|
read,
|
52 |
|
|
reconfig_togxb,
|
53 |
|
|
ref_clk,
|
54 |
|
|
reset,
|
55 |
|
|
reset_rx_clk,
|
56 |
|
|
reset_tx_clk,
|
57 |
|
|
rxp,
|
58 |
|
|
write,
|
59 |
|
|
writedata,
|
60 |
|
|
|
61 |
|
|
// outputs:
|
62 |
|
|
gmii_rx_d,
|
63 |
|
|
gmii_rx_dv,
|
64 |
|
|
gmii_rx_err,
|
65 |
|
|
hd_ena,
|
66 |
|
|
led_an,
|
67 |
|
|
led_char_err,
|
68 |
|
|
led_col,
|
69 |
|
|
led_crs,
|
70 |
|
|
led_disp_err,
|
71 |
|
|
led_link,
|
72 |
|
|
mii_col,
|
73 |
|
|
mii_crs,
|
74 |
|
|
mii_rx_d,
|
75 |
|
|
mii_rx_dv,
|
76 |
|
|
mii_rx_err,
|
77 |
|
|
readdata,
|
78 |
|
|
reconfig_fromgxb,
|
79 |
|
|
rx_clk,
|
80 |
|
|
set_10,
|
81 |
|
|
set_100,
|
82 |
|
|
set_1000,
|
83 |
|
|
tx_clk,
|
84 |
|
|
rx_clkena,
|
85 |
|
|
tx_clkena,
|
86 |
|
|
txp,
|
87 |
|
|
rx_recovclkout,
|
88 |
|
|
waitrequest,
|
89 |
|
|
|
90 |
|
|
// phy_mgmt_interface
|
91 |
|
|
phy_mgmt_address,
|
92 |
|
|
phy_mgmt_read,
|
93 |
|
|
phy_mgmt_readdata,
|
94 |
|
|
phy_mgmt_waitrequest,
|
95 |
|
|
phy_mgmt_write,
|
96 |
|
|
phy_mgmt_writedata
|
97 |
|
|
|
98 |
|
|
);
|
99 |
|
|
|
100 |
|
|
|
101 |
|
|
// Parameters to configure the core for different variations
|
102 |
|
|
// ---------------------------------------------------------
|
103 |
|
|
|
104 |
|
|
parameter PHY_IDENTIFIER = 32'h 00000000; // PHY Identifier
|
105 |
|
|
parameter DEV_VERSION = 16'h 0001 ; // Customer Phy's Core Version
|
106 |
|
|
parameter ENABLE_SGMII = 1; // Enable SGMII logic for synthesis
|
107 |
|
|
parameter EXPORT_PWRDN = 1'b0; // Option to export the Alt2gxb powerdown signal
|
108 |
|
|
parameter DEVICE_FAMILY = "ARRIAGX"; // The device family the the core is targetted for.
|
109 |
|
|
parameter TRANSCEIVER_OPTION = 1'b0; // Option to select transceiver block for MAC PCS PMA Instantiation.
|
110 |
|
|
// Valid Values are 0 and 1: 0 - GXB (GIGE Mode) 1 - LVDS I/O.
|
111 |
|
|
//parameter STARTING_CHANNEL_NUMBER = 0; // Starting Channel Number for Reconfig block
|
112 |
|
|
parameter ENABLE_ALT_RECONFIG = 0; // Option to expose the alt_reconfig ports
|
113 |
|
|
parameter SYNCHRONIZER_DEPTH = 3; // Number of synchronizer
|
114 |
|
|
|
115 |
|
|
output [7:0] gmii_rx_d;
|
116 |
|
|
output gmii_rx_dv;
|
117 |
|
|
output gmii_rx_err;
|
118 |
|
|
output hd_ena;
|
119 |
|
|
output led_an;
|
120 |
|
|
output led_char_err;
|
121 |
|
|
output led_col;
|
122 |
|
|
output led_crs;
|
123 |
|
|
output led_disp_err;
|
124 |
|
|
output led_link;
|
125 |
|
|
output mii_col;
|
126 |
|
|
output mii_crs;
|
127 |
|
|
output [3:0] mii_rx_d;
|
128 |
|
|
output mii_rx_dv;
|
129 |
|
|
output mii_rx_err;
|
130 |
|
|
output [15:0] readdata;
|
131 |
|
|
output [91:0] reconfig_fromgxb;
|
132 |
|
|
output rx_clk;
|
133 |
|
|
output set_10;
|
134 |
|
|
output set_100;
|
135 |
|
|
output set_1000;
|
136 |
|
|
output tx_clk;
|
137 |
|
|
output rx_clkena;
|
138 |
|
|
output tx_clkena;
|
139 |
|
|
output txp;
|
140 |
|
|
output rx_recovclkout;
|
141 |
|
|
output waitrequest;
|
142 |
|
|
|
143 |
|
|
input [4:0] address;
|
144 |
|
|
input clk;
|
145 |
|
|
input [7:0] gmii_tx_d;
|
146 |
|
|
input gmii_tx_en;
|
147 |
|
|
input gmii_tx_err;
|
148 |
|
|
input [3:0] mii_tx_d;
|
149 |
|
|
input mii_tx_en;
|
150 |
|
|
input mii_tx_err;
|
151 |
|
|
input read;
|
152 |
|
|
input [139:0] reconfig_togxb;
|
153 |
|
|
input ref_clk;
|
154 |
|
|
input reset;
|
155 |
|
|
input reset_rx_clk;
|
156 |
|
|
input reset_tx_clk;
|
157 |
|
|
input rxp;
|
158 |
|
|
input write;
|
159 |
|
|
input [15:0] writedata;
|
160 |
|
|
|
161 |
|
|
input [8:0] phy_mgmt_address;
|
162 |
|
|
input phy_mgmt_read;
|
163 |
|
|
output [31:0] phy_mgmt_readdata;
|
164 |
|
|
output phy_mgmt_waitrequest;
|
165 |
|
|
input phy_mgmt_write;
|
166 |
|
|
input [31:0]phy_mgmt_writedata;
|
167 |
|
|
|
168 |
|
|
wire PCS_rx_reset;
|
169 |
|
|
wire PCS_tx_reset;
|
170 |
|
|
wire PCS_reset;
|
171 |
|
|
wire gige_pma_reset;
|
172 |
|
|
wire [7:0] gmii_rx_d;
|
173 |
|
|
wire gmii_rx_dv;
|
174 |
|
|
wire gmii_rx_err;
|
175 |
|
|
wire hd_ena;
|
176 |
|
|
wire led_an;
|
177 |
|
|
wire led_char_err;
|
178 |
|
|
wire led_char_err_gx;
|
179 |
|
|
wire led_col;
|
180 |
|
|
wire led_crs;
|
181 |
|
|
wire led_disp_err;
|
182 |
|
|
wire led_link;
|
183 |
|
|
wire link_status;
|
184 |
|
|
wire mii_col;
|
185 |
|
|
wire mii_crs;
|
186 |
|
|
wire [3:0] mii_rx_d;
|
187 |
|
|
wire mii_rx_dv;
|
188 |
|
|
wire mii_rx_err;
|
189 |
|
|
wire rx_pcs_clk;
|
190 |
|
|
wire tx_pcs_clk;
|
191 |
|
|
wire [7:0] pcs_rx_frame;
|
192 |
|
|
wire pcs_rx_kchar;
|
193 |
|
|
|
194 |
|
|
wire [15:0] readdata;
|
195 |
|
|
wire rx_char_err_gx;
|
196 |
|
|
wire rx_clk;
|
197 |
|
|
wire rx_disp_err;
|
198 |
|
|
wire [7:0] rx_frame;
|
199 |
|
|
wire rx_syncstatus;
|
200 |
|
|
wire rx_kchar;
|
201 |
|
|
wire set_10;
|
202 |
|
|
wire set_100;
|
203 |
|
|
wire set_1000;
|
204 |
|
|
wire tx_clk;
|
205 |
|
|
wire rx_clkena;
|
206 |
|
|
wire tx_clkena;
|
207 |
|
|
wire [7:0] tx_frame;
|
208 |
|
|
wire tx_kchar;
|
209 |
|
|
wire txp;
|
210 |
|
|
wire waitrequest;
|
211 |
|
|
wire sd_loopback;
|
212 |
|
|
|
213 |
|
|
wire rx_runlengthviolation;
|
214 |
|
|
wire rx_patterndetect;
|
215 |
|
|
wire rx_runningdisp;
|
216 |
|
|
wire rx_rmfifodatadeleted;
|
217 |
|
|
wire rx_rmfifodatainserted;
|
218 |
|
|
wire pcs_rx_rmfifodatadeleted;
|
219 |
|
|
wire pcs_rx_rmfifodatainserted;
|
220 |
|
|
wire pcs_rx_carrierdetected;
|
221 |
|
|
|
222 |
|
|
wire [91:0] reconfig_fromgxb;
|
223 |
|
|
wire reset_rx_pcs_clk_int;
|
224 |
|
|
wire reset_reset_rx_clk;
|
225 |
|
|
wire reset_reset_tx_clk;
|
226 |
|
|
|
227 |
|
|
altera_tse_reset_synchronizer reset_sync_2 (
|
228 |
|
|
.clk(rx_clk),
|
229 |
|
|
.reset_in(reset),
|
230 |
|
|
.reset_out(reset_reset_rx_clk)
|
231 |
|
|
);
|
232 |
|
|
|
233 |
|
|
altera_tse_reset_synchronizer reset_sync_3 (
|
234 |
|
|
.clk(tx_clk),
|
235 |
|
|
.reset_in(reset),
|
236 |
|
|
.reset_out(reset_reset_tx_clk)
|
237 |
|
|
);
|
238 |
|
|
|
239 |
|
|
assign PCS_rx_reset = reset_rx_clk | reset_reset_rx_clk;
|
240 |
|
|
assign PCS_tx_reset = reset_tx_clk | reset_reset_tx_clk;
|
241 |
|
|
assign PCS_reset = reset;
|
242 |
|
|
|
243 |
|
|
// Assign the character error and link status to top level leds
|
244 |
|
|
// ------------------------------------------------------------
|
245 |
|
|
assign led_char_err = led_char_err_gx;
|
246 |
|
|
assign led_link = link_status;
|
247 |
|
|
|
248 |
|
|
|
249 |
|
|
|
250 |
|
|
// Instantiation of the PCS core that connects to a PMA
|
251 |
|
|
// --------------------------------------------------------
|
252 |
|
|
altera_tse_top_1000_base_x_strx_gx altera_tse_top_1000_base_x_strx_gx_inst
|
253 |
|
|
(
|
254 |
|
|
.rx_carrierdetected(pcs_rx_carrierdetected),
|
255 |
|
|
.rx_rmfifodatadeleted(pcs_rx_rmfifodatadeleted),
|
256 |
|
|
.rx_rmfifodatainserted(pcs_rx_rmfifodatainserted),
|
257 |
|
|
.gmii_rx_d (gmii_rx_d),
|
258 |
|
|
.gmii_rx_dv (gmii_rx_dv),
|
259 |
|
|
.gmii_rx_err (gmii_rx_err),
|
260 |
|
|
.gmii_tx_d (gmii_tx_d),
|
261 |
|
|
.gmii_tx_en (gmii_tx_en),
|
262 |
|
|
.gmii_tx_err (gmii_tx_err),
|
263 |
|
|
.hd_ena (hd_ena),
|
264 |
|
|
.led_an (led_an),
|
265 |
|
|
.led_char_err (led_char_err_gx),
|
266 |
|
|
.led_col (led_col),
|
267 |
|
|
.led_crs (led_crs),
|
268 |
|
|
.led_link (link_status),
|
269 |
|
|
.mii_col (mii_col),
|
270 |
|
|
.mii_crs (mii_crs),
|
271 |
|
|
.mii_rx_d (mii_rx_d),
|
272 |
|
|
.mii_rx_dv (mii_rx_dv),
|
273 |
|
|
.mii_rx_err (mii_rx_err),
|
274 |
|
|
.mii_tx_d (mii_tx_d),
|
275 |
|
|
.mii_tx_en (mii_tx_en),
|
276 |
|
|
.mii_tx_err (mii_tx_err),
|
277 |
|
|
.powerdown (),
|
278 |
|
|
.reg_addr (address),
|
279 |
|
|
.reg_busy (waitrequest),
|
280 |
|
|
.reg_clk (clk),
|
281 |
|
|
.reg_data_in (writedata),
|
282 |
|
|
.reg_data_out (readdata),
|
283 |
|
|
.reg_rd (read),
|
284 |
|
|
.reg_wr (write),
|
285 |
|
|
.reset_reg_clk (PCS_reset),
|
286 |
|
|
.reset_rx_clk (PCS_rx_reset),
|
287 |
|
|
.reset_tx_clk (PCS_tx_reset),
|
288 |
|
|
.rx_clk (rx_clk),
|
289 |
|
|
.rx_clkout (rx_pcs_clk),
|
290 |
|
|
.rx_frame (pcs_rx_frame),
|
291 |
|
|
.rx_kchar (pcs_rx_kchar),
|
292 |
|
|
.sd_loopback (sd_loopback),
|
293 |
|
|
.set_10 (set_10),
|
294 |
|
|
.set_100 (set_100),
|
295 |
|
|
.set_1000 (set_1000),
|
296 |
|
|
.tx_clk (tx_clk),
|
297 |
|
|
.rx_clkena(rx_clkena),
|
298 |
|
|
.tx_clkena(tx_clkena),
|
299 |
|
|
.ref_clk(1'b0),
|
300 |
|
|
.tx_clkout (tx_pcs_clk),
|
301 |
|
|
.tx_frame (tx_frame),
|
302 |
|
|
.tx_kchar (tx_kchar)
|
303 |
|
|
|
304 |
|
|
);
|
305 |
|
|
defparam
|
306 |
|
|
altera_tse_top_1000_base_x_strx_gx_inst.PHY_IDENTIFIER = PHY_IDENTIFIER,
|
307 |
|
|
altera_tse_top_1000_base_x_strx_gx_inst.DEV_VERSION = DEV_VERSION,
|
308 |
|
|
altera_tse_top_1000_base_x_strx_gx_inst.ENABLE_SGMII = ENABLE_SGMII;
|
309 |
|
|
|
310 |
|
|
|
311 |
|
|
// Instantiation of the Alt2gxb block as the PMA for Stratix_II_GX and ArriaGX devices
|
312 |
|
|
// -----------------------------------------------------------------------------------
|
313 |
|
|
|
314 |
|
|
altera_tse_reset_synchronizer ch_0_reset_sync_0 (
|
315 |
|
|
.clk(rx_pcs_clk),
|
316 |
|
|
//.reset_in(rx_digitalreset_sqcnr),
|
317 |
|
|
.reset_in(reset),
|
318 |
|
|
.reset_out(reset_rx_pcs_clk_int)
|
319 |
|
|
);
|
320 |
|
|
|
321 |
|
|
// Aligned Rx_sync from gxb
|
322 |
|
|
// -------------------------------
|
323 |
|
|
altera_tse_gxb_aligned_rxsync the_altera_tse_gxb_aligned_rxsync
|
324 |
|
|
(
|
325 |
|
|
.clk(rx_pcs_clk),
|
326 |
|
|
.reset(reset_rx_pcs_clk_int),
|
327 |
|
|
//input (from alt2gxb)
|
328 |
|
|
.alt_dataout(rx_frame),
|
329 |
|
|
.alt_sync(rx_syncstatus),
|
330 |
|
|
.alt_disperr(rx_disp_err),
|
331 |
|
|
.alt_ctrldetect(rx_kchar),
|
332 |
|
|
.alt_errdetect(rx_char_err_gx),
|
333 |
|
|
.alt_rmfifodatadeleted(rx_rmfifodatadeleted),
|
334 |
|
|
.alt_rmfifodatainserted(rx_rmfifodatainserted),
|
335 |
|
|
.alt_runlengthviolation(rx_runlengthviolation),
|
336 |
|
|
.alt_patterndetect(rx_patterndetect),
|
337 |
|
|
.alt_runningdisp(rx_runningdisp),
|
338 |
|
|
|
339 |
|
|
//output (to PCS)
|
340 |
|
|
.altpcs_dataout(pcs_rx_frame),
|
341 |
|
|
.altpcs_sync(link_status),
|
342 |
|
|
.altpcs_disperr(led_disp_err),
|
343 |
|
|
.altpcs_ctrldetect(pcs_rx_kchar),
|
344 |
|
|
.altpcs_errdetect(led_char_err_gx),
|
345 |
|
|
.altpcs_rmfifodatadeleted(pcs_rx_rmfifodatadeleted),
|
346 |
|
|
.altpcs_rmfifodatainserted(pcs_rx_rmfifodatainserted),
|
347 |
|
|
.altpcs_carrierdetect(pcs_rx_carrierdetected)
|
348 |
|
|
|
349 |
|
|
) ;
|
350 |
|
|
defparam
|
351 |
|
|
the_altera_tse_gxb_aligned_rxsync.DEVICE_FAMILY = DEVICE_FAMILY;
|
352 |
|
|
|
353 |
|
|
|
354 |
|
|
// Custom PhyIP
|
355 |
|
|
// ------------------------------------------
|
356 |
|
|
altera_tse_gxb_gige_phyip_inst the_altera_tse_gxb_gige_phyip_inst(
|
357 |
|
|
.phy_mgmt_clk(clk), // phy_mgmt_clk.clk
|
358 |
|
|
.phy_mgmt_clk_reset(reset), // phy_mgmt_clk_reset.reset
|
359 |
|
|
.phy_mgmt_address(phy_mgmt_address), // phy_mgmt.address
|
360 |
|
|
.phy_mgmt_read(phy_mgmt_read), // .read
|
361 |
|
|
.phy_mgmt_readdata(phy_mgmt_readdata), // .readdata
|
362 |
|
|
.phy_mgmt_waitrequest(phy_mgmt_waitrequest), // .waitrequest
|
363 |
|
|
.phy_mgmt_write(phy_mgmt_write), // .write
|
364 |
|
|
.phy_mgmt_writedata(phy_mgmt_writedata), // .writedata
|
365 |
|
|
.tx_ready(), // tx_ready.export
|
366 |
|
|
.rx_ready(), // rx_ready.export
|
367 |
|
|
.pll_ref_clk(ref_clk), // pll_ref_clk.clk
|
368 |
|
|
.pll_locked(), // pll_locked.export
|
369 |
|
|
.tx_serial_data(txp), // tx_serial_data.export
|
370 |
|
|
.rx_serial_data(rxp), // rx_serial_data.export
|
371 |
|
|
.rx_runningdisp(rx_runningdisp), // rx_runningdisp.export
|
372 |
|
|
.rx_disperr(rx_disp_err), // rx_disperr.export
|
373 |
|
|
.rx_errdetect(rx_char_err_gx), // rx_errdetect.export
|
374 |
|
|
.rx_patterndetect(rx_patterndetect), // rx_patterndetect.export
|
375 |
|
|
.rx_syncstatus(rx_syncstatus), // rx_syncstatus.export
|
376 |
|
|
.tx_clkout(tx_pcs_clk), // tx_clkout0.clk
|
377 |
|
|
.rx_clkout(rx_pcs_clk), // rx_clkout0.clk
|
378 |
|
|
.tx_parallel_data(tx_frame), // tx_parallel_data0.data
|
379 |
|
|
.tx_datak(tx_kchar), // tx_datak0.data
|
380 |
|
|
.rx_parallel_data(rx_frame), // rx_parallel_data0.data
|
381 |
|
|
.rx_datak(rx_kchar), // rx_datak0.data
|
382 |
|
|
.rx_rlv(rx_runlengthviolation),
|
383 |
|
|
.rx_recovclkout(rx_recovclkout),
|
384 |
|
|
.rx_rmfifodatadeleted(rx_rmfifodatadeleted),
|
385 |
|
|
.rx_rmfifodatainserted(rx_rmfifodatainserted),
|
386 |
|
|
.reconfig_togxb(reconfig_togxb),
|
387 |
|
|
.reconfig_fromgxb(reconfig_fromgxb)
|
388 |
|
|
);
|
389 |
|
|
defparam
|
390 |
|
|
the_altera_tse_gxb_gige_phyip_inst.ENABLE_ALT_RECONFIG = ENABLE_ALT_RECONFIG,
|
391 |
|
|
the_altera_tse_gxb_gige_phyip_inst.DEVICE_FAMILY = DEVICE_FAMILY,
|
392 |
|
|
the_altera_tse_gxb_gige_phyip_inst.ENABLE_SGMII = ENABLE_SGMII;
|
393 |
|
|
|
394 |
|
|
endmodule
|
395 |
|
|
|