1 |
3 |
dwp |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// File name "ge_1000baseX_test.v" ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// This file is part of the : ////
|
6 |
|
|
//// ////
|
7 |
|
|
//// "1000BASE-X IEEE 802.3-2008 Clause 36 - PCS project" ////
|
8 |
|
|
//// ////
|
9 |
|
|
//// http://opencores.org/project,1000base-x ////
|
10 |
|
|
//// ////
|
11 |
|
|
//// Author(s): ////
|
12 |
|
|
//// - D.W.Pegler Cambridge Broadband Networks Ltd ////
|
13 |
|
|
//// ////
|
14 |
|
|
//// { peglerd@gmail.com, dwp@cambridgebroadand.com } ////
|
15 |
|
|
//// ////
|
16 |
|
|
//////////////////////////////////////////////////////////////////////
|
17 |
|
|
//// ////
|
18 |
|
|
//// Copyright (C) 2009 AUTHORS. All rights reserved. ////
|
19 |
|
|
//// ////
|
20 |
|
|
//// This source file may be used and distributed without ////
|
21 |
|
|
//// restriction provided that this copyright statement is not ////
|
22 |
|
|
//// removed from the file and that any derivative work contains ////
|
23 |
|
|
//// the original copyright notice and the associated disclaimer. ////
|
24 |
|
|
//// ////
|
25 |
|
|
//// This source file is free software; you can redistribute it ////
|
26 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
27 |
|
|
//// Public License as published by the Free Software Foundation; ////
|
28 |
|
|
//// either version 2.1 of the License, or (at your option) any ////
|
29 |
|
|
//// later version. ////
|
30 |
|
|
//// ////
|
31 |
|
|
//// This source is distributed in the hope that it will be ////
|
32 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
33 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
34 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
35 |
|
|
//// details. ////
|
36 |
|
|
//// ////
|
37 |
|
|
//// You should have received a copy of the GNU Lesser General ////
|
38 |
|
|
//// Public License along with this source; if not, download it ////
|
39 |
|
|
//// from http://www.opencores.org/lgpl.shtml ////
|
40 |
|
|
//// ////
|
41 |
|
|
//////////////////////////////////////////////////////////////////////
|
42 |
|
|
//// ////
|
43 |
|
|
//// This module is based on the coding method described in ////
|
44 |
|
|
//// IEEE Std 802.3-2008 Clause 36 "Physical Coding Sublayer(PCS) ////
|
45 |
|
|
//// and Physical Medium Attachment (PMA) sublayer, type ////
|
46 |
|
|
//// 1000BASE-X"; see : ////
|
47 |
|
|
//// ////
|
48 |
|
|
//// http://standards.ieee.org/about/get/802/802.3.html ////
|
49 |
|
|
//// and ////
|
50 |
|
|
//// doc/802.3-2008_section3.pdf, Clause/Section 36. ////
|
51 |
|
|
//// ////
|
52 |
|
|
//////////////////////////////////////////////////////////////////////
|
53 |
|
|
|
54 |
|
|
`include "timescale.v"
|
55 |
|
|
|
56 |
|
|
module ge_1000baseX_test
|
57 |
|
|
(
|
58 |
|
|
// --- Resets ---
|
59 |
|
|
input reset_pin,
|
60 |
|
|
|
61 |
|
|
// --- GE 125MHz reference clock ---
|
62 |
|
|
input GE_125MHz_ref_ckpin,
|
63 |
|
|
|
64 |
|
|
// --- FO TBI 125MHz Rx clk ---
|
65 |
|
|
input tbi_rx_ckpin,
|
66 |
|
|
|
67 |
|
|
// --- Fibre-Optic (fo) GE TBI Interface ---
|
68 |
|
|
input [9:0] tbi_rxd,
|
69 |
|
|
output [9:0] tbi_txd,
|
70 |
|
|
|
71 |
|
|
// --- GMII interface ---
|
72 |
|
|
output [7:0] gmii_rxd,
|
73 |
|
|
output gmii_rx_dv,
|
74 |
|
|
output gmii_rx_er,
|
75 |
|
|
output gmii_col,
|
76 |
|
|
output gmii_cs,
|
77 |
|
|
|
78 |
|
|
input [7:0] gmii_txd,
|
79 |
|
|
input gmii_tx_en,
|
80 |
|
|
input gmii_tx_er,
|
81 |
|
|
|
82 |
|
|
// --- Fibre-Optic (fo) ctrl signals ---
|
83 |
|
|
output sync_en,
|
84 |
|
|
output loop_en,
|
85 |
|
|
output prbs_en,
|
86 |
|
|
|
87 |
|
|
input signal_detect,
|
88 |
|
|
input sync,
|
89 |
|
|
|
90 |
|
|
// --- MDIO interface
|
91 |
|
|
inout mdio,
|
92 |
|
|
input mdio_ckpin
|
93 |
|
|
);
|
94 |
|
|
|
95 |
|
|
assign sync_en = 1'b0;
|
96 |
|
|
assign loop_en = 1'b0;
|
97 |
|
|
assign prbs_en = 1'b0;
|
98 |
|
|
|
99 |
|
|
|
100 |
|
|
//----------------------------------------------------------------------------
|
101 |
|
|
// MDIO/MDC clock buffering
|
102 |
|
|
//----------------------------------------------------------------------------
|
103 |
|
|
|
104 |
|
|
IBUFG mdio_ckpin_bufi(.I(mdio_ckpin), .O(mdio_ckpin_buf));
|
105 |
|
|
|
106 |
|
|
BUFG mdio_ck_bufi(.I(mdio_ckpin_buf), .O(mdc));
|
107 |
|
|
|
108 |
|
|
//----------------------------------------------------------------------------
|
109 |
|
|
// GE 125MHz reference clock
|
110 |
|
|
//----------------------------------------------------------------------------
|
111 |
|
|
|
112 |
|
|
IBUFG GE_125MHz_ref_ckpin_bufi(.I(GE_125MHz_ref_ckpin), .O(GE_125MHz_ref_ckpin_buf));
|
113 |
|
|
|
114 |
|
|
wire GE_125MHz_ref_ck_locked;
|
115 |
|
|
|
116 |
|
|
DCM #(
|
117 |
|
|
.CLKIN_PERIOD(8.0), // Specify period of input clock in ns
|
118 |
|
|
.CLKFX_MULTIPLY(5),
|
119 |
|
|
.CLKFX_DIVIDE(8)
|
120 |
|
|
) GE_125MHz_ref_ck_DCMi(
|
121 |
|
|
.CLK0(GE_125MHz_ref_ck_unbuf),
|
122 |
|
|
.CLK180(),
|
123 |
|
|
.CLK270(),
|
124 |
|
|
.CLK2X(),
|
125 |
|
|
.CLK2X180(),
|
126 |
|
|
.CLK90(),
|
127 |
|
|
.CLKDV(),
|
128 |
|
|
.CLKFX(),
|
129 |
|
|
.CLKFX180(),
|
130 |
|
|
.LOCKED(GE_125MHz_ref_ck_locked),
|
131 |
|
|
.PSDONE(),
|
132 |
|
|
.STATUS(),
|
133 |
|
|
.CLKFB(GE_125MHz_ref_ck),
|
134 |
|
|
.CLKIN(GE_125MHz_ref_ckpin_buf),
|
135 |
|
|
.DSSEN(1'b0),
|
136 |
|
|
.PSCLK(1'b0),
|
137 |
|
|
.PSEN(1'b0),
|
138 |
|
|
.PSINCDEC(1'b0),
|
139 |
|
|
.RST(reset_pin)
|
140 |
|
|
);
|
141 |
|
|
|
142 |
|
|
//----------------------------------------------------------------------------
|
143 |
|
|
// 125MHz refence clock
|
144 |
|
|
//----------------------------------------------------------------------------
|
145 |
|
|
`ifdef MODEL_TECH
|
146 |
|
|
BUFG GE_125MHz_ref_ck_bufi(.I(GE_125MHz_ref_ck_unbuf), .O(GE_125MHz_ref_ck));
|
147 |
|
|
`else
|
148 |
|
|
BUFGMUX GE_125MHz_ref_ck_bufi(.I1(GE_125MHz_ref_ck_unbuf), .O(GE_125MHz_ref_ck), .S(1'b1));
|
149 |
|
|
`endif
|
150 |
|
|
|
151 |
|
|
//----------------------------------------------------------------------------
|
152 |
|
|
// Fibre-Optic (FO) TBI RX clock.
|
153 |
|
|
//----------------------------------------------------------------------------
|
154 |
|
|
|
155 |
|
|
IBUFG tbi_rx_ckpin_bufi(.I(tbi_rx_ckpin), .O(tbi_rx_ckpin_buf));
|
156 |
|
|
|
157 |
|
|
DCM #(
|
158 |
|
|
.CLKIN_PERIOD(8.0)
|
159 |
|
|
) tbi_rx_ck_DCMi(
|
160 |
|
|
.CLK0(tbi_rx_ck_unbuf),
|
161 |
|
|
.CLK180(),
|
162 |
|
|
.CLK270(),
|
163 |
|
|
.CLK2X(),
|
164 |
|
|
.CLK2X180(),
|
165 |
|
|
.CLK90(),
|
166 |
|
|
.CLKDV(),
|
167 |
|
|
.CLKFX(),
|
168 |
|
|
.CLKFX180(),
|
169 |
|
|
.LOCKED(tbi_rx_ck_locked),
|
170 |
|
|
.PSDONE(),
|
171 |
|
|
.STATUS(),
|
172 |
|
|
.CLKFB(tbi_rx_ck),
|
173 |
|
|
.CLKIN(tbi_rx_ckpin_buf),
|
174 |
|
|
.DSSEN(1'b0),
|
175 |
|
|
.PSCLK(1'b0),
|
176 |
|
|
.PSEN(1'b0),
|
177 |
|
|
.PSINCDEC(1'b0),
|
178 |
|
|
.RST(reset_pin)
|
179 |
|
|
);
|
180 |
|
|
|
181 |
|
|
// FO TBI 125MHz rx clock
|
182 |
|
|
BUFG tbi_rx_ck_bufi( .I(tbi_rx_ck_unbuf), .O(tbi_rx_ck));
|
183 |
|
|
|
184 |
|
|
//----------------------------------------------------------------------------
|
185 |
|
|
// Reset Cleaners
|
186 |
|
|
//----------------------------------------------------------------------------
|
187 |
|
|
|
188 |
|
|
wire main_clocks_locked = GE_125MHz_ref_ck_locked;
|
189 |
|
|
|
190 |
|
|
wire tbi_rxck_reset_in = reset_pin | ~main_clocks_locked;
|
191 |
|
|
wire GE_125MHz_reset_in = reset_pin | ~main_clocks_locked;
|
192 |
|
|
wire mdc_reset_in = reset_pin | ~main_clocks_locked;
|
193 |
|
|
|
194 |
|
|
wire GE_125MHz_reset, tbi_rx_reset;
|
195 |
|
|
|
196 |
|
|
clean_rst GE_125MHz_reset_cleaneri(.clk(GE_125MHz_ref_ck), .rsti(GE_125MHz_reset_in), .rsto(GE_125MHz_reset));
|
197 |
|
|
clean_rst tbi_rx_reset_cleaneri( .clk(tbi_rx_ck), .rsti(tbi_rxck_reset_in), .rsto(tbi_rx_reset));
|
198 |
|
|
clean_rst mdc_reset_cleaneri( .clk(mdc), .rsti(mdc_reset_in), .rsto(mdc_reset));
|
199 |
|
|
|
200 |
|
|
//-------------------------------------------------------------------------------
|
201 |
|
|
// --- IEEE 802.3-2008 1000baseX PCS ---
|
202 |
|
|
//-------------------------------------------------------------------------------
|
203 |
|
|
|
204 |
|
|
ge_1000baseX ge_1000baseX_i(
|
205 |
|
|
|
206 |
|
|
// --- Clocks ---
|
207 |
|
|
.rx_ck(tbi_rx_ck), .tx_ck(GE_125MHz_ref_ck),
|
208 |
|
|
|
209 |
|
|
// --- resets ---
|
210 |
|
|
.tx_reset(GE_125MHz_reset), .rx_reset(tbi_rx_reset),
|
211 |
|
|
|
212 |
|
|
// --- Startup interface. ---
|
213 |
|
|
.startup_enable(~GE_125MHz_reset),
|
214 |
|
|
|
215 |
|
|
// --- Signal detect from FO transceiver
|
216 |
|
|
.signal_detect(signal_detect),
|
217 |
|
|
|
218 |
|
|
// --- Receive GMII bus ---
|
219 |
|
|
.gmii_rxd(gmii_rxd),
|
220 |
|
|
.gmii_rx_dv(gmii_rx_dv),
|
221 |
|
|
.gmii_rx_er(gmii_rx_er),
|
222 |
|
|
.gmii_col(gmii_col),
|
223 |
|
|
.gmii_cs(gmii_cs),
|
224 |
|
|
// --- Transmit GMII bus ---
|
225 |
|
|
.gmii_tx_en(gmii_tx_en),
|
226 |
|
|
.gmii_tx_er(gmii_tx_er),
|
227 |
|
|
.gmii_txd(gmii_txd),
|
228 |
|
|
|
229 |
|
|
// --- Receive 8B10B bus ---
|
230 |
|
|
.tbi_rxd(tbi_rxd),
|
231 |
|
|
// --- Transmit 8B10B bus ---
|
232 |
|
|
.tbi_txd(tbi_txd),
|
233 |
|
|
|
234 |
|
|
// --- Mode of operation ---
|
235 |
|
|
.repeater_mode(1'b0),
|
236 |
|
|
|
237 |
|
|
// --- MDIO interface ---
|
238 |
|
|
.mdc_reset(mdc_reset),
|
239 |
|
|
.mdc(mdc),
|
240 |
|
|
.mdio(mdio)/* synthesis xc_pullup = 1 */
|
241 |
|
|
);
|
242 |
|
|
|
243 |
|
|
|
244 |
|
|
endmodule
|
245 |
|
|
|
246 |
|
|
|