Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / libs / n2sram / dp / n2_l2t_dp_32x160_cust_l / n2_l2t_dp_32x160_cust / rtl / n2_l2t_dp_32x160_cust.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: n2_l2t_dp_32x160_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_l2t_dp_32x160_cust (
36 din,
37 rd_adr1,
38 rd_adr2,
39 sel_rdaddr1,
40 wr_adr,
41 read_en,
42 wr_en,
43 word_wen,
44 tcu_array_wr_inhibit,
45 l2clk,
46 scan_in,
47 tcu_se_scancollar_in,
48 tcu_pce_ov,
49 pce,
50 tcu_aclk,
51 tcu_bclk,
52 tcu_scan_en,
53 dout,
54 scan_out);
55wire siclk;
56wire soclk;
57wire stop;
58wire pce_ov;
59wire l1clk;
60wire ff_wdata_0_scanin;
61wire ff_wdata_0_scanout;
62wire [159:0] wrdata_d1;
63wire ff_wdata_1_scanin;
64wire ff_wdata_1_scanout;
65wire ff_wr_en_scanin;
66wire ff_wr_en_scanout;
67wire wr_en_d1;
68wire ff_wr_adr_scanin;
69wire ff_wr_adr_scanout;
70wire [4:0] wrptr_d1;
71wire ff_read_enable_scanin;
72wire ff_read_enable_scanout;
73wire ff_read_enable0_unused;
74wire ff_read_enable1_unused;
75wire ff_read_enable2_unused;
76wire ren_d1;
77wire ff_word_wen_scanin;
78wire ff_word_wen_scanout;
79wire [3:0] word_wen_d1;
80wire sel_rdaddr1_n;
81wire ff_read_addr_scanin;
82wire ff_read_addr_scanout;
83wire [4:0] rdptr_d1;
84wire [4:0] ff_read_addr_mq_l_unused;
85wire [4:0] ff_read_addr_q_unused;
86wire [4:0] ff_read_addr_q_l_unused;
87
88
89input [159:0] din; // data input
90input [4:0] rd_adr1; // read addr1
91input [4:0] rd_adr2; // read addr2
92input sel_rdaddr1; // sel read addr1
93input [4:0] wr_adr; // write addr
94input read_en;
95input wr_en ; // used in conjunction with
96 // word_wen and byte_wen
97input [3:0] word_wen; // word enables ( if you don't use these
98 // tie them to Vdd )
99input tcu_array_wr_inhibit; // used to gate off write during scan.
100input l2clk;
101input scan_in;
102input tcu_se_scancollar_in; // hold scan in data.
103input tcu_pce_ov;
104input pce;
105input tcu_aclk;
106input tcu_bclk;
107input tcu_scan_en;
108
109output [159:0] dout;
110output scan_out;
111
112// JDL 05/17/07
113// synopsys translate_off
114
115wire [4:0] rd_adr_mux_out;
116wire and_clk;
117
118
119// scan chain connections ////
120assign siclk = tcu_aclk;
121assign soclk = tcu_bclk;
122assign stop = 1'b0;
123assign pce_ov = tcu_pce_ov;
124
125//// Input Flops /////
126
127n2_l2t_dp_32x160_cust_l1clkhdr_ctl_macro clkgen_andclk
128 (
129 .l2clk (l2clk ),
130 .l1en (pce ),
131 .pce_ov (pce_ov ),
132 .stop (stop ),
133 .se (tcu_scan_en),
134 .l1clk (and_clk )
135 );
136
137n2_l2t_dp_32x160_cust_l1clkhdr_ctl_macro clkgen_clk_en
138 (
139 .l2clk (l2clk ),
140 .l1en (pce ),
141 .pce_ov (pce_ov ),
142 .stop (stop ),
143 .se (tcu_se_scancollar_in),
144 .l1clk (l1clk )
145 );
146
147n2_l2t_dp_32x160_cust_msff_ctl_macro__scanreverse_1__width_80 ff_wdata_0
148 (
149 .scan_in(ff_wdata_0_scanin),
150 .scan_out(ff_wdata_0_scanout),
151 .l1clk(l1clk),
152 .din(din[79:0]),
153 .dout(wrdata_d1[79:0]),
154 .siclk(siclk),
155 .soclk(soclk)
156 );
157
158n2_l2t_dp_32x160_cust_msff_ctl_macro__scanreverse_1__width_80 ff_wdata_1
159 (
160 .scan_in(ff_wdata_1_scanin),
161 .scan_out(ff_wdata_1_scanout),
162 .l1clk(l1clk),
163 .din(din[159:80]),
164 .dout(wrdata_d1[159:80]),
165 .siclk(siclk),
166 .soclk(soclk)
167 );
168
169n2_l2t_dp_32x160_cust_msff_ctl_macro__width_1 ff_wr_en (
170 .scan_in(ff_wr_en_scanin),
171 .scan_out(ff_wr_en_scanout),
172 .l1clk(l1clk),
173 .din(wr_en),
174 .dout(wr_en_d1),
175 .siclk(siclk),
176 .soclk(soclk)
177 );
178
179
180n2_l2t_dp_32x160_cust_msff_ctl_macro__scanreverse_1__width_5 ff_wr_adr (
181 .scan_in(ff_wr_adr_scanin),
182 .scan_out(ff_wr_adr_scanout),
183 .l1clk(l1clk),
184 .din(wr_adr[4:0]),
185 .dout(wrptr_d1[4:0]),
186 .siclk(siclk),
187 .soclk(soclk)
188 );
189
190n2_l2t_dp_32x160_cust_sram_msff_mo_macro__width_1 ff_read_enable
191 (
192 .scan_in(ff_read_enable_scanin),
193 .scan_out(ff_read_enable_scanout),
194 .l1clk(l1clk),
195 .and_clk(and_clk),
196 .d(read_en),
197 .q(ff_read_enable0_unused),
198 .q_l(ff_read_enable1_unused),
199 .mq_l(ff_read_enable2_unused),
200 .mq(ren_d1),
201 .siclk(siclk),
202 .soclk(soclk)
203 );
204
205n2_l2t_dp_32x160_cust_msff_ctl_macro__scanreverse_1__width_4 ff_word_wen
206 (
207 .scan_in(ff_word_wen_scanin),
208 .scan_out(ff_word_wen_scanout),
209 .l1clk(l1clk),
210 .din(word_wen[3:0]),
211 .dout(word_wen_d1[3:0]),
212 .siclk(siclk),
213 .soclk(soclk)
214 );
215
216n2_l2t_dp_32x160_cust_inv_macro__width_1 sel_rdaddr1_inv
217 (
218 .din(sel_rdaddr1),
219 .dout(sel_rdaddr1_n)
220 );
221
222n2_l2t_dp_32x160_cust_mux_macro__mux_aonpe__ports_2__width_5 mux_rd_addr
223 (
224 .dout (rd_adr_mux_out[4:0]),
225 .din0 (rd_adr1[4:0]),
226 .sel0 (sel_rdaddr1),
227 .din1 (rd_adr2[4:0]),
228 .sel1 (sel_rdaddr1_n)
229 ) ;
230
231n2_l2t_dp_32x160_cust_sram_msff_mo_macro__scanreverse_1__width_5 ff_read_addr
232 (
233 .scan_in(ff_read_addr_scanin),
234 .scan_out(ff_read_addr_scanout),
235 .l1clk(l1clk),
236 .and_clk(and_clk),
237 .d(rd_adr_mux_out[4:0]),
238 .mq(rdptr_d1[4:0]),
239 .mq_l(ff_read_addr_mq_l_unused[4:0]),
240 .q(ff_read_addr_q_unused[4:0]),
241 .q_l(ff_read_addr_q_l_unused[4:0]),
242 .siclk(siclk),
243 .soclk(soclk)
244 );
245
246
247 /// Memory array ////
248
249
250n2_l2t_dp_32x160_cust_array array (
251 .l1clk (and_clk),
252 .wr_en (wr_en_d1),
253 .rd_en (ren_d1),
254 .wr_addr(wrptr_d1[4:0]),
255 .rd_addr(rdptr_d1[4:0]),
256 .din(wrdata_d1[159:0]),
257 .dout(dout[159:0]),
258 .tcu_array_wr_inhibit(tcu_array_wr_inhibit),
259 .word_wen(word_wen_d1[3:0])
260 );
261
262// fixscan start:
263assign ff_wdata_0_scanin = scan_in ;
264assign ff_word_wen_scanin = ff_wdata_0_scanout ;
265assign ff_wr_en_scanin = ff_word_wen_scanout ;
266assign ff_wr_adr_scanin = ff_wr_en_scanout ;
267assign ff_read_addr_scanin = ff_wr_adr_scanout ;
268assign ff_read_enable_scanin = ff_read_addr_scanout ;
269assign ff_wdata_1_scanin = ff_read_enable_scanout ;
270assign scan_out = ff_wdata_1_scanout ;
271
272// fixscan end:
273
274// JDL 05/17/07
275// synopsys translate_on
276
277endmodule
278
279
280module n2_l2t_dp_32x160_cust_array (
281 l1clk,
282 wr_en,
283 rd_en,
284 tcu_array_wr_inhibit,
285 word_wen,
286 wr_addr,
287 rd_addr,
288 din,
289 dout);
290wire write_disable;
291
292
293input l1clk;
294input wr_en;
295input rd_en;
296input tcu_array_wr_inhibit;
297input [3:0] word_wen;
298input [4:0] wr_addr;
299input [4:0] rd_addr;
300input [159:0] din;
301output [159:0] dout;
302
303
304assign write_disable = tcu_array_wr_inhibit;
305//assign read_disable = tcu_array_wr_inhibit;
306
307
308
309
310
311
312
313
314
315
316
317
318// local signals
319reg [159:0] dout;
320// memory array
321reg [159:0] inq_ary [31:0];
322
323// internal variable
324
325integer rd_i;
326integer wr_i;
327
328reg [159:0] temp, tmp_dout;
329reg [159:0] data_in;
330
331
332
333`ifndef NOINITMEM
334// Emulate reset
335integer j1;
336initial begin
337 for (j1=0; j1<32; j1=j1+1) begin
338 inq_ary [j1] = {160{1'b0}};
339 end
340end
341`endif
342
343
344/////////////////////////////////////////////////////////////////////////////////
345// Read Operation
346/////////////////////////////////////////////////////////////////////////////////
347
348always @(rd_addr or rd_en or tmp_dout or write_disable or word_wen or wr_en or wr_addr or l1clk)
349begin
350 if(l1clk) begin
351
352 if (rd_en & ~write_disable)
353 begin
354 for(rd_i=0; rd_i< 160; rd_i=rd_i+4)
355
356 begin
357 tmp_dout = inq_ary[rd_addr] ;
358
359 if((rd_addr == wr_addr)) begin
360 dout[rd_i] = ( word_wen[0] & wr_en & ~write_disable )?
361 1'bx : tmp_dout[rd_i] ;
362 dout[rd_i+1] = ( word_wen[1] & wr_en & ~write_disable )?
363 1'bx : tmp_dout[rd_i+1] ;
364 dout[rd_i+2] = ( word_wen[2] & wr_en & ~write_disable )?
365 1'bx : tmp_dout[rd_i+2] ;
366 dout[rd_i+3] = ( word_wen[3] & wr_en & ~write_disable )?
367 1'bx : tmp_dout[rd_i+3] ;
368 end
369
370 else begin
371 dout[rd_i] = tmp_dout[rd_i] ;
372 dout[rd_i+1] = tmp_dout[rd_i+1] ;
373 dout[rd_i+2] = tmp_dout[rd_i+2] ;
374 dout[rd_i+3] = tmp_dout[rd_i+3] ;
375 end
376 end // for
377 end // rd_en if
378 else
379 dout = 160'h0;
380 end // l1clk if
381end // always
382
383
384
385
386/////////////////////////////////////////////////////////////////////////////////
387// Write Operation
388/////////////////////////////////////////////////////////////////////////////////
389
390always @(write_disable or word_wen or wr_en or din or wr_addr or temp or l1clk)
391begin
392 if(wr_en & ~write_disable & ~l1clk)
393 begin
394 temp = inq_ary[wr_addr];
395 for (wr_i=0; wr_i<160; wr_i=wr_i+4)
396 begin
397 data_in[wr_i] = ( word_wen[0] & wr_en & ~write_disable ) ?
398 din[wr_i] : temp[wr_i] ;
399 data_in[wr_i+1] = ( word_wen[1] & wr_en & ~write_disable ) ?
400 din[wr_i+1] : temp[wr_i+1] ;
401 data_in[wr_i+2] = ( word_wen[2] & wr_en & ~write_disable ) ?
402 din[wr_i+2] : temp[wr_i+2] ;
403 data_in[wr_i+3] = ( word_wen[3] & wr_en & ~write_disable ) ?
404 din[wr_i+3] : temp[wr_i+3] ;
405 end
406 inq_ary[wr_addr] = data_in ;
407 end
408end // always @ (...
409
410
411
412endmodule // rf_32x160
413
414
415
416
417
418
419
420
421
422// any PARAMS parms go into naming of macro
423
424module n2_l2t_dp_32x160_cust_l1clkhdr_ctl_macro (
425 l2clk,
426 l1en,
427 pce_ov,
428 stop,
429 se,
430 l1clk);
431
432
433 input l2clk;
434 input l1en;
435 input pce_ov;
436 input stop;
437 input se;
438 output l1clk;
439
440
441
442
443
444cl_sc1_l1hdr_8x c_0 (
445
446
447 .l2clk(l2clk),
448 .pce(l1en),
449 .l1clk(l1clk),
450 .se(se),
451 .pce_ov(pce_ov),
452 .stop(stop)
453);
454
455
456
457endmodule
458
459
460
461
462
463
464
465
466
467
468
469
470
471// any PARAMS parms go into naming of macro
472
473module n2_l2t_dp_32x160_cust_msff_ctl_macro__scanreverse_1__width_80 (
474 din,
475 l1clk,
476 scan_in,
477 siclk,
478 soclk,
479 dout,
480 scan_out);
481wire [79:0] fdin;
482wire [0:78] so;
483
484 input [79:0] din;
485 input l1clk;
486 input scan_in;
487
488
489 input siclk;
490 input soclk;
491
492 output [79:0] dout;
493 output scan_out;
494assign fdin[79:0] = din[79:0];
495
496
497
498
499
500
501dff #(80) d0_0 (
502.l1clk(l1clk),
503.siclk(siclk),
504.soclk(soclk),
505.d(fdin[79:0]),
506.si({so[0:78],scan_in}),
507.so({scan_out,so[0:78]}),
508.q(dout[79:0])
509);
510
511
512
513
514
515
516
517
518
519
520
521
522endmodule
523
524
525
526
527
528
529
530
531
532
533
534
535
536// any PARAMS parms go into naming of macro
537
538module n2_l2t_dp_32x160_cust_msff_ctl_macro__width_1 (
539 din,
540 l1clk,
541 scan_in,
542 siclk,
543 soclk,
544 dout,
545 scan_out);
546wire [0:0] fdin;
547
548 input [0:0] din;
549 input l1clk;
550 input scan_in;
551
552
553 input siclk;
554 input soclk;
555
556 output [0:0] dout;
557 output scan_out;
558assign fdin[0:0] = din[0:0];
559
560
561
562
563
564
565dff #(1) d0_0 (
566.l1clk(l1clk),
567.siclk(siclk),
568.soclk(soclk),
569.d(fdin[0:0]),
570.si(scan_in),
571.so(scan_out),
572.q(dout[0:0])
573);
574
575
576
577
578
579
580
581
582
583
584
585
586endmodule
587
588
589
590
591
592
593
594
595
596
597
598
599
600// any PARAMS parms go into naming of macro
601
602module n2_l2t_dp_32x160_cust_msff_ctl_macro__scanreverse_1__width_5 (
603 din,
604 l1clk,
605 scan_in,
606 siclk,
607 soclk,
608 dout,
609 scan_out);
610wire [4:0] fdin;
611wire [0:3] so;
612
613 input [4:0] din;
614 input l1clk;
615 input scan_in;
616
617
618 input siclk;
619 input soclk;
620
621 output [4:0] dout;
622 output scan_out;
623assign fdin[4:0] = din[4:0];
624
625
626
627
628
629
630dff #(5) d0_0 (
631.l1clk(l1clk),
632.siclk(siclk),
633.soclk(soclk),
634.d(fdin[4:0]),
635.si({so[0:3],scan_in}),
636.so({scan_out,so[0:3]}),
637.q(dout[4:0])
638);
639
640
641
642
643
644
645
646
647
648
649
650
651endmodule
652
653
654
655
656
657
658
659
660
661//
662// macro for cl_mc1_sram_msff_mo_{16,8,4}x flops
663//
664//
665
666
667
668
669
670module n2_l2t_dp_32x160_cust_sram_msff_mo_macro__width_1 (
671 d,
672 scan_in,
673 l1clk,
674 and_clk,
675 siclk,
676 soclk,
677 mq,
678 mq_l,
679 scan_out,
680 q,
681 q_l);
682input [0:0] d;
683 input scan_in;
684input l1clk;
685input and_clk;
686input siclk;
687input soclk;
688output [0:0] mq;
689output [0:0] mq_l;
690 output scan_out;
691output [0:0] q;
692output [0:0] q_l;
693
694
695
696
697
698
699new_dlata #(1) d0_0 (
700.d(d[0:0]),
701.si(scan_in),
702.so(scan_out),
703.l1clk(l1clk),
704.and_clk(and_clk),
705.siclk(siclk),
706.soclk(soclk),
707.q(q[0:0]),
708.q_l(q_l[0:0]),
709.mq(mq[0:0]),
710.mq_l(mq_l[0:0])
711);
712
713
714
715
716
717
718
719
720
721
722//place::generic_place($width,$stack,$left);
723
724endmodule
725
726
727
728
729
730
731
732
733
734// any PARAMS parms go into naming of macro
735
736module n2_l2t_dp_32x160_cust_msff_ctl_macro__scanreverse_1__width_4 (
737 din,
738 l1clk,
739 scan_in,
740 siclk,
741 soclk,
742 dout,
743 scan_out);
744wire [3:0] fdin;
745wire [0:2] so;
746
747 input [3:0] din;
748 input l1clk;
749 input scan_in;
750
751
752 input siclk;
753 input soclk;
754
755 output [3:0] dout;
756 output scan_out;
757assign fdin[3:0] = din[3:0];
758
759
760
761
762
763
764dff #(4) d0_0 (
765.l1clk(l1clk),
766.siclk(siclk),
767.soclk(soclk),
768.d(fdin[3:0]),
769.si({so[0:2],scan_in}),
770.so({scan_out,so[0:2]}),
771.q(dout[3:0])
772);
773
774
775
776
777
778
779
780
781
782
783
784
785endmodule
786
787
788
789
790
791
792
793
794
795//
796// invert macro
797//
798//
799
800
801
802
803
804module n2_l2t_dp_32x160_cust_inv_macro__width_1 (
805 din,
806 dout);
807 input [0:0] din;
808 output [0:0] dout;
809
810
811
812
813
814
815inv #(1) d0_0 (
816.in(din[0:0]),
817.out(dout[0:0])
818);
819
820
821
822
823
824
825
826
827
828endmodule
829
830
831
832
833
834// general mux macro for pass-gate and and-or muxes with/wout priority encoders
835// also for pass-gate with decoder
836
837
838
839
840
841// any PARAMS parms go into naming of macro
842
843module n2_l2t_dp_32x160_cust_mux_macro__mux_aonpe__ports_2__width_5 (
844 din0,
845 sel0,
846 din1,
847 sel1,
848 dout);
849wire buffout0;
850wire buffout1;
851
852 input [4:0] din0;
853 input sel0;
854 input [4:0] din1;
855 input sel1;
856 output [4:0] dout;
857
858
859
860
861
862cl_dp1_muxbuff2_8x c0_0 (
863 .in0(sel0),
864 .in1(sel1),
865 .out0(buffout0),
866 .out1(buffout1)
867);
868mux2s #(5) d0_0 (
869 .sel0(buffout0),
870 .sel1(buffout1),
871 .in0(din0[4:0]),
872 .in1(din1[4:0]),
873.dout(dout[4:0])
874);
875
876
877
878
879
880
881
882
883
884
885
886
887
888endmodule
889
890
891//
892// macro for cl_mc1_sram_msff_mo_{16,8,4}x flops
893//
894//
895
896
897
898
899
900module n2_l2t_dp_32x160_cust_sram_msff_mo_macro__scanreverse_1__width_5 (
901 d,
902 scan_in,
903 l1clk,
904 and_clk,
905 siclk,
906 soclk,
907 mq,
908 mq_l,
909 scan_out,
910 q,
911 q_l);
912wire [0:3] so;
913
914input [4:0] d;
915 input scan_in;
916input l1clk;
917input and_clk;
918input siclk;
919input soclk;
920output [4:0] mq;
921output [4:0] mq_l;
922 output scan_out;
923output [4:0] q;
924output [4:0] q_l;
925
926
927
928
929
930
931new_dlata #(5) d0_0 (
932.d(d[4:0]),
933.si({so[0:3],scan_in}),
934.so({scan_out,so[0:3]}),
935.l1clk(l1clk),
936.and_clk(and_clk),
937.siclk(siclk),
938.soclk(soclk),
939.q(q[4:0]),
940.q_l(q_l[4:0]),
941.mq(mq[4:0]),
942.mq_l(mq_l[4:0])
943);
944
945
946
947
948
949
950
951
952
953
954//place::generic_place($width,$stack,$left);
955
956endmodule
957
958
959
960