Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / ncu / rtl / ncu_c2ibuf32_ctl.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: ncu_c2ibuf32_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 ncu_c2ibuf32_ctl (
36 iol2clk,
37 tcu_scan_en,
38 scan_in,
39 scan_out,
40 tcu_pce_ov,
41 tcu_clk_stop,
42 tcu_aclk,
43 tcu_bclk,
44 tcu_dbr_gateoff,
45 c2i_packet_vld,
46 ucb_sel,
47 ucb_buf_acpt,
48 c2i_packet,
49 iob_ucb_vld,
50 iob_ucb_data,
51 ucb_iob_stall) ;
52wire dbl_buf_wr;
53wire dbl_buf_full;
54wire dbl_buf_rd;
55wire dbl_buf_vld;
56wire outdata_buf_busy;
57wire outdata_buf_wr;
58wire wr_buf0;
59wire buf1_vld;
60wire buf0_vld;
61wire buf1_older;
62wire wr_buf1;
63wire rd_buf0;
64wire rd_buf1;
65wire rd_buf;
66wire buf1_older_n;
67wire buf1_older_ff_scanin;
68wire buf1_older_ff_scanout;
69wire l1clk;
70wire en_vld0;
71wire en_vld1;
72wire buf0_vld_ff_scanin;
73wire buf0_vld_ff_scanout;
74wire buf1_vld_ff_scanin;
75wire buf1_vld_ff_scanout;
76wire buf0_obj_p_ff_scanin;
77wire buf0_obj_p_ff_scanout;
78wire [63:0] buf0_obj_p;
79wire buf0_obj_h_ff_scanin;
80wire buf0_obj_h_ff_scanout;
81wire [54:0] buf0_obj_h;
82wire buf1_obj_p_ff_scanin;
83wire buf1_obj_p_ff_scanout;
84wire [63:0] buf1_obj_p;
85wire buf1_obj_h_ff_scanin;
86wire buf1_obj_h_ff_scanout;
87wire [54:0] buf1_obj_h;
88wire [127:0] outdata_buf_in;
89wire [3:0] outdata_vec;
90wire [127:0] outdata_buf;
91wire rdy0_ff_scanin;
92wire rdy0_ff_scanout;
93wire rdy0;
94wire rdy1_ff_scanin;
95wire rdy1_ff_scanout;
96wire rdy1;
97wire stall_d1_ff_scanin;
98wire stall_d1_ff_scanout;
99wire stall_d1;
100wire load_outdata;
101wire shift_outdata;
102wire [3:0] outdata_vec_next;
103wire outdata_vec_ff_scanin;
104wire outdata_vec_ff_scanout;
105wire [127:0] outdata_buf_next;
106wire outdata_buf_ff_scanin;
107wire outdata_buf_ff_scanout;
108wire siclk;
109wire soclk;
110wire se;
111wire pce_ov;
112wire stop;
113
114
115
116
117////////////////////////////////////////////////////////////////////////
118// Signal declarations
119////////////////////////////////////////////////////////////////////////
120// Global interface
121input iol2clk;
122
123input tcu_scan_en;
124input scan_in;
125output scan_out;
126input tcu_pce_ov;
127input tcu_clk_stop;
128input tcu_aclk;
129input tcu_bclk;
130input tcu_dbr_gateoff;
131
132
133// slow control interface
134input c2i_packet_vld;
135input ucb_sel;
136output ucb_buf_acpt;
137
138
139// slow datapath interface
140input [127:0] c2i_packet;
141
142
143// UCB interface
144output iob_ucb_vld;
145output [31:0] iob_ucb_data;
146input ucb_iob_stall;
147
148
149// Internal signals
150
151
152
153////////////////////////////////////////////////////////////////////////
154// Code starts here
155////////////////////////////////////////////////////////////////////////
156
157assign dbl_buf_wr = c2i_packet_vld & ucb_sel & ~dbl_buf_full;
158assign ucb_buf_acpt = dbl_buf_wr;
159assign dbl_buf_rd = dbl_buf_vld & ~outdata_buf_busy;
160assign outdata_buf_wr = dbl_buf_rd;
161//assign outdata_vec_in = {128/UCB_BUS_WIDTH{1'b1}};
162
163/******************************************************************
164//dbl_buf #(128) dbl_buf (
165// .clk(l2clk),
166// .wr(dbl_buf_wr),
167// .din(c2i_packet[127:0]),
168// .rd(dbl_buf_rd),
169// .dout(outdata_buf_in[127:0]),
170// .vld(dbl_buf_vld),
171// .full(dbl_buf_full));
172******************************************************************/
173assign wr_buf0 = dbl_buf_wr & (buf1_vld | (~buf0_vld & ~buf1_older));
174assign wr_buf1 = dbl_buf_wr & (buf0_vld | (~buf1_vld & buf1_older));
175
176// read from the older entry
177assign rd_buf0 = dbl_buf_rd & ~buf1_older;
178assign rd_buf1 = dbl_buf_rd & buf1_older;
179
180// flip older pointer when an entry is read
181assign rd_buf = dbl_buf_rd & (buf0_vld | buf1_vld);
182assign buf1_older_n = ~buf1_older;
183ncu_c2ibuf32_ctl_msff_ctl_macro__en_1__width_1 buf1_older_ff
184 (
185 .scan_in(buf1_older_ff_scanin),
186 .scan_out(buf1_older_ff_scanout),
187 .dout (buf1_older),
188 .l1clk (l1clk),
189 .en (rd_buf),
190 .din (buf1_older_n),
191 .siclk(siclk),
192 .soclk(soclk)
193 );
194
195// set valid bit for writes and reset for reads
196assign en_vld0 = wr_buf0 | rd_buf0;
197assign en_vld1 = wr_buf1 | rd_buf1;
198
199// the actual buffers
200ncu_c2ibuf32_ctl_msff_ctl_macro__en_1__width_1 buf0_vld_ff
201 (
202 .scan_in(buf0_vld_ff_scanin),
203 .scan_out(buf0_vld_ff_scanout),
204 .dout (buf0_vld),
205 .l1clk (l1clk),
206 .en (en_vld0),
207 .din (wr_buf0),
208 .siclk(siclk),
209 .soclk(soclk)
210 );
211
212ncu_c2ibuf32_ctl_msff_ctl_macro__en_1__width_1 buf1_vld_ff
213 (
214 .scan_in(buf1_vld_ff_scanin),
215 .scan_out(buf1_vld_ff_scanout),
216 .dout (buf1_vld),
217 .l1clk (l1clk),
218 .en (en_vld1),
219 .din (wr_buf1),
220 .siclk(siclk),
221 .soclk(soclk)
222 );
223
224ncu_c2ibuf32_ctl_msff_ctl_macro__en_1__width_64 buf0_obj_p_ff
225 (
226 .scan_in(buf0_obj_p_ff_scanin),
227 .scan_out(buf0_obj_p_ff_scanout),
228 .dout (buf0_obj_p[63:0]),
229 .l1clk (l1clk),
230 .en (wr_buf0),
231 .din (c2i_packet[127:64]),
232 .siclk(siclk),
233 .soclk(soclk)
234 );
235ncu_c2ibuf32_ctl_msff_ctl_macro__en_1__width_55 buf0_obj_h_ff
236 (
237 .scan_in(buf0_obj_h_ff_scanin),
238 .scan_out(buf0_obj_h_ff_scanout),
239 .dout (buf0_obj_h[54:0]),
240 .l1clk (l1clk),
241 .en (wr_buf0),
242 .din (c2i_packet[54:0]),
243 .siclk(siclk),
244 .soclk(soclk)
245 );
246
247ncu_c2ibuf32_ctl_msff_ctl_macro__en_1__width_64 buf1_obj_p_ff
248 (
249 .scan_in(buf1_obj_p_ff_scanin),
250 .scan_out(buf1_obj_p_ff_scanout),
251 .dout (buf1_obj_p[63:0]),
252 .l1clk (l1clk),
253 .en (wr_buf1),
254 .din (c2i_packet[127:64]),
255 .siclk(siclk),
256 .soclk(soclk)
257 );
258ncu_c2ibuf32_ctl_msff_ctl_macro__en_1__width_55 buf1_obj_h_ff
259 (
260 .scan_in(buf1_obj_h_ff_scanin),
261 .scan_out(buf1_obj_h_ff_scanout),
262 .dout (buf1_obj_h[54:0]),
263 .l1clk (l1clk),
264 .en (wr_buf1),
265 .din (c2i_packet[54:0]),
266 .siclk(siclk),
267 .soclk(soclk)
268 );
269
270// mux out the older entry
271//assign outdata_buf_in[127:0] = (buf1_older) ? buf1_obj[127:0] : buf0_obj[127:0] ;
272assign outdata_buf_in[127:0] = (buf1_older) ? {buf1_obj_p[63:0],9'b0,buf1_obj_h[54:0]} :
273 {buf0_obj_p[63:0],9'b0,buf0_obj_h[54:0]} ;
274
275assign dbl_buf_vld = buf0_vld | buf1_vld;
276assign dbl_buf_full = buf0_vld & buf1_vld;
277
278
279
280
281
282
283/*******************************************************************
284//ucb_bus_out #(UCB_BUS_WIDTH) ucb_bus_out (
285// .clk(l2clk),
286// .outdata_buf_wr(outdata_buf_wr),
287// .outdata_buf_in(outdata_buf_in[127:0]),
288// .outdata_vec_in(outdata_vec_in[128/UCB_BUS_WIDTH-1:0]),
289// .outdata_buf_busy(outdata_buf_busy),
290// .vld(iob_ucb_vld),
291// .data(iob_ucb_data[UCB_BUS_WIDTH-1:0]),
292// .stall(ucb_iob_stall));
293*******************************************************************/
294
295assign iob_ucb_vld = outdata_vec[0] & tcu_dbr_gateoff;
296assign iob_ucb_data[31:0] = outdata_buf[31:0];
297
298ncu_c2ibuf32_ctl_msff_ctl_macro__width_1 rdy0_ff
299 (
300 .scan_in(rdy0_ff_scanin),
301 .scan_out(rdy0_ff_scanout),
302 .dout (rdy0),
303 .l1clk (l1clk),
304 .din (1'b1),
305 .siclk(siclk),
306 .soclk(soclk)
307 );
308
309ncu_c2ibuf32_ctl_msff_ctl_macro__width_1 rdy1_ff
310 (
311 .scan_in(rdy1_ff_scanin),
312 .scan_out(rdy1_ff_scanout),
313 .dout (rdy1),
314 .l1clk (l1clk),
315 .din (rdy0),
316 .siclk(siclk),
317 .soclk(soclk)
318 );
319
320ncu_c2ibuf32_ctl_msff_ctl_macro__en_1__width_1 stall_d1_ff
321 (
322 .scan_in(stall_d1_ff_scanin),
323 .scan_out(stall_d1_ff_scanout),
324 .dout (stall_d1),
325 .l1clk (l1clk),
326 .en (rdy1),
327 .din (ucb_iob_stall),
328 .siclk(siclk),
329 .soclk(soclk)
330 );
331
332
333/************************************************************
334 * Outbound Data
335 ************************************************************/
336// accept new data only if there is none being processed
337assign load_outdata = outdata_buf_wr & ~outdata_buf_busy;
338
339assign outdata_buf_busy = outdata_vec[0] | stall_d1;
340
341assign shift_outdata = outdata_vec[0] & ~stall_d1;
342
343assign outdata_vec_next[3:0] =
344 //load_outdata ? outdata_vec_in[3:0] :
345 load_outdata ? 4'b1111 :
346 //shift_outdata ? outdata_vec[128/UCB_BUS_WIDTH-1:0] >> 1 :
347 shift_outdata ? {1'b0,outdata_vec[3:1]} : outdata_vec[3:0] ;
348
349ncu_c2ibuf32_ctl_msff_ctl_macro__width_4 outdata_vec_ff
350 (
351 .scan_in(outdata_vec_ff_scanin),
352 .scan_out(outdata_vec_ff_scanout),
353 .dout (outdata_vec[3:0]),
354 .l1clk (l1clk),
355 .din (outdata_vec_next[3:0]),
356 .siclk(siclk),
357 .soclk(soclk)
358 );
359
360assign outdata_buf_next[127:0] = load_outdata ? outdata_buf_in[127:0] :
361 shift_outdata ? (outdata_buf[127:0] >> 32) :
362 outdata_buf[127:0] ;
363
364ncu_c2ibuf32_ctl_msff_ctl_macro__width_128 outdata_buf_ff
365 (
366 .scan_in(outdata_buf_ff_scanin),
367 .scan_out(outdata_buf_ff_scanout),
368 .dout (outdata_buf[127:0]),
369 .l1clk (l1clk),
370 .din (outdata_buf_next[127:0]),
371 .siclk(siclk),
372 .soclk(soclk)
373 );
374
375
376
377
378
379/**** adding clock header ****/
380ncu_c2ibuf32_ctl_l1clkhdr_ctl_macro clkgen (
381 .l2clk (iol2clk),
382 .l1en (1'b1),
383 .l1clk (l1clk),
384 .pce_ov(pce_ov),
385 .stop(stop),
386 .se(se)
387 );
388
389/*** building tcu port ***/
390assign siclk = tcu_aclk;
391assign soclk = tcu_bclk;
392assign se = tcu_scan_en;
393assign pce_ov = tcu_pce_ov;
394assign stop = tcu_clk_stop;
395
396// fixscan start:
397assign buf1_older_ff_scanin = scan_in ;
398assign buf0_vld_ff_scanin = buf1_older_ff_scanout ;
399assign buf1_vld_ff_scanin = buf0_vld_ff_scanout ;
400assign buf0_obj_p_ff_scanin = buf1_vld_ff_scanout ;
401assign buf0_obj_h_ff_scanin = buf0_obj_p_ff_scanout ;
402assign buf1_obj_p_ff_scanin = buf0_obj_h_ff_scanout ;
403assign buf1_obj_h_ff_scanin = buf1_obj_p_ff_scanout ;
404assign rdy0_ff_scanin = buf1_obj_h_ff_scanout ;
405assign rdy1_ff_scanin = rdy0_ff_scanout ;
406assign stall_d1_ff_scanin = rdy1_ff_scanout ;
407assign outdata_vec_ff_scanin = stall_d1_ff_scanout ;
408assign outdata_buf_ff_scanin = outdata_vec_ff_scanout ;
409assign scan_out = outdata_buf_ff_scanout ;
410// fixscan end:
411endmodule // c2i_buf
412
413
414
415
416
417
418
419// any PARAMS parms go into naming of macro
420
421module ncu_c2ibuf32_ctl_msff_ctl_macro__en_1__width_1 (
422 din,
423 en,
424 l1clk,
425 scan_in,
426 siclk,
427 soclk,
428 dout,
429 scan_out);
430wire [0:0] fdin;
431
432 input [0:0] din;
433 input en;
434 input l1clk;
435 input scan_in;
436
437
438 input siclk;
439 input soclk;
440
441 output [0:0] dout;
442 output scan_out;
443assign fdin[0:0] = (din[0:0] & {1{en}}) | (dout[0:0] & ~{1{en}});
444
445
446
447
448
449
450dff #(1) d0_0 (
451.l1clk(l1clk),
452.siclk(siclk),
453.soclk(soclk),
454.d(fdin[0:0]),
455.si(scan_in),
456.so(scan_out),
457.q(dout[0:0])
458);
459
460
461
462
463
464
465
466
467
468
469
470
471endmodule
472
473
474
475
476
477
478
479
480
481
482
483
484
485// any PARAMS parms go into naming of macro
486
487module ncu_c2ibuf32_ctl_msff_ctl_macro__en_1__width_64 (
488 din,
489 en,
490 l1clk,
491 scan_in,
492 siclk,
493 soclk,
494 dout,
495 scan_out);
496wire [63:0] fdin;
497wire [62:0] so;
498
499 input [63:0] din;
500 input en;
501 input l1clk;
502 input scan_in;
503
504
505 input siclk;
506 input soclk;
507
508 output [63:0] dout;
509 output scan_out;
510assign fdin[63:0] = (din[63:0] & {64{en}}) | (dout[63:0] & ~{64{en}});
511
512
513
514
515
516
517dff #(64) d0_0 (
518.l1clk(l1clk),
519.siclk(siclk),
520.soclk(soclk),
521.d(fdin[63:0]),
522.si({scan_in,so[62:0]}),
523.so({so[62:0],scan_out}),
524.q(dout[63:0])
525);
526
527
528
529
530
531
532
533
534
535
536
537
538endmodule
539
540
541
542
543
544
545
546
547
548
549
550
551
552// any PARAMS parms go into naming of macro
553
554module ncu_c2ibuf32_ctl_msff_ctl_macro__en_1__width_55 (
555 din,
556 en,
557 l1clk,
558 scan_in,
559 siclk,
560 soclk,
561 dout,
562 scan_out);
563wire [54:0] fdin;
564wire [53:0] so;
565
566 input [54:0] din;
567 input en;
568 input l1clk;
569 input scan_in;
570
571
572 input siclk;
573 input soclk;
574
575 output [54:0] dout;
576 output scan_out;
577assign fdin[54:0] = (din[54:0] & {55{en}}) | (dout[54:0] & ~{55{en}});
578
579
580
581
582
583
584dff #(55) d0_0 (
585.l1clk(l1clk),
586.siclk(siclk),
587.soclk(soclk),
588.d(fdin[54:0]),
589.si({scan_in,so[53:0]}),
590.so({so[53:0],scan_out}),
591.q(dout[54:0])
592);
593
594
595
596
597
598
599
600
601
602
603
604
605endmodule
606
607
608
609
610
611
612
613
614
615
616
617
618
619// any PARAMS parms go into naming of macro
620
621module ncu_c2ibuf32_ctl_msff_ctl_macro__width_1 (
622 din,
623 l1clk,
624 scan_in,
625 siclk,
626 soclk,
627 dout,
628 scan_out);
629wire [0:0] fdin;
630
631 input [0:0] din;
632 input l1clk;
633 input scan_in;
634
635
636 input siclk;
637 input soclk;
638
639 output [0:0] dout;
640 output scan_out;
641assign fdin[0:0] = din[0:0];
642
643
644
645
646
647
648dff #(1) d0_0 (
649.l1clk(l1clk),
650.siclk(siclk),
651.soclk(soclk),
652.d(fdin[0:0]),
653.si(scan_in),
654.so(scan_out),
655.q(dout[0:0])
656);
657
658
659
660
661
662
663
664
665
666
667
668
669endmodule
670
671
672
673
674
675
676
677
678
679
680
681
682
683// any PARAMS parms go into naming of macro
684
685module ncu_c2ibuf32_ctl_msff_ctl_macro__width_4 (
686 din,
687 l1clk,
688 scan_in,
689 siclk,
690 soclk,
691 dout,
692 scan_out);
693wire [3:0] fdin;
694wire [2:0] so;
695
696 input [3:0] din;
697 input l1clk;
698 input scan_in;
699
700
701 input siclk;
702 input soclk;
703
704 output [3:0] dout;
705 output scan_out;
706assign fdin[3:0] = din[3:0];
707
708
709
710
711
712
713dff #(4) d0_0 (
714.l1clk(l1clk),
715.siclk(siclk),
716.soclk(soclk),
717.d(fdin[3:0]),
718.si({scan_in,so[2:0]}),
719.so({so[2:0],scan_out}),
720.q(dout[3:0])
721);
722
723
724
725
726
727
728
729
730
731
732
733
734endmodule
735
736
737
738
739
740
741
742
743
744
745
746
747
748// any PARAMS parms go into naming of macro
749
750module ncu_c2ibuf32_ctl_msff_ctl_macro__width_128 (
751 din,
752 l1clk,
753 scan_in,
754 siclk,
755 soclk,
756 dout,
757 scan_out);
758wire [127:0] fdin;
759wire [126:0] so;
760
761 input [127:0] din;
762 input l1clk;
763 input scan_in;
764
765
766 input siclk;
767 input soclk;
768
769 output [127:0] dout;
770 output scan_out;
771assign fdin[127:0] = din[127:0];
772
773
774
775
776
777
778dff #(128) d0_0 (
779.l1clk(l1clk),
780.siclk(siclk),
781.soclk(soclk),
782.d(fdin[127:0]),
783.si({scan_in,so[126:0]}),
784.so({so[126:0],scan_out}),
785.q(dout[127:0])
786);
787
788
789
790
791
792
793
794
795
796
797
798
799endmodule
800
801
802
803
804
805
806
807
808
809
810
811
812
813// any PARAMS parms go into naming of macro
814
815module ncu_c2ibuf32_ctl_l1clkhdr_ctl_macro (
816 l2clk,
817 l1en,
818 pce_ov,
819 stop,
820 se,
821 l1clk);
822
823
824 input l2clk;
825 input l1en;
826 input pce_ov;
827 input stop;
828 input se;
829 output l1clk;
830
831
832
833
834
835cl_sc1_l1hdr_8x c_0 (
836
837
838 .l2clk(l2clk),
839 .pce(l1en),
840 .l1clk(l1clk),
841 .se(se),
842 .pce_ov(pce_ov),
843 .stop(stop)
844);
845
846
847
848endmodule
849
850
851
852
853
854
855
856