source: XOpenSparcT1/trunk/T1-CPU/ifu/sparc_ifu_wseldp.v @ 6

Revision 6, 7.0 KB checked in by pntsvt00, 13 years ago (diff)

versione iniziale opensparc

Line 
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T1 Processor File: sparc_ifu_wseldp.v
4// Copyright (c) 2006 Sun Microsystems, Inc.  All Rights Reserved.
5// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
6//
7// The above named program is free software; you can redistribute it and/or
8// modify it under the terms of the GNU General Public
9// License version 2 as published by the Free Software Foundation.
10//
11// The above named program is distributed in the hope that it will be
12// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14// General Public License for more details.
15//
16// You should have received a copy of the GNU General Public
17// License along with this work; if not, write to the Free Software
18// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19//
20// ========== Copyright Header End ============================================
21//////////////////////////////////////////////////////////////////////
22/*
23//  Module Name: sparc_ifu_wsel
24//  Description:       
25//     Way selects removed from icache and done here
26*/
27
28module sparc_ifu_wseldp (/*AUTOARG*/
29   // Outputs
30   wsel_fdp_fetdata_s1, wsel_fdp_topdata_s1, wsel_mbist_icache_data, 
31   so, 
32   // Inputs
33   rclk, se, si, icd_wsel_fetdata_s1, icd_wsel_topdata_s1, 
34   itlb_wsel_waysel_s1, ifq_erb_asiway_f
35   );
36
37   input          rclk, 
38                  se,
39                  si;
40
41   input  [135:0] icd_wsel_fetdata_s1,
42                  icd_wsel_topdata_s1;
43
44   input [3:0]    itlb_wsel_waysel_s1;
45   input [1:0]    ifq_erb_asiway_f;
46
47   output [33:0]  wsel_fdp_fetdata_s1;
48   output [33:0]  wsel_fdp_topdata_s1;
49
50   output [67:0]  wsel_mbist_icache_data;
51
52   output         so;
53   
54   // local signals
55   wire [3:0]     dec_asiway_s_l,
56                  waysel_buf_s1;
57   wire [1:0]     asiway_s;
58   
59   wire [33:0]    rdc_fetdata_s1,
60                  rdc_topdata_s1,
61                  erb_asidata_s,                 
62                  asi_topdata_s;
63   wire           clk;
64   
65   //
66   // Code begins here
67   //
68   //------------------
69   // Control Portion
70   //------------------
71
72   assign   clk = rclk;
73   
74   // flop and decode waysel
75   dff_s #(2) asiway_reg(.din (ifq_erb_asiway_f),
76                       .q   (asiway_s),
77                       .clk (clk), .se(se), .si(), .so());
78   assign   dec_asiway_s_l[0] = ~(~asiway_s[1] & ~asiway_s[0]);
79   assign   dec_asiway_s_l[1] = ~(~asiway_s[1] &  asiway_s[0]);
80   assign   dec_asiway_s_l[2] = ~( asiway_s[1] & ~asiway_s[0]);
81   assign   dec_asiway_s_l[3] = ~( asiway_s[1] &  asiway_s[0]);
82
83   //--------------------------
84   // Datapath Section
85   //--------------------------
86
87   // buffer wayselect from itlb
88   // align these buffers with the corresponding pins in itlb
89   assign   waysel_buf_s1 = itlb_wsel_waysel_s1;
90
91   // Very Timing Critical Wayselect Muxes
92   // !!Cannot be a one-hot mux!!
93   // use ao2222
94//   bw_u1_ao2222_2x #(34) fetway_mx(.z   (rdc_fetdata_s1[33:0]),
95//                                   .a2  (icd_wsel_fetdata_s1[33:0]),
96//                                   .b2  (icd_wsel_fetdata_s1[67:34]),
97//                                   .c2  (icd_wsel_fetdata_s1[101:68]),
98//                                   .d2  (icd_wsel_fetdata_s1[135:102]),
99//                                   .a1  (waysel_buf_s1[0]),
100//                                   .b1  (waysel_buf_s1[1]),
101//                                   .c1  (waysel_buf_s1[2]),
102//                                   .d1  (waysel_buf_s1[3]));
103
104//   bw_u1_ao2222_2x #(34) topway_mx(.z   (rdc_topdata_s1[33:0]),
105//                                   .a2  (icd_wsel_topdata_s1[33:0]),
106//                                   .b2  (icd_wsel_topdata_s1[67:34]),
107//                                   .c2  (icd_wsel_topdata_s1[101:68]),
108//                                   .d2  (icd_wsel_topdata_s1[135:102]),
109//                                   .a1  (waysel_buf_s1[0]),
110//                                   .b1  (waysel_buf_s1[1]),
111//                                   .c1  (waysel_buf_s1[2]),
112//                                   .d1  (waysel_buf_s1[3]));
113
114   assign rdc_fetdata_s1 = icd_wsel_fetdata_s1[33:0] & {34{waysel_buf_s1[0]}} |
115                         icd_wsel_fetdata_s1[67:34] & {34{waysel_buf_s1[1]}}  |
116                         icd_wsel_fetdata_s1[101:68] & {34{waysel_buf_s1[2]}} |
117                         icd_wsel_fetdata_s1[135:102] & {34{waysel_buf_s1[3]}};
118   
119   assign rdc_topdata_s1 = icd_wsel_topdata_s1[33:0] & {34{waysel_buf_s1[0]}} |
120                         icd_wsel_topdata_s1[67:34] & {34{waysel_buf_s1[1]}}  |
121                         icd_wsel_topdata_s1[101:68] & {34{waysel_buf_s1[2]}} |
122                         icd_wsel_topdata_s1[135:102] & {34{waysel_buf_s1[3]}};
123
124   // buffer and send to fdp
125   assign   wsel_fdp_fetdata_s1 = rdc_fetdata_s1;
126   assign   wsel_fdp_topdata_s1 = rdc_topdata_s1;
127   
128   // mux for asi data, not critical
129   dp_mux4ds #(34) asid_mx(.dout (erb_asidata_s[33:0]),
130                           .in0  (icd_wsel_fetdata_s1[33:0]),
131                           .in1  (icd_wsel_fetdata_s1[67:34]),
132                           .in2  (icd_wsel_fetdata_s1[101:68]),
133                           .in3  (icd_wsel_fetdata_s1[135:102]),
134                           .sel0_l (dec_asiway_s_l[0]),
135                           .sel1_l (dec_asiway_s_l[1]),
136                           .sel2_l (dec_asiway_s_l[2]),
137                           .sel3_l (dec_asiway_s_l[3]));
138
139   dp_mux4ds #(34) asitop_mx(.dout (asi_topdata_s[33:0]),
140                           .in0  (icd_wsel_topdata_s1[33:0]),
141                           .in1  (icd_wsel_topdata_s1[67:34]),
142                           .in2  (icd_wsel_topdata_s1[101:68]),
143                           .in3  (icd_wsel_topdata_s1[135:102]),
144                           .sel0_l (dec_asiway_s_l[0]),
145                           .sel1_l (dec_asiway_s_l[1]),
146                           .sel2_l (dec_asiway_s_l[2]),
147                           .sel3_l (dec_asiway_s_l[3]));
148
149   // buffer before sending to bist/errdp
150   assign wsel_mbist_icache_data = {asi_topdata_s[33:32], 
151                                    erb_asidata_s[33:32], 
152                                    asi_topdata_s[31:0],
153                                    erb_asidata_s[31:0]};
154
155// Everything below can be ignored for physical implementation
156// monitor for waysel -- moved here from itlb
157// Keeping this around for 0-in. cmp level check is in icache_mutex_mon.v
158
159`ifdef DEFINE_0IN
160   always @ (negedge clk)
161     begin
162        if (!((waysel_buf_s1 == 4'b0001) ||
163              (waysel_buf_s1 == 4'b0010) || 
164              (waysel_buf_s1 == 4'b0100) ||
165              (waysel_buf_s1 == 4'b1000) || 
166              (waysel_buf_s1 == 4'b0000)))
167          begin
168             // 0in <fire -message "FATAL ERROR: icache waysel not mutex"
169             //$error("IC_WAYSEL", "FATAL ERROR: icache waysel not mutex %b",
170             //       waysel_buf_s1);
171          end
172     end // always @ (negedge clk)
173`endif
174 
175endmodule // sparc_ifu_wseldp
176
Note: See TracBrowser for help on using the repository browser.