Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / niu / rtl / MDIO_TO_REGS.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: MDIO_TO_REGS.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//////////////////////////////////////////////////////////////////////////////////
36//
37// Copyright (c) 2004 Texas Instruments, Inc.
38// All rights reserved
39//
40// This is an unpublished work created in the year stated above.
41// Texas Instruments owns all rights in and to the work and intends to
42// maintain it and protect it as unpublished copyright. In the event
43// of either inadvertant or deliberate publication, the above stated
44// date shall be treated as the year of first publication. In the event
45// of such publication, Texas Instruments intends to enforce its rights
46// in the work under the copyright laws as a published work.
47//
48// These commodities are under U.S. Government distribution license
49// control. As such, they are not be re-exported without prior approval
50// from the U.S. Department of Commerce.
51//
52//////////////////////////////////////////////////////////////////////////////////
53// ***********************************************************************
54//
55// File: MDIO_TO_REGS.v
56//
57// Author: Andre Szczepanek
58//
59// Purpose: MDIO Interface to SERDES CFG & STS buses top level block
60//
61// Instantiates "Hedwig" MDIO framer and a configurable register block
62//
63//
64// Date Author Changes
65// ------- ------ -----------------------------------------------------
66// 21May04 Andre Created
67//
68// ***********************************************************************
69/// synopsys translate_off
70//// synopsys translate_on
71
72
73// switches to turn off verilint checks that prove OK
74//verilint 446 off
75//verilint 484 off
76//verilint 257 off
77//verilint 280 off
78//verilint 531 off
79//verilint 570 off
80//verilint 549 off
81//verilint 257 off
82//verilint 280 off
83//verilint 389 off
84//verilint 530 off
85//verilint 396 off
86//verilint 542 off
87//verilint 69 off
88//verilint 550 off
89//verilint 341 off
90
91
92//////////////////////////////////////////////////////////////////////////////////
93//
94// Use include file to configure macro selection
95//
96`include "make_b8_macro.v"
97
98
99`timescale 1ns / 1ps
100
101module MDIO_TO_REGS
102 (
103
104 io_mdclk,
105 tcu_clk_stop,
106 tcu_scan_mode,
107
108 RESET,
109 MDCLK,
110 MDIN,
111 MDOUT,
112 MDOE,
113 CFG,
114
115 SCANEN,
116 SCANCLK,
117
118`ifdef MAKE_REGS_TX_0
119 CFGTX0,
120 STSTX0,
121 TXBCLKIN0,
122`endif
123`ifdef MAKE_REGS_TX_1
124 CFGTX1,
125 STSTX1,
126 TXBCLKIN1,
127`endif
128`ifdef MAKE_REGS_TX_2
129 CFGTX2,
130 STSTX2,
131 TXBCLKIN2,
132`endif
133`ifdef MAKE_REGS_TX_3
134 CFGTX3,
135 STSTX3,
136 TXBCLKIN3,
137`endif
138`ifdef MAKE_REGS_TX_4
139 CFGTX4,
140 STSTX4,
141 TXBCLKIN4,
142`endif
143`ifdef MAKE_REGS_TX_5
144 CFGTX5,
145 STSTX5,
146 TXBCLKIN5,
147`endif
148`ifdef MAKE_REGS_TX_6
149 CFGTX6,
150 STSTX6,
151 TXBCLKIN6,
152`endif
153`ifdef MAKE_REGS_TX_7
154 CFGTX7,
155 STSTX7,
156 TXBCLKIN7,
157`endif
158`ifdef MAKE_REGS_RX_0
159 CFGRX0,
160 STSRX0,
161 RXBCLKIN0,
162`endif
163`ifdef MAKE_REGS_RX_1
164 CFGRX1,
165 STSRX1,
166 RXBCLKIN1,
167`endif
168`ifdef MAKE_REGS_RX_2
169 CFGRX2,
170 STSRX2,
171 RXBCLKIN2,
172`endif
173`ifdef MAKE_REGS_RX_3
174 CFGRX3,
175 STSRX3,
176 RXBCLKIN3,
177`endif
178`ifdef MAKE_REGS_RX_4
179 CFGRX4,
180 STSRX4,
181 RXBCLKIN4,
182`endif
183`ifdef MAKE_REGS_RX_5
184 CFGRX5,
185 STSRX5,
186 RXBCLKIN5,
187`endif
188`ifdef MAKE_REGS_RX_6
189 CFGRX6,
190 STSRX6,
191 RXBCLKIN6,
192`endif
193`ifdef MAKE_REGS_RX_7
194 CFGRX7,
195 STSRX7,
196 RXBCLKIN7,
197`endif
198
199 TESTCFG,
200 CFGPLL,
201 STSPLL
202 );
203
204////////////////////////////////////////////////////////////////////////////////
205//
206// Parameters
207//
208////////////////////////////////////////////////////////////////////////////////
209
210parameter pl_cw=12; // (default) PLL config bus width
211parameter pl_cr=32'h0000_000B; // (default) PLL config reg reset value // loj POR 10G. MPY = 4'b0101 ENPLL =1
212parameter pl_ci=32'h0000_0f3f; // (default) PLL config reg bit instantiations
213
214parameter pl_sw=4; // (default) PLL status bus width
215parameter pl_sr=32'h0000_0000; // (default) PLL status reg reset value
216parameter pl_si=32'h0000_0001; // (default) PLL status reg bit instantiations
217parameter pl_ss=32'h0000_0000; // (default) PLL status sticky reg bit locations
218
219parameter te_cw=16; // (default) TEST config bus width
220parameter te_cr=32'h0000_0000; // (default) TEST config reg reset value
221parameter te_ci=32'h0000_7fff; // (default) TEST config reg bit instantiations
222
223parameter tx_cw=20; // loj 24->20 // (default) TX config bus width
224parameter tx_cr=32'h0000_0001; // (default) TX config reg reset value // loj @8-30-05 ENTX[0]<=1
225parameter tx_ci=32'h0073_ffff; // (default) TX config reg bit instantiations
226
227parameter tx_sw=4; // (default) TX status bus width
228parameter tx_sr=32'h0000_0000; // (default) TX status reg reset value
229parameter tx_si=32'h0000_0003; // (default) TX status reg bit instantiations
230parameter tx_ss=32'h0000_0001; // (default) PLL status sticky reg bit locations
231
232parameter rx_cw=28; // (default) RX config bus width
233parameter rx_cr=32'h0000_0101; // (default) RX config reg reset value // loj @8-30-05,TERM[10:8]<= 001(AC coupling), ENRX[0]<=1
234parameter rx_ci=32'h033f_f7ff; // (default) RX config reg bit instantiations
235
236parameter rx_sw=8 ; // loj 12->8 // (default) RX status bus width
237parameter rx_sr=32'h0000_0000; // (default) RX status reg reset value
238parameter rx_si=32'h0000_0339; // (default) RX status reg bit instantiations
239parameter rx_ss=32'h0000_0001; // (default) PLL status sticky reg bit locations
240
241
242//
243// Note : The top ten bits of indirect address are {1'b1,BASEAD}
244//
245parameter pl_ra=10'h000; // (default) PLL register block base address
246parameter te_ra=10'h004; // (default) TEST register block base address
247parameter t0_ra=10'h100; // (default) TX_0 register block base address
248parameter t1_ra=10'h104; // (default) TX_1 register block base address
249parameter t2_ra=10'h108; // (default) TX_2 register block base address
250parameter t3_ra=10'h10C; // (default) TX_3 register block base address
251parameter t4_ra=10'h110; // (default) TX_4 register block base address
252parameter t5_ra=10'h114; // (default) TX_5 register block base address
253parameter t6_ra=10'h118; // (default) TX_6 register block base address
254parameter t7_ra=10'h11C; // (default) TX_7 register block base address
255parameter r0_ra=10'h120; // (default) RX_0 register block base address
256parameter r1_ra=10'h124; // (default) RX_1 register block base address
257parameter r2_ra=10'h128; // (default) RX_2 register block base address
258parameter r3_ra=10'h12C; // (default) RX_3 register block base address
259parameter r4_ra=10'h130; // (default) RX_4 register block base address
260parameter r5_ra=10'h134; // (default) RX_5 register block base address
261parameter r6_ra=10'h138; // (default) RX_6 register block base address
262parameter r7_ra=10'h13C; // (default) RX_7 register block base address
263
264
265////////////////////////////////////////////////////////////////////////////////
266//
267// Port Declarations
268//
269////////////////////////////////////////////////////////////////////////////////
270
271 output io_mdclk;
272 input tcu_clk_stop;
273 input tcu_scan_mode;
274
275 // MDIO Interface
276 input RESET; // Reset
277 input MDCLK; // Clock
278 input MDIN; // Data in
279 output MDOUT; // Data out
280 output MDOE; // Output enable
281
282 // Configuration Interface
283 input[15:0] CFG; // Configuration
284
285 // Scan Interface
286 input SCANEN; // Bypass MDIO2P clocks for scan
287 input SCANCLK; // Scan clock source
288
289
290
291 // Interface to Macro CFG & STS buses
292
293`ifdef MAKE_REGS_TX_0
294output [tx_cw-1:0] CFGTX0;
295input [tx_sw-1:0] STSTX0;
296input TXBCLKIN0;
297`endif
298`ifdef MAKE_REGS_TX_1
299output [tx_cw-1:0] CFGTX1;
300input [tx_sw-1:0] STSTX1;
301input TXBCLKIN1;
302`endif
303`ifdef MAKE_REGS_TX_2
304output [tx_cw-1:0] CFGTX2;
305input [tx_sw-1:0] STSTX2;
306input TXBCLKIN2;
307`endif
308`ifdef MAKE_REGS_TX_3
309output [tx_cw-1:0] CFGTX3;
310input [tx_sw-1:0] STSTX3;
311input TXBCLKIN3;
312`endif
313`ifdef MAKE_REGS_TX_4
314output [tx_cw-1:0] CFGTX4;
315input [tx_sw-1:0] STSTX4;
316input TXBCLKIN4;
317`endif
318`ifdef MAKE_REGS_TX_5
319output [tx_cw-1:0] CFGTX5;
320input [tx_sw-1:0] STSTX5;
321input TXBCLKIN5;
322`endif
323`ifdef MAKE_REGS_TX_6
324output [tx_cw-1:0] CFGTX6;
325input [tx_sw-1:0] STSTX6;
326input TXBCLKIN6;
327`endif
328`ifdef MAKE_REGS_TX_7
329output [tx_cw-1:0] CFGTX7;
330input [tx_sw-1:0] STSTX7;
331input TXBCLKIN7;
332`endif
333`ifdef MAKE_REGS_RX_0
334output [rx_cw-1:0] CFGRX0;
335input [rx_sw-1:0] STSRX0;
336input RXBCLKIN0;
337`endif
338`ifdef MAKE_REGS_RX_1
339output [rx_cw-1:0] CFGRX1;
340input [rx_sw-1:0] STSRX1;
341input RXBCLKIN1;
342`endif
343`ifdef MAKE_REGS_RX_2
344output [rx_cw-1:0] CFGRX2;
345input [rx_sw-1:0] STSRX2;
346input RXBCLKIN2;
347`endif
348`ifdef MAKE_REGS_RX_3
349output [rx_cw-1:0] CFGRX3;
350input [rx_sw-1:0] STSRX3;
351input RXBCLKIN3;
352`endif
353`ifdef MAKE_REGS_RX_4
354output [rx_cw-1:0] CFGRX4;
355input [rx_sw-1:0] STSRX4;
356input RXBCLKIN4;
357`endif
358`ifdef MAKE_REGS_RX_5
359output [rx_cw-1:0] CFGRX5;
360input [rx_sw-1:0] STSRX5;
361input RXBCLKIN5;
362`endif
363`ifdef MAKE_REGS_RX_6
364output [rx_cw-1:0] CFGRX6;
365input [rx_sw-1:0] STSRX6;
366input RXBCLKIN6;
367`endif
368`ifdef MAKE_REGS_RX_7
369output [rx_cw-1:0] CFGRX7;
370input [rx_sw-1:0] STSRX7;
371input RXBCLKIN7;
372`endif
373output [te_cw-1:0] TESTCFG;
374output [pl_cw-1:0] CFGPLL;
375input [pl_sw-1:0] STSPLL;
376
377////////////////////////////////////////////////////////////////////////////////
378//
379// Internal signals
380//
381////////////////////////////////////////////////////////////////////////////////
382
383 // Parallel Interface
384 wire PW; // Write enable
385 wire PR; // Read indicator
386 wire[9:0] PA; // Address
387 wire[15:0] WRITE_DATA; // Data to be written to registers
388 wire[15:0] READ_DATA; // Data read out of registers
389
390
391//
392// Note the PD<>PQ swap below.
393//
394// The Hedwig Framer has an SRAM-like interface, but uses SRAM device directions on its own ports !
395// Ie provides data on PQ and expects data on PD.
396//
397// The P2REGS block expects to be read written as an SRAM, hence the swap
398//
399
400MDIO2P I_MDIO2P
401 (
402
403 .io_mdclk (io_mdclk),
404 .tcu_clk_stop (tcu_clk_stop),
405 .tcu_scan_mode (tcu_scan_mode),
406
407 .RESET (RESET ),
408 .MDCLK (MDCLK ),
409 .MDIN (MDIN ),
410 .MDOUT (MDOUT ),
411 .MDOE (MDOE ),
412 .CFG (CFG ),
413 .PD (READ_DATA ),
414 .PW (PW ),
415 .PR (PR ),
416 .PA (PA ),
417 .PQ (WRITE_DATA ),
418 .SCANEN (SCANEN ),
419 .SCANCLK (SCANCLK )
420 );
421
422P2REGS #(pl_cw,pl_cr,pl_ci,pl_sw,pl_sr,pl_si,pl_ss,
423 te_cw,te_cr,te_ci,
424 tx_cw,tx_cr,tx_ci,tx_sw,tx_sr,tx_si,tx_ss,
425 rx_cw,rx_cr,rx_ci,rx_sw,rx_sr,rx_si,rx_ss,
426 pl_ra,te_ra,
427 t0_ra,t1_ra,t2_ra,t3_ra,t4_ra,t5_ra,t6_ra,t7_ra,
428 r0_ra,r1_ra,r2_ra,r3_ra,r4_ra,r5_ra,r6_ra,r7_ra)
429 I_P2REGS
430 (
431
432 .RESET (RESET ),
433 .IO_MDCLK (io_mdclk ), // cc 093005 consolidated clock domains to single l1 header
434 .SCANEN (SCANEN ),
435// .SCANCLK (SCANCLK ), // cc 093005 not needed
436 .PW (PW ),
437 .PR (PR ),
438 .PA (PA ),
439 .READ_DATA (READ_DATA ),
440 .WRITE_DATA (WRITE_DATA ),
441 //
442 `ifdef MAKE_REGS_TX_0
443 .CFGTX0 (CFGTX0 ),
444 .STSTX0 (STSTX0 ),
445 .TXBCLKIN0 (TXBCLKIN0 ),
446 `endif
447
448 `ifdef MAKE_REGS_TX_1
449 .CFGTX1 (CFGTX1 ),
450 .STSTX1 (STSTX1 ),
451 .TXBCLKIN1 (TXBCLKIN1 ),
452 `endif
453
454 `ifdef MAKE_REGS_TX_2
455 .CFGTX2 (CFGTX2 ),
456 .STSTX2 (STSTX2 ),
457 .TXBCLKIN2 (TXBCLKIN2 ),
458 `endif
459
460 `ifdef MAKE_REGS_TX_3
461 .CFGTX3 (CFGTX3 ),
462 .STSTX3 (STSTX3 ),
463 .TXBCLKIN3 (TXBCLKIN3 ),
464 `endif
465
466 `ifdef MAKE_REGS_TX_4
467 .CFGTX4 (CFGTX4 ),
468 .STSTX4 (STSTX4 ),
469 .TXBCLKIN4 (TXBCLKIN4 ),
470 `endif
471
472 `ifdef MAKE_REGS_TX_5
473 .CFGTX5 (CFGTX5 ),
474 .STSTX5 (STSTX5 ),
475 .TXBCLKIN5 (TXBCLKIN5 ),
476 `endif
477
478 `ifdef MAKE_REGS_TX_6
479 .CFGTX6 (CFGTX6 ),
480 .STSTX6 (STSTX6 ),
481 .TXBCLKIN6 (TXBCLKIN6 ),
482 `endif
483
484 `ifdef MAKE_REGS_TX_7
485 .CFGTX7 (CFGTX7 ),
486 .STSTX7 (STSTX7 ),
487 .TXBCLKIN7 (TXBCLKIN7 ),
488 `endif
489
490 `ifdef MAKE_REGS_RX_0
491 .CFGRX0 (CFGRX0 ),
492 .STSRX0 (STSRX0 ),
493 .RXBCLKIN0 (RXBCLKIN0 ),
494 `endif
495
496 `ifdef MAKE_REGS_RX_1
497 .CFGRX1 (CFGRX1 ),
498 .STSRX1 (STSRX1 ),
499 .RXBCLKIN1 (RXBCLKIN1 ),
500 `endif
501
502 `ifdef MAKE_REGS_RX_2
503 .CFGRX2 (CFGRX2 ),
504 .STSRX2 (STSRX2 ),
505 .RXBCLKIN2 (RXBCLKIN2 ),
506 `endif
507
508 `ifdef MAKE_REGS_RX_3
509 .CFGRX3 (CFGRX3 ),
510 .STSRX3 (STSRX3 ),
511 .RXBCLKIN3 (RXBCLKIN3 ),
512 `endif
513
514 `ifdef MAKE_REGS_RX_4
515 .CFGRX4 (CFGRX4 ),
516 .STSRX4 (STSRX4 ),
517 .RXBCLKIN4 (RXBCLKIN4 ),
518 `endif
519
520 `ifdef MAKE_REGS_RX_5
521 CFGRX5 (CFGRX5 ),
522 STSRX5 (STSRX5 ),
523 .RXBCLKIN5 (RXBCLKIN5 ),
524 `endif
525
526 `ifdef MAKE_REGS_RX_6
527 .CFGRX6 (CFGRX6 ),
528 .STSRX6 (STSRX6 ),
529 .RXBCLKIN6 (RXBCLKIN6 ),
530 `endif
531
532 `ifdef MAKE_REGS_RX_7
533 .CFGRX7 (CFGRX7 ),
534 .STSRX7 (STSRX7 ),
535 .RXBCLKIN7 (RXBCLKIN7 ),
536 `endif
537
538 .TESTCFG (TESTCFG ),
539 .CFGPLL (CFGPLL ),
540 .STSPLL (STSPLL )
541 );
542
543
544
545endmodule