1 |
2 |
dmitryr |
// ========== Copyright Header Begin ==========================================
|
2 |
|
|
//
|
3 |
|
|
// OpenSPARC T1 Processor File: spu_wen.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 |
|
|
// Description: this block generates the write enables for
|
24 |
|
|
// various registers in spu.
|
25 |
|
|
// Storage for valid bits also are here.
|
26 |
|
|
*/
|
27 |
|
|
////////////////////////////////////////////////////////////////////////
|
28 |
|
|
|
29 |
|
|
module spu_wen (
|
30 |
|
|
|
31 |
|
|
/*outputs*/
|
32 |
|
|
|
33 |
|
|
spu_wen_maln_wen,
|
34 |
|
|
spu_wen_vld_maln,
|
35 |
|
|
|
36 |
|
|
spu_wen_mast_ack,
|
37 |
|
|
|
38 |
|
|
spu_wen_mald_ack,
|
39 |
|
|
|
40 |
|
|
spu_wen_ldst_pcx_vld,
|
41 |
|
|
|
42 |
|
|
spu_wen_allma_stacks_ok,
|
43 |
|
|
|
44 |
|
|
spu_wen_ma_unc_err_pulse,
|
45 |
|
|
spu_wen_ma_unc_err,
|
46 |
|
|
spu_wen_ma_cor_err,
|
47 |
|
|
|
48 |
|
|
spu_wen_pckt_req,
|
49 |
|
|
|
50 |
|
|
/*inputs*/
|
51 |
|
|
|
52 |
|
|
spu_mald_ldreq,
|
53 |
|
|
spu_mactl_streq,
|
54 |
|
|
|
55 |
|
|
|
56 |
|
|
lsu_spu_vload_rtntyp,
|
57 |
|
|
lsu_spu_vload_vld,
|
58 |
|
|
|
59 |
|
|
lsu_spu_st_ack_tid,
|
60 |
|
|
lsu_spu_st_asop,
|
61 |
|
|
lsu_spu_st_ackvld,
|
62 |
|
|
lsu_spu_ld_ack_tid,
|
63 |
|
|
lsu_spu_ld_asop,
|
64 |
|
|
lsu_spu_ld_ackvld,
|
65 |
|
|
|
66 |
|
|
spu_mald_done,
|
67 |
|
|
spu_mald_rstln,
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
|
71 |
|
|
lsu_spu_strm_ack_cmplt,
|
72 |
|
|
|
73 |
|
|
l2_err,
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
spu_mactl_uncerr_rst,
|
77 |
|
|
|
78 |
|
|
cpuid,
|
79 |
|
|
|
80 |
|
|
se,
|
81 |
|
|
reset,
|
82 |
|
|
rclk);
|
83 |
|
|
|
84 |
|
|
input reset;
|
85 |
|
|
input rclk;
|
86 |
|
|
input se;
|
87 |
|
|
|
88 |
|
|
input [1:0] l2_err;
|
89 |
|
|
|
90 |
|
|
input spu_mald_ldreq;
|
91 |
|
|
input spu_mactl_streq;
|
92 |
|
|
|
93 |
|
|
input [3:0] lsu_spu_vload_rtntyp;
|
94 |
|
|
input lsu_spu_vload_vld;
|
95 |
|
|
|
96 |
|
|
input [1:0] lsu_spu_st_ack_tid;
|
97 |
|
|
input lsu_spu_st_asop;
|
98 |
|
|
input lsu_spu_st_ackvld;
|
99 |
|
|
|
100 |
|
|
input [1:0] lsu_spu_ld_ack_tid;
|
101 |
|
|
input lsu_spu_ld_asop;
|
102 |
|
|
input lsu_spu_ld_ackvld;
|
103 |
|
|
|
104 |
|
|
input spu_mald_done;
|
105 |
|
|
input spu_mald_rstln;
|
106 |
|
|
|
107 |
|
|
|
108 |
|
|
|
109 |
|
|
input [1:0] lsu_spu_strm_ack_cmplt;
|
110 |
|
|
|
111 |
|
|
|
112 |
|
|
input [2:0] cpuid;
|
113 |
|
|
|
114 |
|
|
input spu_mactl_uncerr_rst;
|
115 |
|
|
|
116 |
|
|
// -----------------------------------------------------
|
117 |
|
|
|
118 |
|
|
output spu_wen_mast_ack;
|
119 |
|
|
|
120 |
|
|
output spu_wen_maln_wen;
|
121 |
|
|
output spu_wen_mald_ack;
|
122 |
|
|
output spu_wen_vld_maln;
|
123 |
|
|
|
124 |
|
|
output spu_wen_ldst_pcx_vld;
|
125 |
|
|
|
126 |
|
|
output spu_wen_allma_stacks_ok;
|
127 |
|
|
|
128 |
|
|
output spu_wen_ma_unc_err_pulse;
|
129 |
|
|
output spu_wen_ma_unc_err;
|
130 |
|
|
output spu_wen_ma_cor_err;
|
131 |
|
|
|
132 |
|
|
output [122:104] spu_wen_pckt_req;
|
133 |
|
|
|
134 |
|
|
// -----------------------------------------------------
|
135 |
|
|
// -----------------------------------------------------
|
136 |
|
|
// -----------------------------------------------------
|
137 |
|
|
wire spu_wen_maln_wen_local;
|
138 |
|
|
// -----------------------------------------------------
|
139 |
|
|
// -----------------------------------------------------
|
140 |
|
|
// -----------------------------------------------------
|
141 |
|
|
// -----------------------------------------------------
|
142 |
|
|
// -----------------------------------------------------
|
143 |
|
|
// -----------------------------------------------------
|
144 |
|
|
|
145 |
|
|
wire [1:0] l2_err_q;
|
146 |
|
|
wire spu_wen_maln_wen_local_q;
|
147 |
|
|
|
148 |
|
|
dff_s #(3) l2_err_ff (
|
149 |
|
|
.din({l2_err[1:0], spu_wen_maln_wen_local}) ,
|
150 |
|
|
.q({l2_err_q[1:0], spu_wen_maln_wen_local_q}),
|
151 |
|
|
.clk (rclk), .se(se), .si(), .so());
|
152 |
|
|
|
153 |
|
|
wire spu_wen_ma_unc_err_decode = l2_err_q[1] & spu_wen_maln_wen_local_q;
|
154 |
|
|
|
155 |
|
|
assign spu_wen_ma_unc_err_pulse = spu_wen_ma_unc_err_decode;
|
156 |
|
|
|
157 |
|
|
wire spu_wen_ma_cor_err = ~l2_err_q[1] & l2_err_q[0] & spu_wen_maln_wen_local_q;
|
158 |
|
|
|
159 |
|
|
dffre_s #(1) ma_unc_err_ff (
|
160 |
|
|
.din(1'b1) ,
|
161 |
|
|
.q(spu_wen_ma_unc_err),
|
162 |
|
|
.en(spu_wen_ma_unc_err_decode),
|
163 |
|
|
.rst(reset | spu_mactl_uncerr_rst), .clk (rclk), .se(se), .si(), .so());
|
164 |
|
|
|
165 |
|
|
|
166 |
|
|
// -----------------------------------------------------
|
167 |
|
|
|
168 |
|
|
assign spu_wen_ldst_pcx_vld = spu_mald_ldreq | spu_mactl_streq;
|
169 |
|
|
|
170 |
|
|
wire spu_lsu_load_req = spu_mald_ldreq;
|
171 |
|
|
wire spu_lsu_store_req = spu_mactl_streq;
|
172 |
|
|
// -----------------------------------------------------
|
173 |
|
|
|
174 |
|
|
|
175 |
|
|
wire [1:0] lsu_spu_st_ack_tid_q;
|
176 |
|
|
dff_s #(2) lsu_spu_st_ack_tid_ff (
|
177 |
|
|
.din(lsu_spu_st_ack_tid[1:0]) ,
|
178 |
|
|
.q(lsu_spu_st_ack_tid_q[1:0]),
|
179 |
|
|
.clk (rclk), .se(se), .si(), .so());
|
180 |
|
|
|
181 |
|
|
wire lsu_spu_st_asop_q;
|
182 |
|
|
dff_s #(1) lsu_spu_st_asop_ff (
|
183 |
|
|
.din(lsu_spu_st_asop) ,
|
184 |
|
|
.q(lsu_spu_st_asop_q),
|
185 |
|
|
.clk (rclk), .se(se), .si(), .so());
|
186 |
|
|
|
187 |
|
|
|
188 |
|
|
wire [1:0] lsu_spu_ld_ack_tid_q;
|
189 |
|
|
dff_s #(2) lsu_spu_ld_ack_tid_ff (
|
190 |
|
|
.din(lsu_spu_ld_ack_tid[1:0]) ,
|
191 |
|
|
.q(lsu_spu_ld_ack_tid_q[1:0]),
|
192 |
|
|
.clk (rclk), .se(se), .si(), .so());
|
193 |
|
|
|
194 |
|
|
wire lsu_spu_ld_asop_q;
|
195 |
|
|
dff_s #(1) lsu_spu_ld_asop_ff (
|
196 |
|
|
.din(lsu_spu_ld_asop) ,
|
197 |
|
|
.q(lsu_spu_ld_asop_q),
|
198 |
|
|
.clk (rclk), .se(se), .si(), .so());
|
199 |
|
|
|
200 |
|
|
|
201 |
|
|
|
202 |
|
|
|
203 |
|
|
// -----------------------------------------------------
|
204 |
|
|
// -----------------------------------------------------
|
205 |
|
|
// -----------------------------------------------------
|
206 |
|
|
|
207 |
|
|
//wire spu_wen_tid_bit0 = spu_rrstr_streq_mx2sel[0] | spu_rrld_ldreq_mx2sel;
|
208 |
|
|
//wire spu_wen_tid_bit0 = 1'b0;
|
209 |
|
|
|
210 |
|
|
wire spu_wen_ma_st_req_q;
|
211 |
|
|
dff_s #(1) spu_wen_ma_st_req_ff (
|
212 |
|
|
.din(spu_lsu_store_req) ,
|
213 |
|
|
.q(spu_wen_ma_st_req_q),
|
214 |
|
|
.clk (rclk), .se(se), .si(), .so());
|
215 |
|
|
|
216 |
|
|
// -----------------------------------------------------
|
217 |
|
|
// -----------------------------------------------------
|
218 |
|
|
// -----------------------------------------------------
|
219 |
|
|
// ^^^^^^^^^^ LOAD RETURN FROM L2 ^^^^^^^^^^^^^^
|
220 |
|
|
// -----------------------------------------------------
|
221 |
|
|
|
222 |
|
|
wire load_rtntyp = (lsu_spu_vload_rtntyp[3:0] == 4'b0010);
|
223 |
|
|
|
224 |
|
|
|
225 |
|
|
/*
|
226 |
|
|
wire spu_wen_maln_wen = lsu_spu_vload_vld & ~lsu_spu_vload_bid &
|
227 |
|
|
lsu_spu_vload_asop & load_rtntyp &
|
228 |
|
|
(2'b00 == lsu_spu_vload_data_tid[1:0]);
|
229 |
|
|
*/
|
230 |
|
|
|
231 |
|
|
// wire spu_wen_maln_wen_prequal = lsu_spu_vload_vld & ~lsu_spu_vload_data_tid[0];
|
232 |
|
|
|
233 |
|
|
wire spu_wen_maln_wen = lsu_spu_vload_vld & load_rtntyp ;
|
234 |
|
|
|
235 |
|
|
assign spu_wen_maln_wen_local = spu_wen_maln_wen;
|
236 |
|
|
|
237 |
|
|
|
238 |
|
|
// ------------------------------------------------------------
|
239 |
|
|
// load/store acks from lsu captured in spu.
|
240 |
|
|
// ------------------------------------------------------------
|
241 |
|
|
|
242 |
|
|
|
243 |
|
|
wire spu_wen_mast_ack_prequal = (lsu_spu_st_ack_tid_q[1:0] == 2'b00) & lsu_spu_st_asop_q &
|
244 |
|
|
spu_lsu_store_req;
|
245 |
|
|
|
246 |
|
|
wire spu_wen_mast_ack = lsu_spu_st_ackvld & spu_wen_mast_ack_prequal;
|
247 |
|
|
|
248 |
|
|
|
249 |
|
|
wire spu_wen_mald_ack_prequal = (lsu_spu_ld_ack_tid_q[1:0] == 2'b00) & lsu_spu_ld_asop_q &
|
250 |
|
|
spu_lsu_load_req & ~spu_lsu_store_req;
|
251 |
|
|
|
252 |
|
|
wire spu_wen_mald_ack = lsu_spu_ld_ackvld & spu_wen_mald_ack_prequal;
|
253 |
|
|
|
254 |
|
|
|
255 |
|
|
// =================================================================
|
256 |
|
|
// -----------------------------------------------------------------
|
257 |
|
|
// -----------------------------------------------------------------
|
258 |
|
|
// ***************** MA STUFF **************************************
|
259 |
|
|
|
260 |
|
|
wire spu_wen_ma_reset = reset;
|
261 |
|
|
|
262 |
|
|
// -----------------------------------------------------------------
|
263 |
|
|
|
264 |
|
|
wire reset_vld_maln = spu_wen_ma_reset | spu_mald_rstln | spu_mald_done ;
|
265 |
|
|
|
266 |
|
|
// -----------------------------------------------------------------
|
267 |
|
|
|
268 |
|
|
dffre_s #(1) maln_vld_bit_ff (
|
269 |
|
|
.din(1'b1) ,
|
270 |
|
|
.q(spu_wen_vld_maln),
|
271 |
|
|
.en(spu_wen_maln_wen_local),
|
272 |
|
|
.rst(reset_vld_maln), .clk (rclk), .se(se), .si(), .so());
|
273 |
|
|
|
274 |
|
|
// =================================================================
|
275 |
|
|
// -----------------------------------------------------------------
|
276 |
|
|
|
277 |
|
|
// -----------------------------------------------------------------
|
278 |
|
|
// -----------------------------------------------------------------
|
279 |
|
|
// -----------------------------------------------------------------
|
280 |
|
|
// -----------------------------------------------------------------
|
281 |
|
|
// -----------------------------------------------------------------
|
282 |
|
|
// ^^^^^^^^^^ STORE RETURN FROM L2 ^^^^^^^^^^^^^^
|
283 |
|
|
// -----------------------------------------------------------------
|
284 |
|
|
// -----------------------------------------------------------------
|
285 |
|
|
|
286 |
|
|
wire [1:0] lsu_spu_strm_ack_cmplt_q;
|
287 |
|
|
|
288 |
|
|
dff_s #(2) lsu_spu_strm_ff (
|
289 |
|
|
.din(lsu_spu_strm_ack_cmplt[1:0]) ,
|
290 |
|
|
.q(lsu_spu_strm_ack_cmplt_q[1:0]),
|
291 |
|
|
.clk (rclk), .se(se), .si(), .so());
|
292 |
|
|
|
293 |
|
|
wire lsu_spu_st_ackvld_q;
|
294 |
|
|
dff_s #(1) lsu_spu_st_ackvld_ff (
|
295 |
|
|
.din(lsu_spu_st_ackvld) ,
|
296 |
|
|
.q(lsu_spu_st_ackvld_q),
|
297 |
|
|
.clk (rclk), .se(se), .si(), .so());
|
298 |
|
|
|
299 |
|
|
wire spu_wen_ma_st_req_qq;
|
300 |
|
|
dff_s #(1) spu_wen_ma_st_req_q_ff (
|
301 |
|
|
.din(spu_wen_ma_st_req_q) ,
|
302 |
|
|
.q(spu_wen_ma_st_req_qq),
|
303 |
|
|
.clk (rclk), .se(se), .si(), .so());
|
304 |
|
|
|
305 |
|
|
|
306 |
|
|
wire ma_stack_decr_sel = lsu_spu_strm_ack_cmplt_q[0] | lsu_spu_strm_ack_cmplt_q[1];
|
307 |
|
|
|
308 |
|
|
|
309 |
|
|
wire ma_stack_incr_sel = spu_wen_ma_st_req_qq & lsu_spu_st_ackvld_q;
|
310 |
|
|
|
311 |
|
|
|
312 |
|
|
wire ma_stack_cntr_wen = ma_stack_incr_sel | ma_stack_decr_sel ;
|
313 |
|
|
|
314 |
|
|
|
315 |
|
|
// -----------------------------------------------------------------
|
316 |
|
|
// -----------------------------------------------------------------
|
317 |
|
|
// ^^^^^^^^^^ STORE ACK COUNTERS ^^^^^^^^^^^^
|
318 |
|
|
// -----------------------------------------------------------------
|
319 |
|
|
// -----------------------------------------------------------------
|
320 |
|
|
wire [5:0] ma_stack_cntr_q, ma_stack_incrdecr_val;
|
321 |
|
|
|
322 |
|
|
|
323 |
|
|
// -----------------------------------------------------------------
|
324 |
|
|
// -----------------------------------------------------------------
|
325 |
|
|
// ^^^^^^ MA ST_ACK ^^^^^^^^
|
326 |
|
|
// -----------------------------------------------------------------
|
327 |
|
|
/*
|
328 |
|
|
assign ma_stack_incr_val[5:0] = ma_stack_cntr_q[5:0] + 6'b000001;
|
329 |
|
|
assign ma_stack_decr_val[5:0] = ma_stack_cntr_q[5:0] - 6'b000001;
|
330 |
|
|
|
331 |
|
|
assign ma_stack_incrdecr_val[5:0] = ma_stack_incr_sel ? ma_stack_incr_val[5:0] :
|
332 |
|
|
ma_stack_decr_val[5:0];
|
333 |
|
|
*/
|
334 |
|
|
|
335 |
|
|
assign ma_stack_incrdecr_val[5:0] = ma_stack_cntr_q[5:0] + {5'b00000,ma_stack_incr_sel} -
|
336 |
|
|
{4'b0000,lsu_spu_strm_ack_cmplt_q[1:0]};
|
337 |
|
|
|
338 |
|
|
dffre_s #(6) ma_stack_cntr_ff (
|
339 |
|
|
.din(ma_stack_incrdecr_val[5:0]) ,
|
340 |
|
|
.q(ma_stack_cntr_q[5:0]),
|
341 |
|
|
.en(ma_stack_cntr_wen),
|
342 |
|
|
.rst(reset), .clk (rclk), .se(se), .si(), .so());
|
343 |
|
|
|
344 |
|
|
|
345 |
|
|
assign spu_wen_allma_stacks_ok = ~(|ma_stack_cntr_q[5:0]) ;
|
346 |
|
|
|
347 |
|
|
|
348 |
|
|
// -----------------------------------------------------------------
|
349 |
|
|
// -----------------------------------------------------------------
|
350 |
|
|
|
351 |
|
|
dp_mux2es #(19) ldstreq_misc_mx (
|
352 |
|
|
.in0 ({6'b001001,cpuid[2:0],1'b0,1'b0,8'b00000100}),
|
353 |
|
|
.in1 ({6'b001011,cpuid[2:0],1'b0,1'b0,8'b00010000}),
|
354 |
|
|
.sel (spu_lsu_store_req),
|
355 |
|
|
.dout (spu_wen_pckt_req[122:104]));
|
356 |
|
|
|
357 |
|
|
|
358 |
|
|
endmodule
|
359 |
|
|
|