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