Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / libs / tisram / core / n2_dta_sp_1920b_cust_l / n2_dta_sp_1920b_cust / rtl / n2_dta_sp_1920b_cust.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: n2_dta_sp_1920b_cust.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 n2_dta_sp_1920b_cust (
36 index0_x,
37 index1_x,
38 index_sel_x,
39 wrway_x,
40 rdreq_x,
41 wrreq_x,
42 wrtag_x,
43 dta_clken,
44 rdtag_w0_y,
45 rdtag_w1_y,
46 rdtag_w2_y,
47 rdtag_w3_y,
48 l2clk,
49 scan_in,
50 tcu_pce_ov,
51 tcu_aclk,
52 tcu_bclk,
53 tcu_se_scancollar_in,
54 tcu_scan_en,
55 tcu_array_wr_inhibit,
56 scan_out);
57wire l1clk_din;
58wire l1clk_in;
59wire l1clk_array;
60wire [6:0] index_x;
61wire dff_inputs1_scanin;
62wire dff_inputs1_scanout;
63wire [1:0] wrway_y;
64wire [6:0] index_y;
65wire [8:0] dff_inputs1_unused;
66wire dff_inputs2_scanin;
67wire dff_inputs2_scanout;
68wire [0:0] index_y_unused;
69wire dff_inputs3_scanin;
70wire dff_inputs3_scanout;
71wire rdreq_b;
72wire wrreq_b;
73wire [1:0] dff_inputs3_unused;
74wire dff_inputs4_scanin;
75wire dff_inputs4_scanout;
76wire rdreq_a;
77wire wrreq_a;
78wire dff_wrtag_scanin;
79wire dff_wrtag_scanout;
80wire [29:0] wrtag_y;
81wire [1:0] wrway_y_;
82wire wr_inhibit_;
83wire wr_inhibit;
84wire [3:0] wr_way;
85
86
87input [6:0] index0_x; // address0 (used for read)
88input [6:0] index1_x; // address1 (used for write)
89input index_sel_x; // selects between index1 and index0
90input [1:0] wrway_x; // way to write to
91input rdreq_x; // read enable
92input wrreq_x; // write enable
93// 0in bits_on -var {rdreq_x,wrreq_x} -max 1 -message "Attempt to read AND write dtag on same cycle"
94// 0in custom -fire ((rdreq_x | wrreq_x) & ~dta_clken) -message "Attempt to read or write with clock disabled"
95input [29:0] wrtag_x; // write data
96input dta_clken; // array clock enable
97
98output [29:0] rdtag_w0_y; // read data split into 4 ports
99output [29:0] rdtag_w1_y; // read data
100output [29:0] rdtag_w2_y; // read data
101output [29:0] rdtag_w3_y; // read data
102
103input l2clk;
104input scan_in;
105input tcu_pce_ov;
106input tcu_aclk;
107input tcu_bclk;
108input tcu_se_scancollar_in;
109input tcu_scan_en;
110input tcu_array_wr_inhibit;
111output scan_out;
112
113`ifndef FPGA
114// synopsys translate_off
115`endif
116
117wire pce_ov = tcu_pce_ov;
118wire stop = 1'b0;
119wire siclk = tcu_aclk ;
120wire soclk = tcu_bclk;
121
122//================================================
123// Clock headers
124//================================================
125
126// This clock gates the wrtag input flops.
127n2_dta_sp_1920b_cust_l1clkhdr_ctl_macro l1ch_din (
128 .l2clk (l2clk),
129 .l1en (dta_clken),
130 .se (tcu_se_scancollar_in),
131 .l1clk (l1clk_din),
132 .pce_ov(pce_ov),
133 .stop(stop)
134);
135
136// This clock gates the other input flops and latches.
137// It will be not be power managed.
138n2_dta_sp_1920b_cust_l1clkhdr_ctl_macro l1ch_in (
139 .l2clk (l2clk),
140 .l1en (1'b1),
141 .se (tcu_se_scancollar_in),
142 .l1clk (l1clk_in),
143 .pce_ov(pce_ov),
144 .stop(stop)
145);
146
147// This clock gates the array and internal logic.
148n2_dta_sp_1920b_cust_l1clkhdr_ctl_macro l1ch_array (
149 .l2clk (l2clk),
150 .l1en (dta_clken),
151 .se (tcu_scan_en),
152 .l1clk (l1clk_array),
153 .pce_ov(pce_ov),
154 .stop(stop)
155);
156
157//=========================================================================================
158// Input flops
159//=========================================================================================
160
161// 2:1 mux on address input
162// address inputs are critical and this mux needs to be merged with the receiving flop.
163assign index_x[6:0] = index_sel_x ? index1_x[6:0] : index0_x[6:0];
164
165n2_dta_sp_1920b_cust_tisram_msff_macro__width_9 dff_inputs1 (
166 .scan_in(dff_inputs1_scanin),
167 .scan_out(dff_inputs1_scanout),
168 .l1clk (l1clk_in),
169 .d ({wrway_x[1:0],
170 index_x[0],
171 index_x[1],
172 index_x[2],
173 index_x[3],
174 index_x[4],
175 index_x[5],
176 index_x[6]
177 }),
178 .latout ({wrway_y[1:0],
179 index_y[0],
180 index_y[1],
181 index_y[2],
182 index_y[3],
183 index_y[4],
184 index_y[5],
185 index_y[6]
186 }),
187 .latout_l(dff_inputs1_unused[8:0]),
188 .siclk(siclk),
189 .soclk(soclk)
190);
191
192n2_dta_sp_1920b_cust_msff_ctl_macro__width_1 dff_inputs2 (
193 .scan_in(dff_inputs2_scanin),
194 .scan_out(dff_inputs2_scanout),
195 .l1clk (l1clk_in),
196 .din (index_x[0]),
197 .dout (index_y_unused[0]),
198 .siclk(siclk),
199 .soclk(soclk)
200);
201
202n2_dta_sp_1920b_cust_tisram_msff_macro__width_2 dff_inputs3 (
203 .scan_in(dff_inputs3_scanin),
204 .scan_out(dff_inputs3_scanout),
205 .l1clk (l1clk_in),
206 .d ({rdreq_x,wrreq_x}),
207 .latout ({rdreq_b,wrreq_b}),
208 .latout_l(dff_inputs3_unused[1:0]),
209 .siclk(siclk),
210 .soclk(soclk)
211);
212
213n2_dta_sp_1920b_cust_msff_ctl_macro__width_2 dff_inputs4 (
214 .scan_in(dff_inputs4_scanin),
215 .scan_out(dff_inputs4_scanout),
216 .l1clk (l1clk_in),
217 .din ({rdreq_x,wrreq_x}),
218 .dout ({rdreq_a,wrreq_a}),
219 .siclk(siclk),
220 .soclk(soclk)
221);
222
223n2_dta_sp_1920b_cust_msff_ctl_macro__width_30 dff_wrtag (
224 .scan_in(dff_wrtag_scanin),
225 .scan_out(dff_wrtag_scanout),
226 .l1clk (l1clk_din),
227 .din ({wrtag_x[0],
228 wrtag_x[1],
229 wrtag_x[2],
230 wrtag_x[3],
231 wrtag_x[4],
232 wrtag_x[5],
233 wrtag_x[6],
234 wrtag_x[7],
235 wrtag_x[8],
236 wrtag_x[9],
237 wrtag_x[10],
238 wrtag_x[11],
239 wrtag_x[12],
240 wrtag_x[13],
241 wrtag_x[14],
242 wrtag_x[15],
243 wrtag_x[16],
244 wrtag_x[17],
245 wrtag_x[18],
246 wrtag_x[19],
247 wrtag_x[20],
248 wrtag_x[21],
249 wrtag_x[22],
250 wrtag_x[23],
251 wrtag_x[24],
252 wrtag_x[25],
253 wrtag_x[26],
254 wrtag_x[27],
255 wrtag_x[28],
256 wrtag_x[29]}),
257 .dout ({wrtag_y[0],
258 wrtag_y[1],
259 wrtag_y[2],
260 wrtag_y[3],
261 wrtag_y[4],
262 wrtag_y[5],
263 wrtag_y[6],
264 wrtag_y[7],
265 wrtag_y[8],
266 wrtag_y[9],
267 wrtag_y[10],
268 wrtag_y[11],
269 wrtag_y[12],
270 wrtag_y[13],
271 wrtag_y[14],
272 wrtag_y[15],
273 wrtag_y[16],
274 wrtag_y[17],
275 wrtag_y[18],
276 wrtag_y[19],
277 wrtag_y[20],
278 wrtag_y[21],
279 wrtag_y[22],
280 wrtag_y[23],
281 wrtag_y[24],
282 wrtag_y[25],
283 wrtag_y[26],
284 wrtag_y[27],
285 wrtag_y[28],
286 wrtag_y[29]}),
287 .siclk(siclk),
288 .soclk(soclk)
289);
290
291// Decode write enables
292n2_dta_sp_1920b_cust_inv_macro__width_3 way_inv (
293 .din ({wrway_y[1:0], tcu_array_wr_inhibit}),
294 .dout ({wrway_y_[1:0],wr_inhibit_})
295);
296
297assign wr_inhibit = tcu_array_wr_inhibit;
298
299n2_dta_sp_1920b_cust_and_macro__ports_4__width_4 way_and (
300 .din0 ({wrreq_b, wrreq_b, wrreq_b, wrreq_b}),
301 .din1 ({wrway_y [0],wrway_y_[0],wrway_y [0],wrway_y_[0]}),
302 .din2 ({wrway_y [1],wrway_y [1],wrway_y_[1],wrway_y_[1]}),
303 .din3 ({4{wr_inhibit_}}),
304 .dout (wr_way[3:0])
305);
306
307n2_dta_sp_1920b_array way0 (
308 .clk (l1clk_array),
309 .wr_en_b (wr_way[0]),
310 .rd_en_b (rdreq_b),
311 .wr_en_a (wrreq_a),
312 .rd_en_a (rdreq_a),
313 .addr (index_y[6:0]),
314 .din (wrtag_y[29:0]),
315 .dout (rdtag_w0_y[29:0]),
316 .wr_inhibit(wr_inhibit)
317);
318n2_dta_sp_1920b_array way1 (
319 .clk (l1clk_array),
320 .wr_en_b (wr_way[1]),
321 .rd_en_b (rdreq_b),
322 .wr_en_a (wrreq_a),
323 .rd_en_a (rdreq_a),
324 .addr (index_y[6:0]),
325 .din (wrtag_y[29:0]),
326 .dout (rdtag_w1_y[29:0]),
327 .wr_inhibit(wr_inhibit)
328);
329n2_dta_sp_1920b_array way2 (
330 .clk (l1clk_array),
331 .wr_en_b (wr_way[2]),
332 .rd_en_b (rdreq_b),
333 .wr_en_a (wrreq_a),
334 .rd_en_a (rdreq_a),
335 .addr (index_y[6:0]),
336 .din (wrtag_y[29:0]),
337 .dout (rdtag_w2_y[29:0]),
338 .wr_inhibit(wr_inhibit)
339);
340n2_dta_sp_1920b_array way3 (
341 .clk (l1clk_array),
342 .wr_en_b (wr_way[3]),
343 .rd_en_b (rdreq_b),
344 .wr_en_a (wrreq_a),
345 .rd_en_a (rdreq_a),
346 .addr (index_y[6:0]),
347 .din (wrtag_y[29:0]),
348 .dout (rdtag_w3_y[29:0]),
349 .wr_inhibit(wr_inhibit)
350);
351
352supply0 vss;
353supply1 vdd;
354// fixscan start:
355assign dff_inputs1_scanin = scan_in ;
356assign dff_inputs2_scanin = dff_inputs1_scanout ;
357assign dff_inputs3_scanin = dff_inputs2_scanout ;
358assign dff_inputs4_scanin = dff_inputs3_scanout ;
359assign dff_wrtag_scanin = dff_inputs4_scanout ;
360assign scan_out = dff_wrtag_scanout ;
361// fixscan end:
362
363`ifndef FPGA
364// synopsys translate_on
365`endif
366
367endmodule
368
369
370
371
372
373
374
375// any PARAMS parms go into naming of macro
376
377module n2_dta_sp_1920b_cust_l1clkhdr_ctl_macro (
378 l2clk,
379 l1en,
380 pce_ov,
381 stop,
382 se,
383 l1clk);
384
385
386 input l2clk;
387 input l1en;
388 input pce_ov;
389 input stop;
390 input se;
391 output l1clk;
392
393
394
395
396
397cl_sc1_l1hdr_8x c_0 (
398
399
400 .l2clk(l2clk),
401 .pce(l1en),
402 .l1clk(l1clk),
403 .se(se),
404 .pce_ov(pce_ov),
405 .stop(stop)
406);
407
408
409
410endmodule
411
412
413
414
415
416
417
418
419
420//
421// macro for cl_mc1_tisram_msff_{16,8}x flops
422//
423//
424
425
426
427
428
429module n2_dta_sp_1920b_cust_tisram_msff_macro__width_9 (
430 d,
431 scan_in,
432 l1clk,
433 siclk,
434 soclk,
435 scan_out,
436 latout,
437 latout_l);
438wire [7:0] so;
439
440input [8:0] d;
441 input scan_in;
442input l1clk;
443input siclk;
444input soclk;
445 output scan_out;
446output [8:0] latout;
447output [8:0] latout_l;
448
449
450
451
452
453
454tisram_msff #(9) d0_0 (
455.d(d[8:0]),
456.si({scan_in,so[7:0]}),
457.so({so[7:0],scan_out}),
458.l1clk(l1clk),
459.siclk(siclk),
460.soclk(soclk),
461.latout(latout[8:0]),
462.latout_l(latout_l[8:0])
463);
464
465
466
467
468
469
470
471
472
473
474
475
476//place::generic_place($width,$stack,$left);
477
478endmodule
479
480
481
482
483
484
485
486
487
488// any PARAMS parms go into naming of macro
489
490module n2_dta_sp_1920b_cust_msff_ctl_macro__width_1 (
491 din,
492 l1clk,
493 scan_in,
494 siclk,
495 soclk,
496 dout,
497 scan_out);
498wire [0:0] fdin;
499
500 input [0:0] din;
501 input l1clk;
502 input scan_in;
503
504
505 input siclk;
506 input soclk;
507
508 output [0:0] dout;
509 output scan_out;
510assign fdin[0:0] = din[0:0];
511
512
513
514
515
516
517dff #(1) d0_0 (
518.l1clk(l1clk),
519.siclk(siclk),
520.soclk(soclk),
521.d(fdin[0:0]),
522.si(scan_in),
523.so(scan_out),
524.q(dout[0: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// macro for cl_mc1_tisram_msff_{16,8}x flops
550//
551//
552
553
554
555
556
557module n2_dta_sp_1920b_cust_tisram_msff_macro__width_2 (
558 d,
559 scan_in,
560 l1clk,
561 siclk,
562 soclk,
563 scan_out,
564 latout,
565 latout_l);
566wire [0:0] so;
567
568input [1:0] d;
569 input scan_in;
570input l1clk;
571input siclk;
572input soclk;
573 output scan_out;
574output [1:0] latout;
575output [1:0] latout_l;
576
577
578
579
580
581
582tisram_msff #(2) d0_0 (
583.d(d[1:0]),
584.si({scan_in,so[0:0]}),
585.so({so[0:0],scan_out}),
586.l1clk(l1clk),
587.siclk(siclk),
588.soclk(soclk),
589.latout(latout[1:0]),
590.latout_l(latout_l[1:0])
591);
592
593
594
595
596
597
598
599
600
601
602
603
604//place::generic_place($width,$stack,$left);
605
606endmodule
607
608
609
610
611
612
613
614
615
616// any PARAMS parms go into naming of macro
617
618module n2_dta_sp_1920b_cust_msff_ctl_macro__width_2 (
619 din,
620 l1clk,
621 scan_in,
622 siclk,
623 soclk,
624 dout,
625 scan_out);
626wire [1:0] fdin;
627wire [0:0] so;
628
629 input [1:0] din;
630 input l1clk;
631 input scan_in;
632
633
634 input siclk;
635 input soclk;
636
637 output [1:0] dout;
638 output scan_out;
639assign fdin[1:0] = din[1:0];
640
641
642
643
644
645
646dff #(2) d0_0 (
647.l1clk(l1clk),
648.siclk(siclk),
649.soclk(soclk),
650.d(fdin[1:0]),
651.si({scan_in,so[0:0]}),
652.so({so[0:0],scan_out}),
653.q(dout[1:0])
654);
655
656
657
658
659
660
661
662
663
664
665
666
667endmodule
668
669
670
671
672
673
674
675
676
677
678
679
680
681// any PARAMS parms go into naming of macro
682
683module n2_dta_sp_1920b_cust_msff_ctl_macro__width_30 (
684 din,
685 l1clk,
686 scan_in,
687 siclk,
688 soclk,
689 dout,
690 scan_out);
691wire [29:0] fdin;
692wire [28:0] so;
693
694 input [29:0] din;
695 input l1clk;
696 input scan_in;
697
698
699 input siclk;
700 input soclk;
701
702 output [29:0] dout;
703 output scan_out;
704assign fdin[29:0] = din[29:0];
705
706
707
708
709
710
711dff #(30) d0_0 (
712.l1clk(l1clk),
713.siclk(siclk),
714.soclk(soclk),
715.d(fdin[29:0]),
716.si({scan_in,so[28:0]}),
717.so({so[28:0],scan_out}),
718.q(dout[29:0])
719);
720
721
722
723
724
725
726
727
728
729
730
731
732endmodule
733
734
735
736
737
738
739
740
741
742//
743// invert macro
744//
745//
746
747
748
749
750
751module n2_dta_sp_1920b_cust_inv_macro__width_3 (
752 din,
753 dout);
754 input [2:0] din;
755 output [2:0] dout;
756
757
758
759
760
761
762inv #(3) d0_0 (
763.in(din[2:0]),
764.out(dout[2:0])
765);
766
767
768
769
770
771
772
773
774
775endmodule
776
777
778
779
780
781//
782// and macro for ports = 2,3,4
783//
784//
785
786
787
788
789
790module n2_dta_sp_1920b_cust_and_macro__ports_4__width_4 (
791 din0,
792 din1,
793 din2,
794 din3,
795 dout);
796 input [3:0] din0;
797 input [3:0] din1;
798 input [3:0] din2;
799 input [3:0] din3;
800 output [3:0] dout;
801
802
803
804
805
806
807and4 #(4) d0_0 (
808.in0(din0[3:0]),
809.in1(din1[3:0]),
810.in2(din2[3:0]),
811.in3(din3[3:0]),
812.out(dout[3:0])
813);
814
815
816
817
818
819
820
821
822
823endmodule
824
825
826
827
828
829
830module n2_dta_sp_1920b_array (
831 clk,
832 rd_en_b,
833 wr_en_b,
834 rd_en_a,
835 wr_en_a,
836 addr,
837 wr_inhibit,
838 din,
839 dout);
840wire rd_en_b_unused;
841
842
843`define WIDTH 30
844`define ENTRIES 128
845`define ADDRBITS 7
846
847input clk;
848input rd_en_b; // comes on negedge
849input wr_en_b; // comes on negedge (way specific)
850input rd_en_a; // comes on posedge
851input wr_en_a; // comes on posedge (not way specific)
852input [`ADDRBITS-1:0] addr; // comes on negedge
853input wr_inhibit; // async
854
855input [`WIDTH-1:0] din; // comes on posedge
856output [`WIDTH-1:0] dout;
857
858
859
860
861
862
863
864
865reg [`WIDTH-1:0] mem[`ENTRIES-1:0];
866reg [`WIDTH-1:0] local_dout;
867
868assign rd_en_b_unused = rd_en_b;
869
870`ifndef NOINITMEM
871// Emulate reset
872integer i;
873initial begin
874 for (i=0; i<`ENTRIES; i=i+1) begin
875 mem[i] = {`WIDTH{1'b0}};
876 end
877 local_dout = {`WIDTH{1'b0}};
878end
879`endif
880
881//////////////////////
882// Read/write array
883//////////////////////
884
885always @(negedge clk) begin
886 if (wr_en_b) begin
887 mem[addr] <= din;
888
889
890
891 end
892end
893
894always @(posedge clk) begin
895 local_dout[`WIDTH-1:0] <= mem[addr];
896end
897
898assign dout[`WIDTH-1:0] = local_dout[`WIDTH-1:0] & {`WIDTH{rd_en_a & ~wr_en_a & ~wr_inhibit}};
899
900supply0 vss;
901supply1 vdd;
902
903
904endmodule
905