Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / niu / rtl / xpcs_dpath.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: xpcs_dpath.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 ============================================
35module xpcs_dpath ( tx_clk, rx_clk, rbc0_b, rbc0_c, rbc0_d,
36 csr_loopback, csr_enable_tx_buffers,
37 tx_symbols_mux, rx_symbols_mux,
38 rx_symbols_dft, tx_symbols_dft,
39 rx_symbols_dft_dummy,
40 xrx_code_group_muxout, xtx_code_group);
41
42input tx_clk;
43
44input rx_clk; // rbc0_a 312 Mhz rx clock from serdes
45input rbc0_b; // 312 Mhz rx clock from serdes
46input rbc0_c; // 312 Mhz rx clock from serdes
47input rbc0_d; // 312 Mhz rx clock from serdes
48
49input csr_loopback;
50input csr_enable_tx_buffers;
51input [39:0] tx_symbols_mux;
52input [39:0] rx_symbols_mux;
53
54input [39:0] rx_symbols_dft;
55
56output [39:0] tx_symbols_dft;
57
58output [39:0] xrx_code_group_muxout;
59output [39:0] xtx_code_group;
60
61output rx_symbols_dft_dummy;
62
63reg [39:0] xtx_code_group;
64reg [39:0] rx_symbols_reg;
65
66reg [39:0] rx_symbols_dft_reg;
67reg [39:0] tx_symbols_dft;
68
69reg rx_symbols_dft_dummy;
70
71wire [39:0] xrx_code_group_muxout;
72
73wire [9:0] rx_symbol_0;
74wire [9:0] rx_symbol_1;
75wire [9:0] rx_symbol_2;
76wire [9:0] rx_symbol_3;
77
78wire [9:0] tx_symbol_0;
79wire [9:0] tx_symbol_1;
80wire [9:0] tx_symbol_2;
81wire [9:0] tx_symbol_3;
82
83
84// *****************************************************************************
85// Flip data msb -> lsb per Symbol and Register receive data from serdes
86// *****************************************************************************
87
88assign rx_symbol_3 = {rx_symbols_mux[30],
89 rx_symbols_mux[31],
90 rx_symbols_mux[32],
91 rx_symbols_mux[33],
92 rx_symbols_mux[34],
93 rx_symbols_mux[35],
94 rx_symbols_mux[36],
95 rx_symbols_mux[37],
96 rx_symbols_mux[38],
97 rx_symbols_mux[39]};
98
99assign rx_symbol_2 = {rx_symbols_mux[20],
100 rx_symbols_mux[21],
101 rx_symbols_mux[22],
102 rx_symbols_mux[23],
103 rx_symbols_mux[24],
104 rx_symbols_mux[25],
105 rx_symbols_mux[26],
106 rx_symbols_mux[27],
107 rx_symbols_mux[28],
108 rx_symbols_mux[29]};
109
110assign rx_symbol_1 = {rx_symbols_mux[10],
111 rx_symbols_mux[11],
112 rx_symbols_mux[12],
113 rx_symbols_mux[13],
114 rx_symbols_mux[14],
115 rx_symbols_mux[15],
116 rx_symbols_mux[16],
117 rx_symbols_mux[17],
118 rx_symbols_mux[18],
119 rx_symbols_mux[19]};
120
121assign rx_symbol_0 = {rx_symbols_mux[0],
122 rx_symbols_mux[1],
123 rx_symbols_mux[2],
124 rx_symbols_mux[3],
125 rx_symbols_mux[4],
126 rx_symbols_mux[5],
127 rx_symbols_mux[6],
128 rx_symbols_mux[7],
129 rx_symbols_mux[8],
130 rx_symbols_mux[9]};
131
132always @ (posedge rx_clk)
133 begin
134 rx_symbols_reg[9:0] <= rx_symbol_0 ;
135 end
136
137always @ (posedge rbc0_b)
138 begin
139 rx_symbols_reg[19:10] <= rx_symbol_1 ;
140 end
141
142always @ (posedge rbc0_c)
143 begin
144 rx_symbols_reg[29:20] <= rx_symbol_2 ;
145 end
146
147always @ (posedge rbc0_d)
148 begin
149 rx_symbols_reg[39:30] <= rx_symbol_3 ;
150 end
151
152
153// *****************************************************************************
154// Flip data msb -> lsb per Symbol and Register transmit data to serdes
155// *****************************************************************************
156
157assign tx_symbol_3 = {tx_symbols_mux[30],
158 tx_symbols_mux[31],
159 tx_symbols_mux[32],
160 tx_symbols_mux[33],
161 tx_symbols_mux[34],
162 tx_symbols_mux[35],
163 tx_symbols_mux[36],
164 tx_symbols_mux[37],
165 tx_symbols_mux[38],
166 tx_symbols_mux[39]};
167
168assign tx_symbol_2 = {tx_symbols_mux[20],
169 tx_symbols_mux[21],
170 tx_symbols_mux[22],
171 tx_symbols_mux[23],
172 tx_symbols_mux[24],
173 tx_symbols_mux[25],
174 tx_symbols_mux[26],
175 tx_symbols_mux[27],
176 tx_symbols_mux[28],
177 tx_symbols_mux[29]};
178
179assign tx_symbol_1 = {tx_symbols_mux[10],
180 tx_symbols_mux[11],
181 tx_symbols_mux[12],
182 tx_symbols_mux[13],
183 tx_symbols_mux[14],
184 tx_symbols_mux[15],
185 tx_symbols_mux[16],
186 tx_symbols_mux[17],
187 tx_symbols_mux[18],
188 tx_symbols_mux[19]};
189
190assign tx_symbol_0 = {tx_symbols_mux[0],
191 tx_symbols_mux[1],
192 tx_symbols_mux[2],
193 tx_symbols_mux[3],
194 tx_symbols_mux[4],
195 tx_symbols_mux[5],
196 tx_symbols_mux[6],
197 tx_symbols_mux[7],
198 tx_symbols_mux[8],
199 tx_symbols_mux[9]};
200
201always @ (posedge tx_clk)
202 xtx_code_group <= csr_enable_tx_buffers ? {tx_symbol_3,
203 tx_symbol_2,
204 tx_symbol_1,
205 tx_symbol_0} : 40'b0 ;
206
207
208// **********************************************************************
209// Loopback Mux
210// **********************************************************************
211
212assign xrx_code_group_muxout = csr_loopback ? tx_symbols_mux : rx_symbols_reg ;
213
214
215// **********************************************************************
216// NEC serdes dft requires registering unused Serdes inputs and outputs
217// **********************************************************************
218
219always @ (posedge tx_clk)
220 tx_symbols_dft <= 40'h0000000000;
221
222
223always @ (posedge rx_clk)
224 begin
225 rx_symbols_dft_reg[9:0] <= rx_symbols_dft[9:0] ;
226 end
227
228always @ (posedge rbc0_b)
229 begin
230 rx_symbols_dft_reg[19:10] <= rx_symbols_dft[19:10] ;
231 end
232
233always @ (posedge rbc0_c)
234 begin
235 rx_symbols_dft_reg[29:20] <= rx_symbols_dft[29:20] ;
236 end
237
238always @ (posedge rbc0_d)
239 begin
240 rx_symbols_dft_reg[39:30] <= rx_symbols_dft[39:30] ;
241 end
242
243
244// summit modcovoff -bpe
245
246always @ (posedge rx_clk)
247 begin
248 rx_symbols_dft_dummy <= |rx_symbols_dft_reg ;
249 end
250
251// summit modcovon -bpe
252
253
254
255
256endmodule