Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / ncu / rtl / ncu_ssiui4_ctl.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: ncu_ssiui4_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 UCB_BUS_WIDTH 4
36`define UCB_BUS_WIDTH_M1 3
37`define CYC_NUM 32
38`define CYC_NUM_M1 31
39
40module ncu_ssiui4_ctl (
41 iol2clk,
42 scan_in,
43 scan_out,
44 tcu_pce_ov,
45 tcu_clk_stop,
46 tcu_scan_en,
47 tcu_aclk,
48 tcu_bclk,
49 vld,
50 data,
51 stall,
52 indata_buf_vld,
53 indata_buf,
54 stall_a1) ;
55wire stall_d1_n;
56wire stall_d1;
57wire vld_d1_ff_scanin;
58wire vld_d1_ff_scanout;
59wire vld_d1;
60wire l1clk;
61wire data_d1_ff_scanin;
62wire data_d1_ff_scanout;
63wire [3:0] data_d1;
64wire stall_ff_scanin;
65wire stall_ff_scanout;
66wire stall_d1_ff_scanin;
67wire stall_d1_ff_scanout;
68wire skid_buf0_en;
69wire vld_buf0_ff_scanin;
70wire vld_buf0_ff_scanout;
71wire vld_buf0;
72wire data_buf0_ff_scanin;
73wire data_buf0_ff_scanout;
74wire [3:0] data_buf0;
75wire skid_buf1_en_ff_scanin;
76wire skid_buf1_en_ff_scanout;
77wire skid_buf1_en;
78wire vld_buf1_ff_scanin;
79wire vld_buf1_ff_scanout;
80wire vld_buf1;
81wire data_buf1_ff_scanin;
82wire data_buf1_ff_scanout;
83wire [3:0] data_buf1;
84wire skid_buf0_sel;
85wire skid_buf1_sel_ff_scanin;
86wire skid_buf1_sel_ff_scanout;
87wire skid_buf1_sel;
88wire vld_mux;
89wire [3:0] data_mux;
90wire [31:0] indata_vec_next;
91wire [31:0] indata_vec;
92wire stall_a1_n;
93wire indata_vec_ff_scanin;
94wire indata_vec_ff_scanout;
95wire [127:0] indata_buf_next;
96wire indata_buf_ff_scanin;
97wire indata_buf_ff_scanout;
98wire indata_vec0_d1_ff_scanin;
99wire indata_vec0_d1_ff_scanout;
100wire indata_vec0_d1;
101wire siclk;
102wire soclk;
103wire se;
104wire pce_ov;
105wire stop;
106
107
108////////////////////////////////////////////////////////////////////////
109// Signal declarations
110////////////////////////////////////////////////////////////////////////
111// Global interface
112input iol2clk;
113input scan_in;
114output scan_out;
115input tcu_pce_ov;
116input tcu_clk_stop;
117input tcu_scan_en;
118input tcu_aclk;
119input tcu_bclk;
120
121// UCB bus interface
122input vld;
123input [`UCB_BUS_WIDTH_M1 :0] data;
124output stall;
125
126
127// Local interface
128output indata_buf_vld;
129output [127:0] indata_buf;
130input stall_a1;
131
132
133// Internal signals
134
135
136////////////////////////////////////////////////////////////////////////
137// Code starts here
138////////////////////////////////////////////////////////////////////////
139/************************************************************
140 * UCB bus interface flops
141 * This is to make signals going between IOB and UCB flop-to-flop
142 * to improve timing.
143 ************************************************************/
144assign stall_d1_n = ~stall_d1;
145ncu_ssiui4_ctl_msff_ctl_macro__en_1__width_1 vld_d1_ff
146 (
147 .scan_in(vld_d1_ff_scanin),
148 .scan_out(vld_d1_ff_scanout),
149 .dout (vld_d1),
150 .l1clk (l1clk),
151 .en (stall_d1_n),
152 .din (vld),
153 .siclk(siclk),
154 .soclk(soclk)
155 );
156
157ncu_ssiui4_ctl_msff_ctl_macro__en_1__width_4 data_d1_ff
158 (
159 .scan_in(data_d1_ff_scanin),
160 .scan_out(data_d1_ff_scanout),
161 .dout (data_d1[`UCB_BUS_WIDTH_M1:0]),
162 .l1clk (l1clk),
163 .en (stall_d1_n),
164 .din (data[`UCB_BUS_WIDTH_M1:0]),
165 .siclk(siclk),
166 .soclk(soclk)
167 );
168
169ncu_ssiui4_ctl_msff_ctl_macro__width_1 stall_ff
170 (
171 .scan_in(stall_ff_scanin),
172 .scan_out(stall_ff_scanout),
173 .dout (stall),
174 .l1clk (l1clk),
175 .din (stall_a1),
176 .siclk(siclk),
177 .soclk(soclk)
178 );
179
180ncu_ssiui4_ctl_msff_ctl_macro__width_1 stall_d1_ff
181 (
182 .scan_in(stall_d1_ff_scanin),
183 .scan_out(stall_d1_ff_scanout),
184 .dout (stall_d1),
185 .l1clk (l1clk),
186 .din (stall),
187 .siclk(siclk),
188 .soclk(soclk)
189 );
190
191
192/************************************************************
193 * Skid buffer
194 * We need a two deep skid buffer to handle stalling.
195 ************************************************************/
196// Assertion: stall has to be deasserted for more than 1 cycle
197// ie time between two separate stalls has to be
198// at least two cycles. Otherwise, contents from
199// skid buffer will be lost.
200
201// Buffer 0
202assign skid_buf0_en = stall_a1 & ~stall;
203
204ncu_ssiui4_ctl_msff_ctl_macro__en_1__width_1 vld_buf0_ff
205 (
206 .scan_in(vld_buf0_ff_scanin),
207 .scan_out(vld_buf0_ff_scanout),
208 .dout (vld_buf0),
209 .l1clk (l1clk),
210 .en (skid_buf0_en),
211 .din (vld_d1),
212 .siclk(siclk),
213 .soclk(soclk)
214 );
215
216ncu_ssiui4_ctl_msff_ctl_macro__en_1__width_4 data_buf0_ff
217 (
218 .scan_in(data_buf0_ff_scanin),
219 .scan_out(data_buf0_ff_scanout),
220 .dout (data_buf0[`UCB_BUS_WIDTH_M1 :0]),
221 .l1clk (l1clk),
222 .en (skid_buf0_en),
223 .din (data_d1[`UCB_BUS_WIDTH_M1 :0]),
224 .siclk(siclk),
225 .soclk(soclk)
226 );
227
228// Buffer 1
229ncu_ssiui4_ctl_msff_ctl_macro__width_1 skid_buf1_en_ff
230 (
231 .scan_in(skid_buf1_en_ff_scanin),
232 .scan_out(skid_buf1_en_ff_scanout),
233 .dout (skid_buf1_en),
234 .l1clk (l1clk),
235 .din (skid_buf0_en),
236 .siclk(siclk),
237 .soclk(soclk)
238 );
239
240ncu_ssiui4_ctl_msff_ctl_macro__en_1__width_1 vld_buf1_ff
241 (
242 .scan_in(vld_buf1_ff_scanin),
243 .scan_out(vld_buf1_ff_scanout),
244 .dout (vld_buf1),
245 .l1clk (l1clk),
246 .en (skid_buf1_en),
247 .din (vld_d1),
248 .siclk(siclk),
249 .soclk(soclk)
250 );
251
252ncu_ssiui4_ctl_msff_ctl_macro__en_1__width_4 data_buf1_ff
253 (
254 .scan_in(data_buf1_ff_scanin),
255 .scan_out(data_buf1_ff_scanout),
256 .dout (data_buf1[`UCB_BUS_WIDTH_M1 :0]),
257 .l1clk (l1clk),
258 .en (skid_buf1_en),
259 .din (data_d1[`UCB_BUS_WIDTH_M1 :0]),
260 .siclk(siclk),
261 .soclk(soclk)
262 );
263
264
265/************************************************************
266 * Mux between skid buffer and interface flop
267 ************************************************************/
268// Assertion: stall has to be deasserted for more than 1 cycle
269// ie time between two separate stalls has to be
270// at least two cycles. Otherwise, contents from
271// skid buffer will be lost.
272
273assign skid_buf0_sel = ~stall_a1 & stall;
274
275ncu_ssiui4_ctl_msff_ctl_macro__width_1 skid_buf1_sel_ff
276 (
277 .scan_in(skid_buf1_sel_ff_scanin),
278 .scan_out(skid_buf1_sel_ff_scanout),
279 .dout (skid_buf1_sel),
280 .l1clk (l1clk),
281 .din (skid_buf0_sel),
282 .siclk(siclk),
283 .soclk(soclk)
284 );
285
286assign vld_mux = skid_buf0_sel ? vld_buf0 :
287 skid_buf1_sel ? vld_buf1 :
288 vld_d1;
289
290assign data_mux[`UCB_BUS_WIDTH_M1 :0] = skid_buf0_sel ? data_buf0[`UCB_BUS_WIDTH_M1 :0] :
291 skid_buf1_sel ? data_buf1[`UCB_BUS_WIDTH_M1 :0] :
292 data_d1[`UCB_BUS_WIDTH_M1 :0];
293
294
295/************************************************************
296 * Assemble inbound data
297 ************************************************************/
298// valid vector
299assign indata_vec_next[`CYC_NUM_M1:0] = {vld_mux, indata_vec[`CYC_NUM_M1 :1]};
300
301assign stall_a1_n = ~stall_a1;
302ncu_ssiui4_ctl_msff_ctl_macro__en_1__width_32 indata_vec_ff
303 (
304 .scan_in(indata_vec_ff_scanin),
305 .scan_out(indata_vec_ff_scanout),
306 .dout (indata_vec[`CYC_NUM_M1 :0]),
307 .l1clk (l1clk),
308 .en (stall_a1_n),
309 .din (indata_vec_next[`CYC_NUM_M1 :0]),
310 .siclk(siclk),
311 .soclk(soclk)
312 );
313
314// data buffer
315assign indata_buf_next[127:0] = {data_mux[`UCB_BUS_WIDTH_M1 :0], indata_buf[127:`UCB_BUS_WIDTH ]};
316ncu_ssiui4_ctl_msff_ctl_macro__en_1__width_128 indata_buf_ff
317 (
318 .scan_in(indata_buf_ff_scanin),
319 .scan_out(indata_buf_ff_scanout),
320 .dout (indata_buf[127:0]),
321 .l1clk (l1clk),
322 .en (stall_a1_n),
323 .din (indata_buf_next[127:0]),
324 .siclk(siclk),
325 .soclk(soclk)
326 );
327
328// detect a new packet
329ncu_ssiui4_ctl_msff_ctl_macro__en_1__width_1 indata_vec0_d1_ff
330 (
331 .scan_in(indata_vec0_d1_ff_scanin),
332 .scan_out(indata_vec0_d1_ff_scanout),
333 .dout (indata_vec0_d1),
334 .l1clk (l1clk),
335 .en (stall_a1_n),
336 .din (indata_vec[0]),
337 .siclk(siclk),
338 .soclk(soclk)
339 );
340
341assign indata_buf_vld = indata_vec[0] & ~indata_vec0_d1;
342
343
344
345
346
347/**** adding clock header ****/
348ncu_ssiui4_ctl_l1clkhdr_ctl_macro clkgen (
349 .l2clk (iol2clk),
350 .l1en (1'b1),
351 .l1clk (l1clk),
352 .pce_ov(pce_ov),
353 .stop(stop),
354 .se(se)
355 );
356
357/*** building tcu port ***/
358assign siclk = tcu_aclk;
359assign soclk = tcu_bclk;
360assign se = tcu_scan_en;
361assign pce_ov = tcu_pce_ov;
362assign stop = tcu_clk_stop;
363
364// fixscan start:
365assign vld_d1_ff_scanin = scan_in ;
366assign data_d1_ff_scanin = vld_d1_ff_scanout ;
367assign stall_ff_scanin = data_d1_ff_scanout ;
368assign stall_d1_ff_scanin = stall_ff_scanout ;
369assign vld_buf0_ff_scanin = stall_d1_ff_scanout ;
370assign data_buf0_ff_scanin = vld_buf0_ff_scanout ;
371assign skid_buf1_en_ff_scanin = data_buf0_ff_scanout ;
372assign vld_buf1_ff_scanin = skid_buf1_en_ff_scanout ;
373assign data_buf1_ff_scanin = vld_buf1_ff_scanout ;
374assign skid_buf1_sel_ff_scanin = data_buf1_ff_scanout ;
375assign indata_vec_ff_scanin = skid_buf1_sel_ff_scanout ;
376assign indata_buf_ff_scanin = indata_vec_ff_scanout ;
377assign indata_vec0_d1_ff_scanin = indata_buf_ff_scanout ;
378assign scan_out = indata_vec0_d1_ff_scanout;
379// fixscan end:
380endmodule // ucb_bus_in
381
382
383
384
385
386
387// any PARAMS parms go into naming of macro
388
389module ncu_ssiui4_ctl_msff_ctl_macro__en_1__width_1 (
390 din,
391 en,
392 l1clk,
393 scan_in,
394 siclk,
395 soclk,
396 dout,
397 scan_out);
398wire [0:0] fdin;
399
400 input [0:0] din;
401 input en;
402 input l1clk;
403 input scan_in;
404
405
406 input siclk;
407 input soclk;
408
409 output [0:0] dout;
410 output scan_out;
411assign fdin[0:0] = (din[0:0] & {1{en}}) | (dout[0:0] & ~{1{en}});
412
413
414
415
416
417
418dff #(1) d0_0 (
419.l1clk(l1clk),
420.siclk(siclk),
421.soclk(soclk),
422.d(fdin[0:0]),
423.si(scan_in),
424.so(scan_out),
425.q(dout[0:0])
426);
427
428
429
430
431
432
433
434
435
436
437
438
439endmodule
440
441
442
443
444
445
446
447
448
449
450
451
452
453// any PARAMS parms go into naming of macro
454
455module ncu_ssiui4_ctl_msff_ctl_macro__en_1__width_4 (
456 din,
457 en,
458 l1clk,
459 scan_in,
460 siclk,
461 soclk,
462 dout,
463 scan_out);
464wire [3:0] fdin;
465wire [2:0] so;
466
467 input [3:0] din;
468 input en;
469 input l1clk;
470 input scan_in;
471
472
473 input siclk;
474 input soclk;
475
476 output [3:0] dout;
477 output scan_out;
478assign fdin[3:0] = (din[3:0] & {4{en}}) | (dout[3:0] & ~{4{en}});
479
480
481
482
483
484
485dff #(4) d0_0 (
486.l1clk(l1clk),
487.siclk(siclk),
488.soclk(soclk),
489.d(fdin[3:0]),
490.si({scan_in,so[2:0]}),
491.so({so[2:0],scan_out}),
492.q(dout[3:0])
493);
494
495
496
497
498
499
500
501
502
503
504
505
506endmodule
507
508
509
510
511
512
513
514
515
516
517
518
519
520// any PARAMS parms go into naming of macro
521
522module ncu_ssiui4_ctl_msff_ctl_macro__width_1 (
523 din,
524 l1clk,
525 scan_in,
526 siclk,
527 soclk,
528 dout,
529 scan_out);
530wire [0:0] fdin;
531
532 input [0:0] din;
533 input l1clk;
534 input scan_in;
535
536
537 input siclk;
538 input soclk;
539
540 output [0:0] dout;
541 output scan_out;
542assign fdin[0:0] = din[0:0];
543
544
545
546
547
548
549dff #(1) d0_0 (
550.l1clk(l1clk),
551.siclk(siclk),
552.soclk(soclk),
553.d(fdin[0:0]),
554.si(scan_in),
555.so(scan_out),
556.q(dout[0:0])
557);
558
559
560
561
562
563
564
565
566
567
568
569
570endmodule
571
572
573
574
575
576
577
578
579
580
581
582
583
584// any PARAMS parms go into naming of macro
585
586module ncu_ssiui4_ctl_msff_ctl_macro__en_1__width_32 (
587 din,
588 en,
589 l1clk,
590 scan_in,
591 siclk,
592 soclk,
593 dout,
594 scan_out);
595wire [31:0] fdin;
596wire [30:0] so;
597
598 input [31:0] din;
599 input en;
600 input l1clk;
601 input scan_in;
602
603
604 input siclk;
605 input soclk;
606
607 output [31:0] dout;
608 output scan_out;
609assign fdin[31:0] = (din[31:0] & {32{en}}) | (dout[31:0] & ~{32{en}});
610
611
612
613
614
615
616dff #(32) d0_0 (
617.l1clk(l1clk),
618.siclk(siclk),
619.soclk(soclk),
620.d(fdin[31:0]),
621.si({scan_in,so[30:0]}),
622.so({so[30:0],scan_out}),
623.q(dout[31:0])
624);
625
626
627
628
629
630
631
632
633
634
635
636
637endmodule
638
639
640
641
642
643
644
645
646
647
648
649
650
651// any PARAMS parms go into naming of macro
652
653module ncu_ssiui4_ctl_msff_ctl_macro__en_1__width_128 (
654 din,
655 en,
656 l1clk,
657 scan_in,
658 siclk,
659 soclk,
660 dout,
661 scan_out);
662wire [127:0] fdin;
663wire [126:0] so;
664
665 input [127:0] din;
666 input en;
667 input l1clk;
668 input scan_in;
669
670
671 input siclk;
672 input soclk;
673
674 output [127:0] dout;
675 output scan_out;
676assign fdin[127:0] = (din[127:0] & {128{en}}) | (dout[127:0] & ~{128{en}});
677
678
679
680
681
682
683dff #(128) d0_0 (
684.l1clk(l1clk),
685.siclk(siclk),
686.soclk(soclk),
687.d(fdin[127:0]),
688.si({scan_in,so[126:0]}),
689.so({so[126:0],scan_out}),
690.q(dout[127:0])
691);
692
693
694
695
696
697
698
699
700
701
702
703
704endmodule
705
706
707
708
709
710
711
712
713
714
715
716
717
718// any PARAMS parms go into naming of macro
719
720module ncu_ssiui4_ctl_l1clkhdr_ctl_macro (
721 l2clk,
722 l1en,
723 pce_ov,
724 stop,
725 se,
726 l1clk);
727
728
729 input l2clk;
730 input l1en;
731 input pce_ov;
732 input stop;
733 input se;
734 output l1clk;
735
736
737
738
739
740cl_sc1_l1hdr_8x c_0 (
741
742
743 .l2clk(l2clk),
744 .pce(l1en),
745 .l1clk(l1clk),
746 .se(se),
747 .pce_ov(pce_ov),
748 .stop(stop)
749);
750
751
752
753endmodule
754
755
756
757
758
759
760
761