Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / niu / rtl / hedwig.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: hedwig.v
4// Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
5// 4150 Network Circle, Santa Clara, California 95054, U.S.A.
6//
7// * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8//
9// This program is free software; you can redistribute it and/or modify
10// it under the terms of the GNU General Public License as published by
11// the Free Software Foundation; version 2 of the License.
12//
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License
19// along with this program; if not, write to the Free Software
20// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21//
22// For the avoidance of doubt, and except that if any non-GPL license
23// choice is available it will apply instead, Sun elects to use only
24// the General Public License version 2 (GPLv2) at this time for any
25// software where a choice of GPL license versions is made
26// available with the language indicating that GPLv2 or any later version
27// may be used, or where a choice of which version of the GPL is applied is
28// otherwise unspecified.
29//
30// Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
31// CA 95054 USA or visit www.sun.com if you need additional information or
32// have any questions.
33//
34// ========== Copyright Header End ============================================
35/*%W% %G%*/
36
37/*************************************************************************
38 *
39 * File Name : hedwig.v
40 * Author Name : John Lo
41 * Description : It contains two hedwig mdio modules.
42 * Parent Module:
43 * Child Module:
44 * Interface Mod: mac
45 * Date Created : 11/23/2004
46 *
47 * Copyright (c) 2020, Sun Microsystems, Inc.
48 * Sun Proprietary and Confidential
49 *
50 * Design Notes : 1. It is OK to connect RXBCLK[i:0] to RXBCLKIN[i:0] directly.
51 * According to an email from Iain Robertson <i-robertson@ti.com>
52 * on Mon, 14 Jun 2004 12:55:14 +0100.
53 *
54 * Modification : 1. Andre has changed hedwigh to all sync flops.
55 * It needs clocks from phy_clock_top also.
56 * Added clock inputs.
57 * -by John Lo @Feb2-05
58 *
59 *
60 * Synthesis Notes:
61 *
62 *************************************************************************/
63
64`include "make_b8_macro.v"
65`include "mif.h"
66
67module hedwig (/*AUTOARG*/
68 // Outputs
69 cfgtx0_0, cfgtx1_0, cfgtx2_0, cfgtx3_0, cfgrx0_0, cfgrx1_0,
70 cfgrx2_0, cfgrx3_0, cfgpll_0, testcfg_0, cfgtx0_1, cfgtx1_1,
71 cfgtx2_1, cfgtx3_1, cfgrx0_1, cfgrx1_1, cfgrx2_1, cfgrx3_1,
72 cfgpll_1, testcfg_1, esr_mac_oddcg0_0, esr_mac_los_0,
73 esr_mac_lock_0, esr_mac_oddcg0_1, esr_mac_los_1, esr_mac_lock_1,
74 BSRXP0_0, BSRXP1_0, BSRXP2_0, BSRXP3_0, BSRXN0_0, BSRXN1_0,
75 BSRXN2_0, BSRXN3_0, BSRXP0_1, BSRXP1_1, BSRXP2_1, BSRXP3_1,
76 BSRXN0_1, BSRXN1_1, BSRXN2_1, BSRXN3_1, mdi_0, mdi_1,
77 // Inputs
78 ststx0_0, ststx1_0, ststx2_0, ststx3_0, stsrx0_0, stsrx1_0,
79 stsrx2_0, stsrx3_0, stspll_0, esr_mac_rclk_0, esr_mac_tclk_0,
80 serdes_reset_0, ststx0_1, ststx1_1, ststx2_1, ststx3_1, stsrx0_1,
81 stsrx1_1, stsrx2_1, stsrx3_1, stspll_1, esr_mac_rclk_1,
82 esr_mac_tclk_1, serdes_reset_1, tcu_sbs_enbstx, tcu_sbs_enbsrx,
83 cfgtx0_0_17, cfgtx1_0_17, cfgtx2_0_17, cfgtx3_0_17, cfgtx0_1_17,
84 cfgtx1_1_17, cfgtx2_1_17, cfgtx3_1_17, cfgrx0_0_b25_b24,
85 cfgrx1_0_b25_b24, cfgrx2_0_b25_b24, cfgrx3_0_b25_b24,
86 cfgrx0_1_b25_b24, cfgrx1_1_b25_b24, cfgrx2_1_b25_b24,
87 cfgrx3_1_b25_b24, tcu_scan_mode, gl_mac_io_clk_stop, tcu_scan_en,
88 tcu_sbs_enbspt, mac_125rx_test_clk, niu_reset_l, mdclk, mdo
89 );
90 // serdes global signals
91 // serdes_0
92 output [19:0] cfgtx0_0; // to malfoy
93 output [19:0] cfgtx1_0; // to malfoy
94 output [19:0] cfgtx2_0; // to malfoy
95 output [19:0] cfgtx3_0; // to malfoy
96 output [27:0] cfgrx0_0; // to malfoy
97 output [27:0] cfgrx1_0; // to malfoy
98 output [27:0] cfgrx2_0; // to malfoy
99 output [27:0] cfgrx3_0; // to malfoy
100 output [11:0] cfgpll_0; // to malfoy
101 output [15:0] testcfg_0; // to malfoy
102 input [3:0] ststx0_0; // from malfoy
103 input [3:0] ststx1_0; // from malfoy
104 input [3:0] ststx2_0; // from malfoy
105 input [3:0] ststx3_0; // from malfoy
106 input [7:0] stsrx0_0; // from malfoy
107 input [7:0] stsrx1_0; // from malfoy
108 input [7:0] stsrx2_0; // from malfoy
109 input [7:0] stsrx3_0; // from malfoy
110 input [3:0] stspll_0; // from malfoy
111 input [3:0] esr_mac_rclk_0; // from malfoy
112 input esr_mac_tclk_0; // from malfoy
113 input serdes_reset_0;
114 // serdes_1
115 output [19:0] cfgtx0_1; // to malfoy
116 output [19:0] cfgtx1_1; // to malfoy
117 output [19:0] cfgtx2_1; // to malfoy
118 output [19:0] cfgtx3_1; // to malfoy
119 output [27:0] cfgrx0_1; // to malfoy
120 output [27:0] cfgrx1_1; // to malfoy
121 output [27:0] cfgrx2_1; // to malfoy
122 output [27:0] cfgrx3_1; // to malfoy
123 output [11:0] cfgpll_1; // to malfoy
124 output [15:0] testcfg_1; // to malfoy
125 input [3:0] ststx0_1; // from malfoy
126 input [3:0] ststx1_1; // from malfoy
127 input [3:0] ststx2_1; // from malfoy
128 input [3:0] ststx3_1; // from malfoy
129 input [7:0] stsrx0_1; // from malfoy
130 input [7:0] stsrx1_1; // from malfoy
131 input [7:0] stsrx2_1; // from malfoy
132 input [7:0] stsrx3_1; // from malfoy
133 input [3:0] stspll_1; // from malfoy
134 input [3:0] esr_mac_rclk_1; // from malfoy
135 input esr_mac_tclk_1; // from malfoy
136 input serdes_reset_1;
137 // mac signals
138 output esr_mac_oddcg0_0; // ch0 port0
139 output [3:0] esr_mac_los_0;
140 output esr_mac_lock_0;
141 output esr_mac_oddcg0_1; // ch0 port1
142 output [3:0] esr_mac_los_1;
143 output esr_mac_lock_1;
144 // from tcu
145 input tcu_sbs_enbstx; // from tcu
146 input tcu_sbs_enbsrx; // from tcu
147 input cfgtx0_0_17; // from esr_bscan
148 input cfgtx1_0_17; // from esr_bscan
149 input cfgtx2_0_17; // from esr_bscan
150 input cfgtx3_0_17; // from esr_bscan
151 input cfgtx0_1_17; // from esr_bscan
152 input cfgtx1_1_17; // from esr_bscan
153 input cfgtx2_1_17; // from esr_bscan
154 input cfgtx3_1_17; // from esr_bscan
155
156 input [1:0] cfgrx0_0_b25_b24; // from esr_bscan
157 input [1:0] cfgrx1_0_b25_b24; // from esr_bscan
158 input [1:0] cfgrx2_0_b25_b24; // from esr_bscan
159 input [1:0] cfgrx3_0_b25_b24; // from esr_bscan
160
161 input [1:0] cfgrx0_1_b25_b24; // from esr_bscan
162 input [1:0] cfgrx1_1_b25_b24; // from esr_bscan
163 input [1:0] cfgrx2_1_b25_b24; // from esr_bscan
164 input [1:0] cfgrx3_1_b25_b24; // from esr_bscan
165
166 // scan
167 input tcu_scan_mode;
168 input gl_mac_io_clk_stop;
169 input tcu_scan_en;
170 input tcu_sbs_enbspt;
171 input mac_125rx_test_clk;
172 // to esr_bscan.v
173 output BSRXP0_0;
174 output BSRXP1_0;
175 output BSRXP2_0;
176 output BSRXP3_0;
177 output BSRXN0_0;
178 output BSRXN1_0;
179 output BSRXN2_0;
180 output BSRXN3_0;
181 output BSRXP0_1;
182 output BSRXP1_1;
183 output BSRXP2_1;
184 output BSRXP3_1;
185 output BSRXN0_1;
186 output BSRXN1_1;
187 output BSRXN2_1;
188 output BSRXN3_1;
189 // global signal
190 input niu_reset_l;
191 input mdclk;
192 input mdo;
193 output mdi_0;
194 output mdi_1;
195
196 wire gl_mac_io_clk_stop;
197 wire tcu_clk_stop = gl_mac_io_clk_stop;
198 wire niu_reset_l;
199 wire hedwig_reset0;
200 wire hedwig_reset1;
201 wire hedwig_reset0_l;
202 wire hedwig_reset1_l;
203 wire serdes_reset_0;
204 wire serdes_reset_1;
205 wire hedwig_serdes_reset_0;
206 wire hedwig_serdes_reset_1;
207 wire n2_mode = 1'b1;
208 // For n2 mode, it was driven to "0".
209 // BSINITCLK (per port) works with BSINRXPi & BSINRXNi in CFGRXi[25:24].
210 // Both BSINRXPi & BSINRXNi are driven to "0".
211
212 // vlint flag_dangling_net_within_module off
213 // vlint flag_net_has_no_load off
214 wire mdoe_0;
215 wire mdoe_1;
216 // vlint flag_net_has_no_load on
217 // vlint flag_dangling_net_within_module on
218 // to esr_bscan.v
219 wire BSRXP0_0;
220 wire BSRXP1_0;
221 wire BSRXP2_0;
222 wire BSRXP3_0;
223 wire BSRXN0_0;
224 wire BSRXN1_0;
225 wire BSRXN2_0;
226 wire BSRXN3_0;
227 wire BSRXP0_1;
228 wire BSRXP1_1;
229 wire BSRXP2_1;
230 wire BSRXP3_1;
231 wire BSRXN0_1;
232 wire BSRXN1_1;
233 wire BSRXN2_1;
234 wire BSRXN3_1;
235
236 wire esr_mac_tclk_0_mux;
237 wire esr_mac_tclk_1_mux;
238
239 wire esr_mac_tclk_0_buf;
240 wire esr_mac_tclk_1_buf;
241
242 wire [3:0] esr_mac_rclk_0_mux;
243 wire [3:0] esr_mac_rclk_1_mux;
244
245 wire [3:0] esr_mac_rclk_0_buf;
246 wire [3:0] esr_mac_rclk_1_buf;
247
248 wire tcu_clk_stop_tclk_0_sync;
249 wire tcu_clk_stop_tclk_1_sync;
250 wire tcu_clk_stop_rclk_0_0_sync;
251 wire tcu_clk_stop_rclk_0_1_sync;
252 wire tcu_clk_stop_rclk_0_2_sync;
253 wire tcu_clk_stop_rclk_0_3_sync;
254 wire tcu_clk_stop_rclk_1_0_sync;
255 wire tcu_clk_stop_rclk_1_1_sync;
256 wire tcu_clk_stop_rclk_1_2_sync;
257 wire tcu_clk_stop_rclk_1_3_sync;
258
259 wire tcu_clk_stop_rclk_1_0_sync_mux;
260 wire tcu_clk_stop_rclk_1_1_sync_mux;
261 wire tcu_clk_stop_rclk_1_2_sync_mux;
262 wire tcu_clk_stop_rclk_1_3_sync_mux;
263
264 wire tcu_clk_stop_rclk_0_0_sync_mux;
265 wire tcu_clk_stop_rclk_0_1_sync_mux;
266 wire tcu_clk_stop_rclk_0_2_sync_mux;
267 wire tcu_clk_stop_rclk_0_3_sync_mux;
268
269 wire tcu_clk_stop_tclk_0_sync_mux;
270 wire tcu_clk_stop_tclk_1_sync_mux;
271
272
273// ***************************************************
274// TX Port 0 Hedwig L1 clock headers and clock muxing
275// ***************************************************
276cl_a1_clk_mux2_8x tclk_0_mux (.in0(mac_125rx_test_clk), .in1(esr_mac_tclk_0), .sel0(tcu_scan_mode), .out(esr_mac_tclk_0_mux));
277
278SYNC_CELL SYNC_CELL_ST_TX_0_0(.D(tcu_clk_stop),.CP(esr_mac_tclk_0_mux),.Q(tcu_clk_stop_tclk_0_sync));
279
280assign tcu_clk_stop_tclk_0_sync_mux = tcu_scan_mode ? tcu_clk_stop : tcu_clk_stop_tclk_0_sync;
281
282cl_a1_l1hdr_12x hedwig_esr_mac_tclk_0_mux_l1 (
283 .l2clk(esr_mac_tclk_0_mux),
284 .se(tcu_scan_en),
285 .pce(1'b1),
286 .pce_ov(1'b0),
287 .stop(tcu_clk_stop_tclk_0_sync_mux),
288 .l1clk(esr_mac_tclk_0_buf) );
289
290// ***************************************************
291// TX Port 1 Hedwig L1 clock headers and clock muxing
292// ***************************************************
293cl_a1_clk_mux2_8x tclk_1_mux (.in0(mac_125rx_test_clk), .in1(esr_mac_tclk_1), .sel0(tcu_scan_mode), .out(esr_mac_tclk_1_mux));
294
295SYNC_CELL SYNC_CELL_ST_TX_1_0(.D(tcu_clk_stop),.CP(esr_mac_tclk_1_mux),.Q(tcu_clk_stop_tclk_1_sync));
296
297assign tcu_clk_stop_tclk_1_sync_mux = tcu_scan_mode ? tcu_clk_stop : tcu_clk_stop_tclk_1_sync;
298
299cl_a1_l1hdr_12x hedwig_esr_mac_tclk_1_mux_l1 (
300 .l2clk(esr_mac_tclk_1_mux),
301 .se(tcu_scan_en),
302 .pce(1'b1),
303 .pce_ov(1'b0),
304 .stop(tcu_clk_stop_tclk_1_sync_mux),
305 .l1clk(esr_mac_tclk_1_buf) );
306
307// ***************************************************
308// RX Port 0 Hedwig L1 clock headers and clock muxing
309// ***************************************************
310
311cl_a1_clk_mux2_8x rclk_0_mux_0 (.in0(mac_125rx_test_clk), .in1(esr_mac_rclk_0[0]), .sel0(tcu_scan_mode), .out(esr_mac_rclk_0_mux[0]));
312cl_a1_clk_mux2_8x rclk_0_mux_1 (.in0(mac_125rx_test_clk), .in1(esr_mac_rclk_0[1]), .sel0(tcu_scan_mode), .out(esr_mac_rclk_0_mux[1]));
313cl_a1_clk_mux2_8x rclk_0_mux_2 (.in0(mac_125rx_test_clk), .in1(esr_mac_rclk_0[2]), .sel0(tcu_scan_mode), .out(esr_mac_rclk_0_mux[2]));
314cl_a1_clk_mux2_8x rclk_0_mux_3 (.in0(mac_125rx_test_clk), .in1(esr_mac_rclk_0[3]), .sel0(tcu_scan_mode), .out(esr_mac_rclk_0_mux[3]));
315
316SYNC_CELL SYNC_CELL_ST_RX_0_0(.D(tcu_clk_stop),.CP(esr_mac_rclk_0_mux[0]),.Q(tcu_clk_stop_rclk_0_0_sync));
317SYNC_CELL SYNC_CELL_ST_RX_0_1(.D(tcu_clk_stop),.CP(esr_mac_rclk_0_mux[1]),.Q(tcu_clk_stop_rclk_0_1_sync));
318SYNC_CELL SYNC_CELL_ST_RX_0_2(.D(tcu_clk_stop),.CP(esr_mac_rclk_0_mux[2]),.Q(tcu_clk_stop_rclk_0_2_sync));
319SYNC_CELL SYNC_CELL_ST_RX_0_3(.D(tcu_clk_stop),.CP(esr_mac_rclk_0_mux[3]),.Q(tcu_clk_stop_rclk_0_3_sync));
320
321assign tcu_clk_stop_rclk_0_0_sync_mux = tcu_scan_mode ? tcu_clk_stop : tcu_clk_stop_rclk_0_0_sync;
322assign tcu_clk_stop_rclk_0_1_sync_mux = tcu_scan_mode ? tcu_clk_stop : tcu_clk_stop_rclk_0_1_sync;
323assign tcu_clk_stop_rclk_0_2_sync_mux = tcu_scan_mode ? tcu_clk_stop : tcu_clk_stop_rclk_0_2_sync;
324assign tcu_clk_stop_rclk_0_3_sync_mux = tcu_scan_mode ? tcu_clk_stop : tcu_clk_stop_rclk_0_3_sync;
325
326cl_a1_l1hdr_12x hedwig_esr_mac_rclk_0_0_mux_l1 (
327 .l2clk(esr_mac_rclk_0_mux[0]),
328 .se(tcu_scan_en),
329 .pce(1'b1),
330 .pce_ov(1'b0),
331 .stop(tcu_clk_stop_rclk_0_0_sync_mux),
332 .l1clk(esr_mac_rclk_0_buf[0]) );
333
334cl_a1_l1hdr_12x hedwig_esr_mac_rclk_0_1_mux_l1 (
335 .l2clk(esr_mac_rclk_0_mux[1]),
336 .se(tcu_scan_en),
337 .pce(1'b1),
338 .pce_ov(1'b0),
339 .stop(tcu_clk_stop_rclk_0_1_sync_mux),
340 .l1clk(esr_mac_rclk_0_buf[1]) );
341
342cl_a1_l1hdr_12x hedwig_esr_mac_rclk_0_2_mux_l1 (
343 .l2clk(esr_mac_rclk_0_mux[2]),
344 .se(tcu_scan_en),
345 .pce(1'b1),
346 .pce_ov(1'b0),
347 .stop(tcu_clk_stop_rclk_0_2_sync_mux),
348 .l1clk(esr_mac_rclk_0_buf[2]) );
349
350cl_a1_l1hdr_12x hedwig_esr_mac_rclk_0_3_mux_l1 (
351 .l2clk(esr_mac_rclk_0_mux[3]),
352 .se(tcu_scan_en),
353 .pce(1'b1),
354 .pce_ov(1'b0),
355 .stop(tcu_clk_stop_rclk_0_3_sync_mux),
356 .l1clk(esr_mac_rclk_0_buf[3]) );
357
358// ***************************************************
359// RX Port 1 Hedwig L1 clock headers and clock muxing
360// ***************************************************
361
362cl_a1_clk_mux2_8x rclk_1_mux_0 (.in0(mac_125rx_test_clk), .in1(esr_mac_rclk_1[0]), .sel0(tcu_scan_mode), .out(esr_mac_rclk_1_mux[0]));
363cl_a1_clk_mux2_8x rclk_1_mux_1 (.in0(mac_125rx_test_clk), .in1(esr_mac_rclk_1[1]), .sel0(tcu_scan_mode), .out(esr_mac_rclk_1_mux[1]));
364cl_a1_clk_mux2_8x rclk_1_mux_2 (.in0(mac_125rx_test_clk), .in1(esr_mac_rclk_1[2]), .sel0(tcu_scan_mode), .out(esr_mac_rclk_1_mux[2]));
365cl_a1_clk_mux2_8x rclk_1_mux_3 (.in0(mac_125rx_test_clk), .in1(esr_mac_rclk_1[3]), .sel0(tcu_scan_mode), .out(esr_mac_rclk_1_mux[3]));
366
367SYNC_CELL SYNC_CELL_ST_RX_1_0(.D(tcu_clk_stop),.CP(esr_mac_rclk_1_mux[0]),.Q(tcu_clk_stop_rclk_1_0_sync));
368SYNC_CELL SYNC_CELL_ST_RX_1_1(.D(tcu_clk_stop),.CP(esr_mac_rclk_1_mux[1]),.Q(tcu_clk_stop_rclk_1_1_sync));
369SYNC_CELL SYNC_CELL_ST_RX_1_2(.D(tcu_clk_stop),.CP(esr_mac_rclk_1_mux[2]),.Q(tcu_clk_stop_rclk_1_2_sync));
370SYNC_CELL SYNC_CELL_ST_RX_1_3(.D(tcu_clk_stop),.CP(esr_mac_rclk_1_mux[3]),.Q(tcu_clk_stop_rclk_1_3_sync));
371
372assign tcu_clk_stop_rclk_1_0_sync_mux = tcu_scan_mode ? tcu_clk_stop : tcu_clk_stop_rclk_1_0_sync;
373assign tcu_clk_stop_rclk_1_1_sync_mux = tcu_scan_mode ? tcu_clk_stop : tcu_clk_stop_rclk_1_1_sync;
374assign tcu_clk_stop_rclk_1_2_sync_mux = tcu_scan_mode ? tcu_clk_stop : tcu_clk_stop_rclk_1_2_sync;
375assign tcu_clk_stop_rclk_1_3_sync_mux = tcu_scan_mode ? tcu_clk_stop : tcu_clk_stop_rclk_1_3_sync;
376
377cl_a1_l1hdr_12x hedwig_esr_mac_rclk_1_0_mux_l1 (
378 .l2clk(esr_mac_rclk_1_mux[0]),
379 .se(tcu_scan_en),
380 .pce(1'b1),
381 .pce_ov(1'b0),
382 .stop(tcu_clk_stop_rclk_1_0_sync_mux),
383 .l1clk(esr_mac_rclk_1_buf[0]) );
384
385cl_a1_l1hdr_12x hedwig_esr_mac_rclk_1_1_mux_l1 (
386 .l2clk(esr_mac_rclk_1_mux[1]),
387 .se(tcu_scan_en),
388 .pce(1'b1),
389 .pce_ov(1'b0),
390 .stop(tcu_clk_stop_rclk_1_1_sync_mux),
391 .l1clk(esr_mac_rclk_1_buf[1]) );
392
393cl_a1_l1hdr_12x hedwig_esr_mac_rclk_1_2_mux_l1 (
394 .l2clk(esr_mac_rclk_1_mux[2]),
395 .se(tcu_scan_en),
396 .pce(1'b1),
397 .pce_ov(1'b0),
398 .stop(tcu_clk_stop_rclk_1_2_sync_mux),
399 .l1clk(esr_mac_rclk_1_buf[2]) );
400
401cl_a1_l1hdr_12x hedwig_esr_mac_rclk_1_3_mux_l1 (
402 .l2clk(esr_mac_rclk_1_mux[3]),
403 .se(tcu_scan_en),
404 .pce(1'b1),
405 .pce_ov(1'b0),
406 .stop(tcu_clk_stop_rclk_1_3_sync_mux),
407 .l1clk(esr_mac_rclk_1_buf[3]) );
408
409
410// *******************************
411// Synchronization of reset signal
412// *******************************
413wire io_mdclk0;
414wire io_mdclk1;
415
416SYNC_CELL SYNC_CELL0(.D(niu_reset_l),.CP(io_mdclk0),.Q(hedwig_reset0_l));
417SYNC_CELL SYNC_CELL1(.D(niu_reset_l),.CP(io_mdclk1),.Q(hedwig_reset1_l));
418
419SYNC_CELL serdes_reset_0_SYNC_CELL(.D(serdes_reset_0),.CP(io_mdclk0),.Q(hedwig_serdes_reset_0));
420SYNC_CELL serdes_reset_1_SYNC_CELL(.D(serdes_reset_1),.CP(io_mdclk1),.Q(hedwig_serdes_reset_1));
421
422 assign hedwig_reset0 = (~hedwig_reset0_l) | hedwig_serdes_reset_0;
423 assign hedwig_reset1 = (~hedwig_reset1_l) | hedwig_serdes_reset_1;
424
425
426/* ---------------- hedwig_0 stuff ---------------------- */
427 wire [3:0] stspll_0;
428 wire [7:0] stsrx0_0;
429 wire [7:0] stsrx1_0;
430 wire [7:0] stsrx2_0;
431 wire [7:0] stsrx3_0;
432 wire [3:0] ststx0_0;
433 wire [3:0] ststx1_0;
434 wire [3:0] ststx2_0;
435 wire [3:0] ststx3_0;
436 wire [11:0] cfgpll_0;
437 wire [27:0] cfgrx0_0;
438 wire [27:0] cfgrx1_0;
439 wire [27:0] cfgrx2_0;
440 wire [27:0] cfgrx3_0;
441 wire [19:0] cfgtx0_0;
442 wire [19:0] cfgtx1_0;
443 wire [19:0] cfgtx2_0;
444 wire [19:0] cfgtx3_0;
445 wire [15:0] testcfg_0;
446 wire bstx_cfgtx0_0_bit17; // bstx: determines logic level output on txpi and txni
447 wire bstx_cfgtx1_0_bit17; // bstx: determines logic level output on txpi and txni
448 wire bstx_cfgtx2_0_bit17; // bstx: determines logic level output on txpi and txni
449 wire bstx_cfgtx3_0_bit17; // bstx: determines logic level output on txpi and txni
450 wire [1:0] bsinrxp_bsinrxn_cfgrx0_0_bit25_24;
451 wire [1:0] bsinrxp_bsinrxn_cfgrx1_0_bit25_24;
452 wire [1:0] bsinrxp_bsinrxn_cfgrx2_0_bit25_24;
453 wire [1:0] bsinrxp_bsinrxn_cfgrx3_0_bit25_24;
454 wire [2:0] enbspt_enbsrx_enbstx_0;
455
456
457// wire esr_mac_oddcg0_0= stsrx0_0[2]; // use ch 0
458// wire esr_mac_lock_0 = stspll_0[0];
459// wire [3:0] esr_mac_los_0 = {stsrx3_0[3],stsrx2_0[3],stsrx1_0[3],stsrx0_0[3]};
460// wire [3:0] esr_mac_sync_0 = {stsrx3_0[1],stsrx2_0[1],stsrx1_0[1],stsrx0_0[1]};
461
462// alias function
463xMUX_2to1 #(1) esr_mac_oddcg0_s0(.din0(stsrx0_0[2]),.din1(1'b1),.sel(1'b0),.dout(esr_mac_oddcg0_0)); // use ch 0
464
465xMUX_2to1 #(1) esr_mac_lock_s0(.din0(stspll_0[0]),.din1(1'b1),.sel(1'b0),.dout(esr_mac_lock_0));
466
467xMUX_2to1 #(4) esr_mac_los_s0(.din0({stsrx3_0[3],stsrx2_0[3],stsrx1_0[3],stsrx0_0[3]}),.din1({4{1'b1}}),.sel(1'b0),.dout(esr_mac_los_0[3:0]));
468
469// boundary scan stuff
470 assign cfgtx0_0[17] = n2_mode ? cfgtx0_0_17 : bstx_cfgtx0_0_bit17;
471 assign cfgtx1_0[17] = n2_mode ? cfgtx1_0_17 : bstx_cfgtx1_0_bit17;
472 assign cfgtx2_0[17] = n2_mode ? cfgtx2_0_17 : bstx_cfgtx2_0_bit17;
473 assign cfgtx3_0[17] = n2_mode ? cfgtx3_0_17 : bstx_cfgtx3_0_bit17;
474
475// For 1149.6 support, cfgrx*_1_b25_b24 comes from boundary scan block esr_bscan.v
476
477 assign cfgrx0_0[25:24] = n2_mode ? cfgrx0_0_b25_b24 : bsinrxp_bsinrxn_cfgrx0_0_bit25_24;
478 assign cfgrx1_0[25:24] = n2_mode ? cfgrx1_0_b25_b24 : bsinrxp_bsinrxn_cfgrx1_0_bit25_24;
479 assign cfgrx2_0[25:24] = n2_mode ? cfgrx2_0_b25_b24 : bsinrxp_bsinrxn_cfgrx2_0_bit25_24;
480 assign cfgrx3_0[25:24] = n2_mode ? cfgrx3_0_b25_b24 : bsinrxp_bsinrxn_cfgrx3_0_bit25_24;
481
482 assign testcfg_0[10:8] = n2_mode ? {tcu_sbs_enbspt,tcu_sbs_enbsrx,tcu_sbs_enbstx} : enbspt_enbsrx_enbstx_0;
483
484
485// hedwig_0 instantiation
486
487 wire [15:0] cfg_0;
488 assign cfg_0[15] = 1'h1; // clause 45
489 assign cfg_0[14:10] = `PORT_ADDR_0; // portad
490 assign cfg_0[9:5] = `DEV_ADDR_0; // devad
491 assign cfg_0[4:0] = 5'h0; // base_addr
492
493MDIO_TO_REGS hedwig_0
494 (
495 .io_mdclk (io_mdclk0), // output clock from L1 header
496 .tcu_clk_stop (tcu_clk_stop), // input
497 .tcu_scan_mode (tcu_scan_mode), // input
498
499 // Outputs
500 .MDOUT (mdi_0),
501 .MDOE (mdoe_0),
502 .CFGTX0 ({cfgtx0_0[19:18],bstx_cfgtx0_0_bit17, cfgtx0_0[16:0]}),
503 .CFGTX1 ({cfgtx1_0[19:18],bstx_cfgtx1_0_bit17, cfgtx1_0[16:0]}),
504 .CFGTX2 ({cfgtx2_0[19:18],bstx_cfgtx2_0_bit17, cfgtx2_0[16:0]}),
505 .CFGTX3 ({cfgtx3_0[19:18],bstx_cfgtx3_0_bit17, cfgtx3_0[16:0]}),
506 .CFGRX0 ({cfgrx0_0[27:26],bsinrxp_bsinrxn_cfgrx0_0_bit25_24,cfgrx0_0[23:0]}),
507 .CFGRX1 ({cfgrx1_0[27:26],bsinrxp_bsinrxn_cfgrx1_0_bit25_24,cfgrx1_0[23:0]}),
508 .CFGRX2 ({cfgrx2_0[27:26],bsinrxp_bsinrxn_cfgrx2_0_bit25_24,cfgrx2_0[23:0]}),
509 .CFGRX3 ({cfgrx3_0[27:26],bsinrxp_bsinrxn_cfgrx3_0_bit25_24,cfgrx3_0[23:0]}),
510 .TESTCFG ({testcfg_0[15:11],enbspt_enbsrx_enbstx_0[2:0], testcfg_0[7:0]}),
511 .CFGPLL (cfgpll_0[11:0]),
512 // Inputs
513 .RESET (hedwig_reset0),
514 .MDCLK (mdclk),
515 .MDIN (mdo),
516 .CFG (cfg_0[15:0]),
517 .SCANEN (tcu_scan_en),
518 .SCANCLK (mac_125rx_test_clk),
519 .STSTX0 (ststx0_0[3:0]),
520 .STSTX1 (ststx1_0[3:0]),
521 .STSTX2 (ststx2_0[3:0]),
522 .STSTX3 (ststx3_0[3:0]),
523 .STSRX0 (stsrx0_0[7:0]),
524 .STSRX1 (stsrx1_0[7:0]),
525 .STSRX2 (stsrx2_0[7:0]),
526 .STSRX3 (stsrx3_0[7:0]),
527 .STSPLL (stspll_0[3:0]),
528 .TXBCLKIN0 (esr_mac_tclk_0_buf),
529 .TXBCLKIN1 (esr_mac_tclk_0_buf),
530 .TXBCLKIN2 (esr_mac_tclk_0_buf),
531 .TXBCLKIN3 (esr_mac_tclk_0_buf),
532 .RXBCLKIN0 (esr_mac_rclk_0_buf[0]),
533 .RXBCLKIN1 (esr_mac_rclk_0_buf[1]),
534 .RXBCLKIN2 (esr_mac_rclk_0_buf[2]),
535 .RXBCLKIN3 (esr_mac_rclk_0_buf[3])
536);
537
538/* ---------------- hedwig_1 stuff ---------------------- */
539 wire [3:0] stspll_1;
540 wire [7:0] stsrx0_1;
541 wire [7:0] stsrx1_1;
542 wire [7:0] stsrx2_1;
543 wire [7:0] stsrx3_1;
544 wire [3:0] ststx0_1;
545 wire [3:0] ststx1_1;
546 wire [3:0] ststx2_1;
547 wire [3:0] ststx3_1;
548 wire [11:0] cfgpll_1;
549 wire [27:0] cfgrx0_1;
550 wire [27:0] cfgrx1_1;
551 wire [27:0] cfgrx2_1;
552 wire [27:0] cfgrx3_1;
553 wire [19:0] cfgtx0_1;
554 wire [19:0] cfgtx1_1;
555 wire [19:0] cfgtx2_1;
556 wire [19:0] cfgtx3_1;
557 wire [15:0] testcfg_1;
558 wire bstx_cfgtx0_1_bit17; // bstx: determines logic level output on txpi and txni
559 wire bstx_cfgtx1_1_bit17; // bstx: determines logic level output on txpi and txni
560 wire bstx_cfgtx2_1_bit17; // bstx: determines logic level output on txpi and txni
561 wire bstx_cfgtx3_1_bit17; // bstx: determines logic level output on txpi and txni
562 wire [1:0] bsinrxp_bsinrxn_cfgrx0_1_bit25_24;
563 wire [1:0] bsinrxp_bsinrxn_cfgrx1_1_bit25_24;
564 wire [1:0] bsinrxp_bsinrxn_cfgrx2_1_bit25_24;
565 wire [1:0] bsinrxp_bsinrxn_cfgrx3_1_bit25_24;
566 wire [2:0] enbspt_enbsrx_enbstx_1;
567
568
569// wire esr_mac_oddcg0_1= stsrx0_1[2]; // use ch 0
570// wire esr_mac_lock_1 = stspll_1[0];
571// wire [3:0] esr_mac_los_1 = {stsrx3_1[3],stsrx2_1[3],stsrx1_1[3],stsrx0_1[3]};
572// wire [3:0] esr_mac_sync_1 = {stsrx3_1[1],stsrx2_1[1],stsrx1_1[1],stsrx0_1[1]};
573
574// alias function
575xMUX_2to1 #(1) esr_mac_oddcg0_s1(.din0(stsrx0_1[2]),.din1(1'b1),.sel(1'b0),.dout(esr_mac_oddcg0_1)); // use ch 1
576
577xMUX_2to1 #(1) esr_mac_lock_s1(.din0(stspll_1[0]),.din1(1'b1),.sel(1'b0),.dout(esr_mac_lock_1));
578
579xMUX_2to1 #(4) esr_mac_los_s1(.din0({stsrx3_1[3],stsrx2_1[3],stsrx1_1[3],stsrx0_1[3]}),.din1({4{1'b1}}),.sel(1'b0),.dout(esr_mac_los_1[3:0]));
580
581// boundary scan stuff
582 assign cfgtx0_1[17] = n2_mode ? cfgtx0_1_17 : bstx_cfgtx0_1_bit17;
583 assign cfgtx1_1[17] = n2_mode ? cfgtx1_1_17 : bstx_cfgtx1_1_bit17;
584 assign cfgtx2_1[17] = n2_mode ? cfgtx2_1_17 : bstx_cfgtx2_1_bit17;
585 assign cfgtx3_1[17] = n2_mode ? cfgtx3_1_17 : bstx_cfgtx3_1_bit17;
586
587// For 1149.6 support, cfgrx*_1_b25_b24 comes from boundary scan block esr_bscan.v
588
589 assign cfgrx0_1[25:24] = n2_mode ? cfgrx0_1_b25_b24 : bsinrxp_bsinrxn_cfgrx0_1_bit25_24;
590 assign cfgrx1_1[25:24] = n2_mode ? cfgrx1_1_b25_b24 : bsinrxp_bsinrxn_cfgrx1_1_bit25_24;
591 assign cfgrx2_1[25:24] = n2_mode ? cfgrx2_1_b25_b24 : bsinrxp_bsinrxn_cfgrx2_1_bit25_24;
592 assign cfgrx3_1[25:24] = n2_mode ? cfgrx3_1_b25_b24 : bsinrxp_bsinrxn_cfgrx3_1_bit25_24;
593
594 assign testcfg_1[10:8] = n2_mode ? {tcu_sbs_enbspt,tcu_sbs_enbsrx,tcu_sbs_enbstx} : enbspt_enbsrx_enbstx_1;
595
596
597// hedwig_1 instantiation
598
599 wire [15:0] cfg_1;
600 assign cfg_1[15] = 1'h1; // clause 45
601 assign cfg_1[14:10] = `PORT_ADDR_1; // portad
602 assign cfg_1[9:5] = `DEV_ADDR_1; // devad
603 assign cfg_1[4:0] = 5'h0; // base_addr
604
605MDIO_TO_REGS hedwig_1
606 (
607 .io_mdclk (io_mdclk1), // output clock from l1 header
608 .tcu_clk_stop (tcu_clk_stop), // input
609 .tcu_scan_mode (tcu_scan_mode), // input
610
611 // Outputs
612 .MDOUT (mdi_1),
613 .MDOE (mdoe_1),
614 .CFGTX0 ({cfgtx0_1[19:18], bstx_cfgtx0_1_bit17, cfgtx0_1[16:0]}),
615 .CFGTX1 ({cfgtx1_1[19:18], bstx_cfgtx1_1_bit17, cfgtx1_1[16:0]}),
616 .CFGTX2 ({cfgtx2_1[19:18], bstx_cfgtx2_1_bit17, cfgtx2_1[16:0]}),
617 .CFGTX3 ({cfgtx3_1[19:18], bstx_cfgtx3_1_bit17, cfgtx3_1[16:0]}),
618 .CFGRX0 ({cfgrx0_1[27:26], bsinrxp_bsinrxn_cfgrx0_1_bit25_24,cfgrx0_1[23:0]}),
619 .CFGRX1 ({cfgrx1_1[27:26], bsinrxp_bsinrxn_cfgrx1_1_bit25_24,cfgrx1_1[23:0]}),
620 .CFGRX2 ({cfgrx2_1[27:26], bsinrxp_bsinrxn_cfgrx2_1_bit25_24,cfgrx2_1[23:0]}),
621 .CFGRX3 ({cfgrx3_1[27:26], bsinrxp_bsinrxn_cfgrx3_1_bit25_24,cfgrx3_1[23:0]}),
622 .TESTCFG ({testcfg_1[15:11],enbspt_enbsrx_enbstx_1[2:0], testcfg_1[7:0]}),
623 .CFGPLL (cfgpll_1[11:0]),
624 // Inputs
625 .RESET (hedwig_reset1),
626 .MDCLK (mdclk),
627 .MDIN (mdo),
628 .CFG (cfg_1[15:0]),
629 .SCANEN (tcu_scan_en),
630 .SCANCLK (mac_125rx_test_clk),
631 .STSTX0 (ststx0_1[3:0]),
632 .STSTX1 (ststx1_1[3:0]),
633 .STSTX2 (ststx2_1[3:0]),
634 .STSTX3 (ststx3_1[3:0]),
635 .STSRX0 (stsrx0_1[7:0]),
636 .STSRX1 (stsrx1_1[7:0]),
637 .STSRX2 (stsrx2_1[7:0]),
638 .STSRX3 (stsrx3_1[7:0]),
639 .STSPLL (stspll_1[3:0]),
640 .TXBCLKIN0 (esr_mac_tclk_1_buf),
641 .TXBCLKIN1 (esr_mac_tclk_1_buf),
642 .TXBCLKIN2 (esr_mac_tclk_1_buf),
643 .TXBCLKIN3 (esr_mac_tclk_1_buf),
644 .RXBCLKIN0 (esr_mac_rclk_1_buf[0]),
645 .RXBCLKIN1 (esr_mac_rclk_1_buf[1]),
646 .RXBCLKIN2 (esr_mac_rclk_1_buf[2]),
647 .RXBCLKIN3 (esr_mac_rclk_1_buf[3])
648);
649
650
651// to esr_bscan
652 assign BSRXP0_0 = stsrx0_0[4]; // bit4 of ch0 serdes 0
653 assign BSRXP1_0 = stsrx1_0[4]; // bit4 of ch1 serdes 0
654 assign BSRXP2_0 = stsrx2_0[4]; // bit4 of ch2 serdes 0
655 assign BSRXP3_0 = stsrx3_0[4]; // bit4 of ch3 serdes 0
656 assign BSRXN0_0 = stsrx0_0[5]; // bit5 of ch0 serdes 0
657 assign BSRXN1_0 = stsrx1_0[5]; // bit5 of ch1 serdes 0
658 assign BSRXN2_0 = stsrx2_0[5]; // bit5 of ch2 serdes 0
659 assign BSRXN3_0 = stsrx3_0[5]; // bit5 of ch3 serdes 0
660 assign BSRXP0_1 = stsrx0_1[4]; // bit4 of ch0 serdes 1
661 assign BSRXP1_1 = stsrx1_1[4]; // bit4 of ch1 serdes 1
662 assign BSRXP2_1 = stsrx2_1[4]; // bit4 of ch2 serdes 1
663 assign BSRXP3_1 = stsrx3_1[4]; // bit4 of ch3 serdes 1
664 assign BSRXN0_1 = stsrx0_1[5]; // bit5 of ch0 serdes 1
665 assign BSRXN1_1 = stsrx1_1[5]; // bit5 of ch1 serdes 1
666 assign BSRXN2_1 = stsrx2_1[5]; // bit5 of ch2 serdes 1
667 assign BSRXN3_1 = stsrx3_1[5]; // bit5 of ch3 serdes 1
668
669
670endmodule // hedwig
671
672