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