Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / mcu / rtl / mcu_errq_ctl.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: mcu_errq_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 ============================================
35module mcu_errq_ctl (
36 errq_dout,
37 errq_full,
38 errq_empty,
39 errq_enq,
40 errq_deq,
41 errq_din,
42 l1clk,
43 scan_in,
44 scan_out,
45 tcu_aclk,
46 tcu_bclk,
47 tcu_scan_en);
48wire siclk;
49wire soclk;
50wire se;
51wire [5:0] wptr_in;
52wire [5:0] wptr;
53wire ff_wptr_scanin;
54wire ff_wptr_scanout;
55wire [5:0] rptr_in;
56wire [5:0] rptr;
57wire ff_rptr_scanin;
58wire ff_rptr_scanout;
59wire ent0_en;
60wire ff_ent0_scanin;
61wire ff_ent0_scanout;
62wire [14:0] ent0;
63wire ent1_en;
64wire ff_ent1_scanin;
65wire ff_ent1_scanout;
66wire [14:0] ent1;
67wire ent2_en;
68wire ff_ent2_scanin;
69wire ff_ent2_scanout;
70wire [14:0] ent2;
71wire ent3_en;
72wire ff_ent3_scanin;
73wire ff_ent3_scanout;
74wire [14:0] ent3;
75wire ent4_en;
76wire ff_ent4_scanin;
77wire ff_ent4_scanout;
78wire [14:0] ent4;
79wire ent5_en;
80wire ff_ent5_scanin;
81wire ff_ent5_scanout;
82wire [14:0] ent5;
83wire ent6_en;
84wire ff_ent6_scanin;
85wire ff_ent6_scanout;
86wire [14:0] ent6;
87wire ent7_en;
88wire ff_ent7_scanin;
89wire ff_ent7_scanout;
90wire [14:0] ent7;
91wire ent8_en;
92wire ff_ent8_scanin;
93wire ff_ent8_scanout;
94wire [14:0] ent8;
95wire ent9_en;
96wire ff_ent9_scanin;
97wire ff_ent9_scanout;
98wire [14:0] ent9;
99wire ent10_en;
100wire ff_ent10_scanin;
101wire ff_ent10_scanout;
102wire [14:0] ent10;
103wire ent11_en;
104wire ff_ent11_scanin;
105wire ff_ent11_scanout;
106wire [14:0] ent11;
107wire ent12_en;
108wire ff_ent12_scanin;
109wire ff_ent12_scanout;
110wire [14:0] ent12;
111wire ent13_en;
112wire ff_ent13_scanin;
113wire ff_ent13_scanout;
114wire [14:0] ent13;
115wire ent14_en;
116wire ff_ent14_scanin;
117wire ff_ent14_scanout;
118wire [14:0] ent14;
119wire ent15_en;
120wire ff_ent15_scanin;
121wire ff_ent15_scanout;
122wire [14:0] ent15;
123wire ent16_en;
124wire ff_ent16_scanin;
125wire ff_ent16_scanout;
126wire [14:0] ent16;
127
128
129output [14:0] errq_dout;
130output errq_full;
131output errq_empty;
132
133input errq_enq;
134input errq_deq;
135input [14:0] errq_din;
136
137input l1clk;
138input scan_in;
139output scan_out;
140input tcu_aclk;
141input tcu_bclk;
142input tcu_scan_en;
143
144// Code
145assign siclk = tcu_aclk;
146assign soclk = tcu_bclk;
147assign se = tcu_scan_en;
148
149// 0in fifo -enq errq_enq -deq errq_deq -depth 17 -enq_data errq_din[14:0] -deq_data errq_dout[14:0]
150// 0in custom -fire (wptr[4:0] > 5'h10)
151// 0in custom -fire (rptr[4:0] > 5'h10)
152
153assign wptr_in[5:0] = (wptr[4:0] == 5'h10) ? {~wptr[5], 5'h0} : {wptr[5], wptr[4:0] + 5'h1};
154mcu_errq_ctl_msff_ctl_macro__en_1__width_6 ff_wptr (
155 .scan_in(ff_wptr_scanin),
156 .scan_out(ff_wptr_scanout),
157 .din(wptr_in[5:0]),
158 .dout(wptr[5:0]),
159 .en(errq_enq),
160 .l1clk(l1clk),
161 .siclk(siclk),
162 .soclk(soclk));
163
164assign rptr_in[5:0] = (rptr[4:0] == 5'h10) ? {~rptr[5], 5'h0} : {rptr[5], rptr[4:0] + 5'h1};
165mcu_errq_ctl_msff_ctl_macro__en_1__width_6 ff_rptr (
166 .scan_in(ff_rptr_scanin),
167 .scan_out(ff_rptr_scanout),
168 .din(rptr_in[5:0]),
169 .dout(rptr[5:0]),
170 .en(errq_deq),
171 .l1clk(l1clk),
172 .siclk(siclk),
173 .soclk(soclk));
174
175assign errq_full = rptr[5:0] == {~wptr[5],wptr[4:0]};
176assign errq_empty = rptr[5:0] == wptr[5:0];
177
178assign ent0_en = (wptr[4:0] == 5'd0) & errq_enq;
179mcu_errq_ctl_msff_ctl_macro__en_1__width_15 ff_ent0 (
180 .scan_in(ff_ent0_scanin),
181 .scan_out(ff_ent0_scanout),
182 .din(errq_din[14:0]),
183 .dout(ent0[14:0]),
184 .en(ent0_en),
185 .l1clk(l1clk),
186 .siclk(siclk),
187 .soclk(soclk));
188
189assign ent1_en = (wptr[4:0] == 5'd1) & errq_enq;
190mcu_errq_ctl_msff_ctl_macro__en_1__width_15 ff_ent1 (
191 .scan_in(ff_ent1_scanin),
192 .scan_out(ff_ent1_scanout),
193 .din(errq_din[14:0]),
194 .dout(ent1[14:0]),
195 .en(ent1_en),
196 .l1clk(l1clk),
197 .siclk(siclk),
198 .soclk(soclk));
199
200assign ent2_en = (wptr[4:0] == 5'd2) & errq_enq;
201mcu_errq_ctl_msff_ctl_macro__en_1__width_15 ff_ent2 (
202 .scan_in(ff_ent2_scanin),
203 .scan_out(ff_ent2_scanout),
204 .din(errq_din[14:0]),
205 .dout(ent2[14:0]),
206 .en(ent2_en),
207 .l1clk(l1clk),
208 .siclk(siclk),
209 .soclk(soclk));
210
211assign ent3_en = (wptr[4:0] == 5'd3) & errq_enq;
212mcu_errq_ctl_msff_ctl_macro__en_1__width_15 ff_ent3 (
213 .scan_in(ff_ent3_scanin),
214 .scan_out(ff_ent3_scanout),
215 .din(errq_din[14:0]),
216 .dout(ent3[14:0]),
217 .en(ent3_en),
218 .l1clk(l1clk),
219 .siclk(siclk),
220 .soclk(soclk));
221
222assign ent4_en = (wptr[4:0] == 5'd4) & errq_enq;
223mcu_errq_ctl_msff_ctl_macro__en_1__width_15 ff_ent4 (
224 .scan_in(ff_ent4_scanin),
225 .scan_out(ff_ent4_scanout),
226 .din(errq_din[14:0]),
227 .dout(ent4[14:0]),
228 .en(ent4_en),
229 .l1clk(l1clk),
230 .siclk(siclk),
231 .soclk(soclk));
232
233assign ent5_en = (wptr[4:0] == 5'd5) & errq_enq;
234mcu_errq_ctl_msff_ctl_macro__en_1__width_15 ff_ent5 (
235 .scan_in(ff_ent5_scanin),
236 .scan_out(ff_ent5_scanout),
237 .din(errq_din[14:0]),
238 .dout(ent5[14:0]),
239 .en(ent5_en),
240 .l1clk(l1clk),
241 .siclk(siclk),
242 .soclk(soclk));
243
244assign ent6_en = (wptr[4:0] == 5'd6) & errq_enq;
245mcu_errq_ctl_msff_ctl_macro__en_1__width_15 ff_ent6 (
246 .scan_in(ff_ent6_scanin),
247 .scan_out(ff_ent6_scanout),
248 .din(errq_din[14:0]),
249 .dout(ent6[14:0]),
250 .en(ent6_en),
251 .l1clk(l1clk),
252 .siclk(siclk),
253 .soclk(soclk));
254
255assign ent7_en = (wptr[4:0] == 5'd7) & errq_enq;
256mcu_errq_ctl_msff_ctl_macro__en_1__width_15 ff_ent7 (
257 .scan_in(ff_ent7_scanin),
258 .scan_out(ff_ent7_scanout),
259 .din(errq_din[14:0]),
260 .dout(ent7[14:0]),
261 .en(ent7_en),
262 .l1clk(l1clk),
263 .siclk(siclk),
264 .soclk(soclk));
265
266assign ent8_en = (wptr[4:0] == 5'd8) & errq_enq;
267mcu_errq_ctl_msff_ctl_macro__en_1__width_15 ff_ent8 (
268 .scan_in(ff_ent8_scanin),
269 .scan_out(ff_ent8_scanout),
270 .din(errq_din[14:0]),
271 .dout(ent8[14:0]),
272 .en(ent8_en),
273 .l1clk(l1clk),
274 .siclk(siclk),
275 .soclk(soclk));
276
277assign ent9_en = (wptr[4:0] == 5'd9) & errq_enq;
278mcu_errq_ctl_msff_ctl_macro__en_1__width_15 ff_ent9 (
279 .scan_in(ff_ent9_scanin),
280 .scan_out(ff_ent9_scanout),
281 .din(errq_din[14:0]),
282 .dout(ent9[14:0]),
283 .en(ent9_en),
284 .l1clk(l1clk),
285 .siclk(siclk),
286 .soclk(soclk));
287
288assign ent10_en = (wptr[4:0] == 5'd10) & errq_enq;
289mcu_errq_ctl_msff_ctl_macro__en_1__width_15 ff_ent10 (
290 .scan_in(ff_ent10_scanin),
291 .scan_out(ff_ent10_scanout),
292 .din(errq_din[14:0]),
293 .dout(ent10[14:0]),
294 .en(ent10_en),
295 .l1clk(l1clk),
296 .siclk(siclk),
297 .soclk(soclk));
298
299assign ent11_en = (wptr[4:0] == 5'd11) & errq_enq;
300mcu_errq_ctl_msff_ctl_macro__en_1__width_15 ff_ent11 (
301 .scan_in(ff_ent11_scanin),
302 .scan_out(ff_ent11_scanout),
303 .din(errq_din[14:0]),
304 .dout(ent11[14:0]),
305 .en(ent11_en),
306 .l1clk(l1clk),
307 .siclk(siclk),
308 .soclk(soclk));
309
310assign ent12_en = (wptr[4:0] == 5'd12) & errq_enq;
311mcu_errq_ctl_msff_ctl_macro__en_1__width_15 ff_ent12 (
312 .scan_in(ff_ent12_scanin),
313 .scan_out(ff_ent12_scanout),
314 .din(errq_din[14:0]),
315 .dout(ent12[14:0]),
316 .en(ent12_en),
317 .l1clk(l1clk),
318 .siclk(siclk),
319 .soclk(soclk));
320
321assign ent13_en = (wptr[4:0] == 5'd13) & errq_enq;
322mcu_errq_ctl_msff_ctl_macro__en_1__width_15 ff_ent13 (
323 .scan_in(ff_ent13_scanin),
324 .scan_out(ff_ent13_scanout),
325 .din(errq_din[14:0]),
326 .dout(ent13[14:0]),
327 .en(ent13_en),
328 .l1clk(l1clk),
329 .siclk(siclk),
330 .soclk(soclk));
331
332assign ent14_en = (wptr[4:0] == 5'd14) & errq_enq;
333mcu_errq_ctl_msff_ctl_macro__en_1__width_15 ff_ent14 (
334 .scan_in(ff_ent14_scanin),
335 .scan_out(ff_ent14_scanout),
336 .din(errq_din[14:0]),
337 .dout(ent14[14:0]),
338 .en(ent14_en),
339 .l1clk(l1clk),
340 .siclk(siclk),
341 .soclk(soclk));
342
343assign ent15_en = (wptr[4:0] == 5'd15) & errq_enq;
344mcu_errq_ctl_msff_ctl_macro__en_1__width_15 ff_ent15 (
345 .scan_in(ff_ent15_scanin),
346 .scan_out(ff_ent15_scanout),
347 .din(errq_din[14:0]),
348 .dout(ent15[14:0]),
349 .en(ent15_en),
350 .l1clk(l1clk),
351 .siclk(siclk),
352 .soclk(soclk));
353
354assign ent16_en = (wptr[4:0] == 5'd16) & errq_enq;
355mcu_errq_ctl_msff_ctl_macro__en_1__width_15 ff_ent16 (
356 .scan_in(ff_ent16_scanin),
357 .scan_out(ff_ent16_scanout),
358 .din(errq_din[14:0]),
359 .dout(ent16[14:0]),
360 .en(ent16_en),
361 .l1clk(l1clk),
362 .siclk(siclk),
363 .soclk(soclk));
364
365// FIFO output selection
366assign errq_dout[14:0] =
367 {15{rptr[4:0] == 5'd0}} & ent0[14:0] |
368 {15{rptr[4:0] == 5'd1}} & ent1[14:0] |
369 {15{rptr[4:0] == 5'd2}} & ent2[14:0] |
370 {15{rptr[4:0] == 5'd3}} & ent3[14:0] |
371 {15{rptr[4:0] == 5'd4}} & ent4[14:0] |
372 {15{rptr[4:0] == 5'd5}} & ent5[14:0] |
373 {15{rptr[4:0] == 5'd6}} & ent6[14:0] |
374 {15{rptr[4:0] == 5'd7}} & ent7[14:0] |
375 {15{rptr[4:0] == 5'd8}} & ent8[14:0] |
376 {15{rptr[4:0] == 5'd9}} & ent9[14:0] |
377 {15{rptr[4:0] == 5'd10}} & ent10[14:0] |
378 {15{rptr[4:0] == 5'd11}} & ent11[14:0] |
379 {15{rptr[4:0] == 5'd12}} & ent12[14:0] |
380 {15{rptr[4:0] == 5'd13}} & ent13[14:0] |
381 {15{rptr[4:0] == 5'd14}} & ent14[14:0] |
382 {15{rptr[4:0] == 5'd15}} & ent15[14:0] |
383 {15{rptr[4:0] == 5'd16}} & ent16[14:0];
384
385// fixscan start:
386assign ff_wptr_scanin = scan_in ;
387assign ff_rptr_scanin = ff_wptr_scanout ;
388assign ff_ent0_scanin = ff_rptr_scanout ;
389assign ff_ent1_scanin = ff_ent0_scanout ;
390assign ff_ent2_scanin = ff_ent1_scanout ;
391assign ff_ent3_scanin = ff_ent2_scanout ;
392assign ff_ent4_scanin = ff_ent3_scanout ;
393assign ff_ent5_scanin = ff_ent4_scanout ;
394assign ff_ent6_scanin = ff_ent5_scanout ;
395assign ff_ent7_scanin = ff_ent6_scanout ;
396assign ff_ent8_scanin = ff_ent7_scanout ;
397assign ff_ent9_scanin = ff_ent8_scanout ;
398assign ff_ent10_scanin = ff_ent9_scanout ;
399assign ff_ent11_scanin = ff_ent10_scanout ;
400assign ff_ent12_scanin = ff_ent11_scanout ;
401assign ff_ent13_scanin = ff_ent12_scanout ;
402assign ff_ent14_scanin = ff_ent13_scanout ;
403assign ff_ent15_scanin = ff_ent14_scanout ;
404assign ff_ent16_scanin = ff_ent15_scanout ;
405assign scan_out = ff_ent16_scanout ;
406// fixscan end:
407endmodule
408
409
410
411
412
413
414// any PARAMS parms go into naming of macro
415
416module mcu_errq_ctl_msff_ctl_macro__en_1__width_6 (
417 din,
418 en,
419 l1clk,
420 scan_in,
421 siclk,
422 soclk,
423 dout,
424 scan_out);
425wire [5:0] fdin;
426wire [4:0] so;
427
428 input [5:0] din;
429 input en;
430 input l1clk;
431 input scan_in;
432
433
434 input siclk;
435 input soclk;
436
437 output [5:0] dout;
438 output scan_out;
439assign fdin[5:0] = (din[5:0] & {6{en}}) | (dout[5:0] & ~{6{en}});
440
441
442
443
444
445
446dff #(6) d0_0 (
447.l1clk(l1clk),
448.siclk(siclk),
449.soclk(soclk),
450.d(fdin[5:0]),
451.si({scan_in,so[4:0]}),
452.so({so[4:0],scan_out}),
453.q(dout[5:0])
454);
455
456
457
458
459
460
461
462
463
464
465
466
467endmodule
468
469
470
471
472
473
474
475
476
477
478
479
480
481// any PARAMS parms go into naming of macro
482
483module mcu_errq_ctl_msff_ctl_macro__en_1__width_15 (
484 din,
485 en,
486 l1clk,
487 scan_in,
488 siclk,
489 soclk,
490 dout,
491 scan_out);
492wire [14:0] fdin;
493wire [13:0] so;
494
495 input [14:0] din;
496 input en;
497 input l1clk;
498 input scan_in;
499
500
501 input siclk;
502 input soclk;
503
504 output [14:0] dout;
505 output scan_out;
506assign fdin[14:0] = (din[14:0] & {15{en}}) | (dout[14:0] & ~{15{en}});
507
508
509
510
511
512
513dff #(15) d0_0 (
514.l1clk(l1clk),
515.siclk(siclk),
516.soclk(soclk),
517.d(fdin[14:0]),
518.si({scan_in,so[13:0]}),
519.so({so[13:0],scan_out}),
520.q(dout[14:0])
521);
522
523
524
525
526
527
528
529
530
531
532
533
534endmodule
535
536
537
538
539
540
541
542