Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: esr_ctl.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 : esr_ctrl.v | |
40 | * Author Name : John Lo | |
41 | * Description : | |
42 | * Parent Module: | |
43 | * Child Module: | |
44 | * Interface Mod: | |
45 | * Date Created : 3/23/04 | |
46 | * | |
47 | * Copyright (c) 2020, Sun Microsystems, Inc. | |
48 | * Sun Proprietary and Confidential | |
49 | * | |
50 | * Modification : | |
51 | * | |
52 | * Synthesis Notes: | |
53 | * | |
54 | *************************************************************************/ | |
55 | ||
56 | ||
57 | module esr_ctl ( | |
58 | pio_core_reset, | |
59 | clk, | |
60 | // pio interface | |
61 | pio_addr, // pio global signal | |
62 | pio_rd, // pio global signal | |
63 | pio_wdata, // pio global signal | |
64 | sel_esr, | |
65 | ack_esr, | |
66 | rdata_esr, | |
67 | pio_err_esr, | |
68 | esr_interrupt, | |
69 | // port0 xpcs, pcs signals | |
70 | esr_mac_sync_0, | |
71 | esr_mac_los_0, | |
72 | serdes_rdy0, | |
73 | xserdes_rdy0, | |
74 | signal_detect0, | |
75 | // port1 xpcs, pcs signals | |
76 | esr_mac_sync_1, | |
77 | esr_mac_los_1, | |
78 | serdes_rdy1, | |
79 | xserdes_rdy1, | |
80 | signal_detect1, | |
81 | /* ----- debug data ----- */ | |
82 | // ---- port 0 serdes 0 | |
83 | // tx side signals | |
84 | xtx_code_group0, | |
85 | tx_code_group0, | |
86 | mac_esr_txd0_0, | |
87 | mac_esr_txd1_0, | |
88 | mac_esr_txd2_0, | |
89 | mac_esr_txd3_0, | |
90 | // rx side signals | |
91 | esr_mac_rxd0_0, | |
92 | esr_mac_rxd1_0, | |
93 | esr_mac_rxd2_0, | |
94 | esr_mac_rxd3_0, | |
95 | xrx_code_group0, | |
96 | rx_code_group0, | |
97 | // ---- port 1 serdes 1 | |
98 | // tx side signals | |
99 | xtx_code_group1, | |
100 | tx_code_group1, | |
101 | mac_esr_txd0_1, | |
102 | mac_esr_txd1_1, | |
103 | mac_esr_txd2_1, | |
104 | mac_esr_txd3_1, | |
105 | // rx side signals | |
106 | esr_mac_rxd0_1, | |
107 | esr_mac_rxd1_1, | |
108 | esr_mac_rxd2_1, | |
109 | esr_mac_rxd3_1, | |
110 | xrx_code_group1, | |
111 | rx_code_group1, | |
112 | serdes_debug | |
113 | ); | |
114 | ||
115 | // global signals | |
116 | input pio_core_reset; | |
117 | input clk; | |
118 | // pio interface | |
119 | input [8:0] pio_addr; // pio global signal | |
120 | input pio_rd; // pio global signal | |
121 | input [31:0] pio_wdata; // pio global signal | |
122 | input sel_esr; | |
123 | output ack_esr; | |
124 | output [31:0] rdata_esr; | |
125 | output pio_err_esr; | |
126 | output esr_interrupt; | |
127 | // port0 xpcs, pcs signals | |
128 | input [3:0] esr_mac_sync_0; | |
129 | input [3:0] esr_mac_los_0; | |
130 | output [3:0] serdes_rdy0; | |
131 | output xserdes_rdy0; | |
132 | output [3:0] signal_detect0; | |
133 | // port1 xpcs, pcs signals | |
134 | input [3:0] esr_mac_sync_1; | |
135 | input [3:0] esr_mac_los_1; | |
136 | output [3:0] serdes_rdy1; | |
137 | output xserdes_rdy1; | |
138 | output [3:0] signal_detect1; | |
139 | /* ----- debug data ----- */ | |
140 | // ----- port 0 serdes 0 | |
141 | // tx side signals | |
142 | input [39:0] xtx_code_group0; | |
143 | input [9:0] tx_code_group0; | |
144 | input [9:0] mac_esr_txd0_0; | |
145 | input [9:0] mac_esr_txd1_0; | |
146 | input [9:0] mac_esr_txd2_0; | |
147 | input [9:0] mac_esr_txd3_0; | |
148 | // rx side signals | |
149 | input [9:0] esr_mac_rxd0_0; | |
150 | input [9:0] esr_mac_rxd1_0; | |
151 | input [9:0] esr_mac_rxd2_0; | |
152 | input [9:0] esr_mac_rxd3_0; | |
153 | input [39:0] xrx_code_group0; | |
154 | input [9:0] rx_code_group0; | |
155 | // ----- port 1 serdes 1 | |
156 | // tx side signals | |
157 | input [39:0] xtx_code_group1; | |
158 | input [9:0] tx_code_group1; | |
159 | input [9:0] mac_esr_txd0_1; | |
160 | input [9:0] mac_esr_txd1_1; | |
161 | input [9:0] mac_esr_txd2_1; | |
162 | input [9:0] mac_esr_txd3_1; | |
163 | // rx side signals | |
164 | input [9:0] esr_mac_rxd0_1; | |
165 | input [9:0] esr_mac_rxd1_1; | |
166 | input [9:0] esr_mac_rxd2_1; | |
167 | input [9:0] esr_mac_rxd3_1; | |
168 | input [39:0] xrx_code_group1; | |
169 | input [9:0] rx_code_group1; | |
170 | output [31:0] serdes_debug; | |
171 | ||
172 | // esr_ctrl | |
173 | wire [3:0] esr_mac_sync_0; | |
174 | wire [3:0] esr_mac_los_0; | |
175 | wire [3:0] serdes_rdy0; | |
176 | wire xserdes_rdy0; | |
177 | wire [3:0] signal_detect0; | |
178 | // port1 xpcs, pcs signals | |
179 | wire [3:0] esr_mac_sync_1; | |
180 | wire [3:0] esr_mac_los_1; | |
181 | wire [3:0] serdes_rdy1; | |
182 | wire xserdes_rdy1; | |
183 | wire [3:0] signal_detect1; | |
184 | ||
185 | wire reset; | |
186 | wire pio_core_reset; | |
187 | wire [31:0] rdata_esr; | |
188 | wire [8:0] reg_offset; | |
189 | wire pio_err_esr; | |
190 | reg [31:0] rd_data; | |
191 | reg non_qualified_addr_err; | |
192 | wire wr_en; | |
193 | wire addr_err; | |
194 | wire esr_interrupt = 0; | |
195 | wire sync0_0; | |
196 | wire sync1_0; | |
197 | wire sync2_0; | |
198 | wire sync3_0; | |
199 | wire sync0_1; | |
200 | wire sync1_1; | |
201 | wire sync2_1; | |
202 | wire sync3_1; | |
203 | wire los0_0; | |
204 | wire los1_0; | |
205 | wire los2_0; | |
206 | wire los3_0; | |
207 | wire los0_1; | |
208 | wire los1_1; | |
209 | wire los2_1; | |
210 | wire los3_1; | |
211 | wire rd_wr; | |
212 | wire core_sel; | |
213 | wire core_sel_lead; | |
214 | // vlint flag_dangling_net_within_module off | |
215 | // vlint flag_net_has_no_load off | |
216 | wire [31:0] wr_data; | |
217 | wire rd_en; | |
218 | wire rac_pls; | |
219 | wire core_sel_trail; | |
220 | // vlint flag_net_has_no_load on | |
221 | // vlint flag_dangling_net_within_module on | |
222 | ||
223 | // ********************************** | |
224 | // serdes0 10G/1G PCS | |
225 | // ********************************** | |
226 | ||
227 | SYNC_CELL sync0_0_SYNC_CELL (.D(esr_mac_sync_0[0]),.CP(clk),.Q(sync0_0)); | |
228 | SYNC_CELL sync1_0_SYNC_CELL (.D(esr_mac_sync_0[1]),.CP(clk),.Q(sync1_0)); | |
229 | SYNC_CELL sync2_0_SYNC_CELL (.D(esr_mac_sync_0[2]),.CP(clk),.Q(sync2_0)); | |
230 | SYNC_CELL sync3_0_SYNC_CELL (.D(esr_mac_sync_0[3]),.CP(clk),.Q(sync3_0)); | |
231 | ||
232 | SYNC_CELL los0_0_SYNC_CELL (.D(esr_mac_los_0[0]),.CP(clk),.Q(los0_0)); | |
233 | SYNC_CELL los1_0_SYNC_CELL (.D(esr_mac_los_0[1]),.CP(clk),.Q(los1_0)); | |
234 | SYNC_CELL los2_0_SYNC_CELL (.D(esr_mac_los_0[2]),.CP(clk),.Q(los2_0)); | |
235 | SYNC_CELL los3_0_SYNC_CELL (.D(esr_mac_los_0[3]),.CP(clk),.Q(los3_0)); | |
236 | ||
237 | SRFF serdes_rdy00_SRFF (.reset(reset),.clk(clk),.iSet(sync0_0),.iRst(los0_0),.oQ(serdes_rdy0[0])); | |
238 | SRFF serdes_rdy10_SRFF (.reset(reset),.clk(clk),.iSet(sync1_0),.iRst(los1_0),.oQ(serdes_rdy0[1])); | |
239 | SRFF serdes_rdy20_SRFF (.reset(reset),.clk(clk),.iSet(sync2_0),.iRst(los2_0),.oQ(serdes_rdy0[2])); | |
240 | SRFF serdes_rdy30_SRFF (.reset(reset),.clk(clk),.iSet(sync3_0),.iRst(los3_0),.oQ(serdes_rdy0[3])); | |
241 | ||
242 | assign xserdes_rdy0 = &serdes_rdy0[3:0]; | |
243 | assign signal_detect0[3:0] = {~los3_0,~los2_0,~los1_0,~los0_0}; | |
244 | ||
245 | ||
246 | // ********************************** | |
247 | // serdes1 10G/1G PCS | |
248 | // ********************************** | |
249 | ||
250 | SYNC_CELL sync0_1_SYNC_CELL (.D(esr_mac_sync_1[0]),.CP(clk),.Q(sync0_1)); | |
251 | SYNC_CELL sync1_1_SYNC_CELL (.D(esr_mac_sync_1[1]),.CP(clk),.Q(sync1_1)); | |
252 | SYNC_CELL sync2_1_SYNC_CELL (.D(esr_mac_sync_1[2]),.CP(clk),.Q(sync2_1)); | |
253 | SYNC_CELL sync3_1_SYNC_CELL (.D(esr_mac_sync_1[3]),.CP(clk),.Q(sync3_1)); | |
254 | ||
255 | SYNC_CELL los0_1_SYNC_CELL (.D(esr_mac_los_1[0]),.CP(clk),.Q(los0_1)); | |
256 | SYNC_CELL los1_1_SYNC_CELL (.D(esr_mac_los_1[1]),.CP(clk),.Q(los1_1)); | |
257 | SYNC_CELL los2_1_SYNC_CELL (.D(esr_mac_los_1[2]),.CP(clk),.Q(los2_1)); | |
258 | SYNC_CELL los3_1_SYNC_CELL (.D(esr_mac_los_1[3]),.CP(clk),.Q(los3_1)); | |
259 | ||
260 | SRFF serdes_rdy01_SRFF (.reset(reset),.clk(clk),.iSet(sync0_1),.iRst(los0_1),.oQ(serdes_rdy1[0])); | |
261 | SRFF serdes_rdy11_SRFF (.reset(reset),.clk(clk),.iSet(sync1_1),.iRst(los1_1),.oQ(serdes_rdy1[1])); | |
262 | SRFF serdes_rdy21_SRFF (.reset(reset),.clk(clk),.iSet(sync2_1),.iRst(los2_1),.oQ(serdes_rdy1[2])); | |
263 | SRFF serdes_rdy31_SRFF (.reset(reset),.clk(clk),.iSet(sync3_1),.iRst(los3_1),.oQ(serdes_rdy1[3])); | |
264 | ||
265 | assign xserdes_rdy1 = &serdes_rdy1[3:0]; | |
266 | assign signal_detect1[3:0] = {~los3_1,~los2_1,~los1_1,~los0_1}; | |
267 | ||
268 | ||
269 | // ********************************** | |
270 | // PIO Control Logic | |
271 | // ********************************** | |
272 | ||
273 | //***** Register the bif interface signals ********************* | |
274 | // To reduce gate count -> take register away | |
275 | // If there is a timing problem then register them again here. | |
276 | //************************************************************** | |
277 | ||
278 | ||
279 | FD1 core_reset_FD1 (.D(pio_core_reset),.CP(clk),.Q(reset)); | |
280 | FD1 rd_wr_FD1 (.D(pio_rd), .CP(clk),.Q(rd_wr)); | |
281 | FD1 core_sel_FD1 (.D(sel_esr), .CP(clk),.Q(core_sel)); | |
282 | ||
283 | RegDff #(9) reg_offset_RegDff(.din(pio_addr[8:0]), | |
284 | .clk(clk), | |
285 | .qout(reg_offset[8:0])); | |
286 | ||
287 | RegDff #(32) wr_data_RegDff (.din(pio_wdata[31:0]), | |
288 | .clk(clk), | |
289 | .qout(wr_data[31:0])); | |
290 | ||
291 | PlsGen2 core_sel_PlsGen2(.sig_in(core_sel),.clk(clk), | |
292 | .lead(core_sel_lead), | |
293 | .trail(core_sel_trail)); | |
294 | ||
295 | assign rd_en = core_sel & rd_wr; | |
296 | wire rac_ok = core_sel_lead & rd_wr; | |
297 | assign wr_en = core_sel_lead & (~rd_wr); | |
298 | ||
299 | RegDff #(32) pio_rd_data_RegDff (.din(rd_data),.clk(clk), | |
300 | .qout(rdata_esr[31:0])); | |
301 | ||
302 | FD1 pio_ack_FD1 (.D(core_sel_lead),.CP(clk),.Q(ack_esr)); | |
303 | FD1 rac_pls_FD1 (.D(rac_ok),.CP(clk),.Q(rac_pls)); | |
304 | assign addr_err = non_qualified_addr_err & core_sel_lead; | |
305 | FD1 pio_err_FD1 (.D(addr_err),.CP(clk),.Q(pio_err_esr)); | |
306 | ||
307 | wire [31:0] serdes_ctl; | |
308 | ||
309 | reg ld_serdes_ctl; | |
310 | ||
311 | /* ----------- Read and Write Address Decoder -------------------------- */ | |
312 | always @ (/*AUTOSENSE*/los0_0 or los0_1 or los1_0 or los1_1 or los2_0 | |
313 | or los2_1 or los3_0 or los3_1 or reg_offset or serdes_ctl | |
314 | or sync0_0 or sync0_1 or sync1_0 or sync1_1 or sync2_0 | |
315 | or sync2_1 or sync3_0 or sync3_1 or wr_en or xserdes_rdy0 | |
316 | or xserdes_rdy1) | |
317 | begin | |
318 | ld_serdes_ctl = 0; | |
319 | non_qualified_addr_err= 0; | |
320 | case (reg_offset[8:0]) //synopsys parallel_case full_case | |
321 | 9'h0:begin | |
322 | rd_data = {14'h0,xserdes_rdy1,xserdes_rdy0, | |
323 | sync3_1,sync2_1,sync1_1,sync0_1,los3_1,los2_1,los1_1,los0_1, | |
324 | sync3_0,sync2_0,sync1_0,sync0_0,los3_0,los2_0,los1_0,los0_0}; | |
325 | end | |
326 | ||
327 | 9'h1:begin | |
328 | ld_serdes_ctl = wr_en; | |
329 | rd_data = serdes_ctl; | |
330 | end | |
331 | ||
332 | default:begin | |
333 | rd_data = 32'hdead_beef; | |
334 | non_qualified_addr_err= 1; | |
335 | end | |
336 | endcase | |
337 | end | |
338 | ||
339 | /* -------------------- serdes -------------------- */ | |
340 | xREG2 #(6) serdes_ctl_xREG2 (.clk(clk), | |
341 | .reset(reset), | |
342 | .reset_value(6'b0), | |
343 | .load(ld_serdes_ctl), | |
344 | .din(wr_data[5:0]), // Bits[2:0] are ignored. | |
345 | .qout(serdes_ctl[5:0])); | |
346 | ||
347 | assign serdes_ctl[31:6] = 0; | |
348 | ||
349 | reg [31:0] serdes_debug; | |
350 | ||
351 | always @ (/*AUTOSENSE*/esr_mac_rxd0_0 or esr_mac_rxd0_1 | |
352 | or esr_mac_rxd1_0 or esr_mac_rxd1_1 or esr_mac_rxd2_0 | |
353 | or esr_mac_rxd2_1 or esr_mac_rxd3_0 or esr_mac_rxd3_1 | |
354 | or mac_esr_txd0_0 or mac_esr_txd0_1 or mac_esr_txd1_0 | |
355 | or mac_esr_txd1_1 or mac_esr_txd2_0 or mac_esr_txd2_1 | |
356 | or mac_esr_txd3_0 or mac_esr_txd3_1 or rx_code_group0 | |
357 | or rx_code_group1 or serdes_ctl or tx_code_group0 | |
358 | or tx_code_group1 or xrx_code_group0 or xrx_code_group1 | |
359 | or xtx_code_group0 or xtx_code_group1) | |
360 | begin | |
361 | case (serdes_ctl[3:0]) // synopsys parallel_case full_case | |
362 | 4'h0 : serdes_debug = xtx_code_group0[31:0]; | |
363 | 4'h1 : serdes_debug = {4'b0,mac_esr_txd0_0[9:0],tx_code_group0[9:0],xtx_code_group0[39:32]}; | |
364 | 4'h2 : serdes_debug = {2'b0,mac_esr_txd3_0[9:0],mac_esr_txd2_0[9:0],mac_esr_txd1_0[9:0]}; | |
365 | 4'h3 : serdes_debug = xrx_code_group0[31:0]; | |
366 | 4'h4 : serdes_debug = {4'b0,esr_mac_rxd0_0[9:0],rx_code_group0[9:0],xrx_code_group0[39:32]}; | |
367 | 4'h5 : serdes_debug = {2'b0,esr_mac_rxd3_0[9:0],esr_mac_rxd2_0[9:0],esr_mac_rxd1_0[9:0]}; | |
368 | ||
369 | 4'h6 : serdes_debug = xtx_code_group1[31:0]; | |
370 | 4'h7 : serdes_debug = {4'b0,mac_esr_txd0_1[9:0],tx_code_group1[9:0],xtx_code_group1[39:32]}; | |
371 | 4'h8 : serdes_debug = {2'b0,mac_esr_txd3_1[9:0],mac_esr_txd2_1[9:0],mac_esr_txd1_1[9:0]}; | |
372 | 4'h9 : serdes_debug = xrx_code_group1[31:0]; | |
373 | 4'ha : serdes_debug = {4'b0,esr_mac_rxd0_1[9:0],rx_code_group1[9:0],xrx_code_group1[39:32]}; | |
374 | 4'hb : serdes_debug = {2'b0,esr_mac_rxd3_1[9:0],esr_mac_rxd2_1[9:0],esr_mac_rxd1_1[9:0]}; | |
375 | default: serdes_debug = xtx_code_group0[31:0]; | |
376 | endcase | |
377 | end // always @ (... | |
378 | ||
379 | ||
380 | ||
381 | endmodule // esr_ctrl | |
382 |