1 |
95 |
fafa1971 |
// ========== Copyright Header Begin ==========================================
|
2 |
|
|
//
|
3 |
|
|
// OpenSPARC T1 Processor File: lsu_excpctl.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 |
113 |
albert.wat |
`ifdef SIMPLY_RISC_TWEAKS
|
22 |
|
|
`define SIMPLY_RISC_SCANIN .si(0)
|
23 |
|
|
`else
|
24 |
|
|
`define SIMPLY_RISC_SCANIN .si()
|
25 |
|
|
`endif
|
26 |
95 |
fafa1971 |
/////////////////////////////////////////////////////////////////
|
27 |
|
|
|
28 |
113 |
albert.wat |
`include "sys.h"
|
29 |
|
|
`include "lsu.h"
|
30 |
95 |
fafa1971 |
|
31 |
|
|
module lsu_excpctl ( /*AUTOARG*/
|
32 |
|
|
// Outputs
|
33 |
|
|
so, lsu_exu_st_dtlb_perr_g, lsu_ffu_st_dtlb_perr_g,
|
34 |
|
|
lsu_defr_trp_taken_g, lsu_tlu_defr_trp_taken_g,
|
35 |
|
|
lsu_mmu_defr_trp_taken_g, lsu_st_dtlb_perr_g,
|
36 |
|
|
lsu_dmmu_sfsr_trp_wr, lsu_dsfsr_din_g, lsu_tlb_perr_ld_rq_kill_w,
|
37 |
|
|
lsu_spu_early_flush_g, lsu_local_early_flush_g,
|
38 |
|
|
lsu_tlu_early_flush_w, lsu_tlu_early_flush2_w, lsu_ttype_vld_m2,
|
39 |
|
|
lsu_ttype_vld_m2_bf1, lsu_ifu_flush_pipe_w, lsu_exu_flush_pipe_w,
|
40 |
|
|
lsu_mmu_flush_pipe_w, lsu_ffu_flush_pipe_w, lsu_tlu_wtchpt_trp_g,
|
41 |
|
|
lsu_tlu_dmmu_miss_g, lsu_tlu_misalign_addr_ldst_atm_m,
|
42 |
|
|
lsu_tlu_daccess_excptn_g, lsu_tlu_daccess_prot_g,
|
43 |
|
|
lsu_tlu_priv_action_g, lsu_ifu_tlb_data_su, lsu_ifu_tlb_data_ue,
|
44 |
|
|
lsu_ifu_tlb_tag_ue, lsu_tlu_ttype_m2, lsu_tlu_ttype_vld_m2,
|
45 |
|
|
stb_cam_sqsh_msk, stb_cam_hit_bf, stb_cam_hit_bf1,
|
46 |
|
|
tte_data_perror_unc, asi_tte_data_perror, asi_tte_tag_perror,
|
47 |
|
|
// Inputs
|
48 |
|
|
rclk, si, se, grst_l, arst_l, tlb_rd_tte_data_ebit,
|
49 |
|
|
tlb_rd_tte_data_pbit, tlb_rd_tte_data_nfobit,
|
50 |
|
|
tlb_rd_tte_data_wbit, tlb_cam_hit, tlb_pgnum_b39,
|
51 |
|
|
lsu_ldst_va_b39_m, lsu_sun4r_va_m_l, lsu_sun4r_pgsz_b2t0_e,
|
52 |
|
|
lsu_sun4v_pgsz_b2t0_e, tlu_early_flush_pipe_w, ifu_lsu_flush_w,
|
53 |
|
|
ifu_lsu_nceen, lsu_tlb_asi_data_perr_g, lsu_tlb_asi_tag_perr_g,
|
54 |
|
|
stb_state_vld0, stb_state_vld1, stb_state_vld2, stb_state_vld3,
|
55 |
|
|
ifu_tlu_thrid_e, tlu_lsu_priv_trap_m, tlu_lsu_pstate_priv,
|
56 |
|
|
st_inst_vld_e, ld_inst_vld_e, ifu_lsu_alt_space_e, lsu_ldst_va_m,
|
57 |
|
|
hpv_priv_m, hpstate_en_m, stb_cam_hit, dtlb_bypass_m,
|
58 |
|
|
lsu_alt_space_m, atomic_m, ldst_dbl_m, fp_ldst_m, lda_internal_m,
|
59 |
|
|
sta_internal_m, cam_real_m, data_rd_vld_g, tag_rd_vld_g,
|
60 |
|
|
ldst_sz_m, asi_internal_m, rd_only_ltlb_asi_e, wr_only_ltlb_asi_e,
|
61 |
|
|
dfill_tlb_asi_e, ifill_tlb_asi_e, nofault_asi_m, as_if_user_asi_m,
|
62 |
|
|
atomic_asi_m, phy_use_ec_asi_m, phy_byp_ec_asi_m, quad_asi_m,
|
63 |
|
|
binit_quad_asi_m, blk_asi_m, recognized_asi_m, strm_asi_m,
|
64 |
|
|
mmu_rd_only_asi_m, rd_only_asi_m, wr_only_asi_m, unimp_asi_m,
|
65 |
|
|
lsu_nonalt_nucl_access_m, va_wtchpt_cmp_en_m,
|
66 |
|
|
lsu_va_match_b47_b32_m, lsu_va_match_b31_b3_m,
|
67 |
|
|
va_wtchpt_msk_match_m, ifu_tlu_inst_vld_m,
|
68 |
|
|
exu_tlu_misalign_addr_jmpl_rtn_m, exu_tlu_va_oor_m,
|
69 |
|
|
tlu_dsfsr_flt_vld, tlu_lsu_pstate_cle, tlu_lsu_pstate_am,
|
70 |
|
|
lsu_excpctl_asi_state_m, lsu_tlu_nonalt_ldst_m,
|
71 |
|
|
lsu_squash_va_oor_m, lsu_tlu_xslating_ldst_m, lsu_tlu_ctxt_sel_m,
|
72 |
|
|
lsu_tlu_write_op_m, lsu_memref_m, lsu_flsh_inst_m,
|
73 |
|
|
tte_data_parity_error, tte_tag_parity_error
|
74 |
|
|
);
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
input rclk;
|
78 |
|
|
input si;
|
79 |
|
|
input se;
|
80 |
|
|
input grst_l;
|
81 |
|
|
input arst_l;
|
82 |
|
|
output so;
|
83 |
|
|
|
84 |
|
|
//=================================================================
|
85 |
|
|
// input from tlb
|
86 |
|
|
// input [`STLB_DATA_NFO:`STLB_DATA_W] tlb_rd_tte_data ; // tte data from tlb
|
87 |
|
|
input tlb_rd_tte_data_ebit;
|
88 |
|
|
input tlb_rd_tte_data_pbit;
|
89 |
|
|
input tlb_rd_tte_data_nfobit;
|
90 |
|
|
input tlb_rd_tte_data_wbit;
|
91 |
|
|
|
92 |
|
|
|
93 |
|
|
input tlb_cam_hit;
|
94 |
|
|
input tlb_pgnum_b39;
|
95 |
|
|
// input tlb_rd_tte_data_locked ; // lock bit from tte
|
96 |
|
|
//=================================================================
|
97 |
|
|
|
98 |
|
|
input lsu_ldst_va_b39_m ;
|
99 |
|
|
input lsu_sun4r_va_m_l ;
|
100 |
|
|
input [2:0] lsu_sun4r_pgsz_b2t0_e ;
|
101 |
|
|
input [2:0] lsu_sun4v_pgsz_b2t0_e ;
|
102 |
|
|
|
103 |
|
|
input tlu_early_flush_pipe_w;
|
104 |
|
|
input ifu_lsu_flush_w;
|
105 |
|
|
input [3:0] ifu_lsu_nceen ; // uncorrectible error enable
|
106 |
|
|
|
107 |
|
|
input lsu_tlb_asi_data_perr_g ;
|
108 |
|
|
input lsu_tlb_asi_tag_perr_g ;
|
109 |
|
|
|
110 |
|
|
input [7:0] stb_state_vld0 ; // valid bits - stb0
|
111 |
|
|
input [7:0] stb_state_vld1 ; // valid bits - stb1
|
112 |
|
|
input [7:0] stb_state_vld2 ; // valid bits - stb2
|
113 |
|
|
input [7:0] stb_state_vld3 ; // valid bits - stb3
|
114 |
|
|
|
115 |
|
|
input [1:0] ifu_tlu_thrid_e ; // thread-id.
|
116 |
|
|
|
117 |
|
|
input tlu_lsu_priv_trap_m ; // daccess-excp in tlu
|
118 |
|
|
|
119 |
|
|
output lsu_exu_st_dtlb_perr_g ;
|
120 |
|
|
output lsu_ffu_st_dtlb_perr_g ;
|
121 |
|
|
|
122 |
|
|
output lsu_defr_trp_taken_g ;
|
123 |
|
|
output lsu_tlu_defr_trp_taken_g ;
|
124 |
|
|
output lsu_mmu_defr_trp_taken_g ;
|
125 |
|
|
|
126 |
|
|
output [3:0] lsu_st_dtlb_perr_g ;
|
127 |
|
|
|
128 |
|
|
output [3:0] lsu_dmmu_sfsr_trp_wr; // sfsr wr based on trap.
|
129 |
|
|
output [23:0] lsu_dsfsr_din_g;
|
130 |
|
|
|
131 |
|
|
|
132 |
|
|
output lsu_tlb_perr_ld_rq_kill_w ;
|
133 |
|
|
output lsu_spu_early_flush_g;
|
134 |
|
|
output lsu_local_early_flush_g; //to lsu
|
135 |
|
|
|
136 |
|
|
// output lsu_dctl_early_flush_w;
|
137 |
|
|
output lsu_tlu_early_flush_w;
|
138 |
|
|
output lsu_tlu_early_flush2_w;
|
139 |
|
|
|
140 |
|
|
output lsu_ttype_vld_m2;
|
141 |
|
|
output lsu_ttype_vld_m2_bf1;
|
142 |
|
|
|
143 |
|
|
|
144 |
|
|
// output lsu_stbctl_flush_pipe_w ;
|
145 |
|
|
// output lsu_stbrwctl_flush_pipe_w ;
|
146 |
|
|
//output lsu_flush_pipe_w;
|
147 |
|
|
output lsu_ifu_flush_pipe_w;
|
148 |
|
|
output lsu_exu_flush_pipe_w;
|
149 |
|
|
output lsu_mmu_flush_pipe_w;
|
150 |
|
|
output lsu_ffu_flush_pipe_w;
|
151 |
|
|
|
152 |
|
|
output lsu_tlu_wtchpt_trp_g ; // watchpt trap has occurred.
|
153 |
|
|
output lsu_tlu_dmmu_miss_g;
|
154 |
|
|
output lsu_tlu_misalign_addr_ldst_atm_m ; // mem_addr unaligned
|
155 |
|
|
// output lsu_tlu_priv_violtn_g;
|
156 |
|
|
wire lsu_tlu_priv_violtn_g;
|
157 |
|
|
output lsu_tlu_daccess_excptn_g;
|
158 |
|
|
output lsu_tlu_daccess_prot_g;
|
159 |
|
|
output lsu_tlu_priv_action_g;
|
160 |
|
|
// output lsu_tlu_tte_ebit_g;
|
161 |
|
|
// output lsu_tlu_spec_access_epage_g;
|
162 |
|
|
// output lsu_tlu_uncache_atomic_g;
|
163 |
|
|
// output lsu_tlu_illegal_asi_action_g;
|
164 |
|
|
// output lsu_tlu_flt_ld_nfo_pg_g;
|
165 |
|
|
|
166 |
|
|
//output lsu_tlu_asi_rd_unc;
|
167 |
|
|
|
168 |
|
|
output lsu_ifu_tlb_data_su ; // specific to st ue
|
169 |
|
|
output lsu_ifu_tlb_data_ue ; // dtlb data asi rd parity error ; now ld ue
|
170 |
|
|
output lsu_ifu_tlb_tag_ue ; // dtlb tag asi rd parity error
|
171 |
|
|
|
172 |
|
|
output [8:0] lsu_tlu_ttype_m2;
|
173 |
|
|
output lsu_tlu_ttype_vld_m2;
|
174 |
|
|
|
175 |
|
|
output [7:0] stb_cam_sqsh_msk ; // squash spurious hits
|
176 |
|
|
|
177 |
|
|
output stb_cam_hit_bf; // buffered stb_cam_hit for qctl1.
|
178 |
|
|
output stb_cam_hit_bf1; // buffered stb_cam_hit for stb_rwctl, dctl.
|
179 |
|
|
|
180 |
|
|
input [3:0] tlu_lsu_pstate_priv ;
|
181 |
|
|
// input [3:0] tlu_lsu_hpv_priv;
|
182 |
|
|
// input [3:0] tlu_lsu_hpstate_en;
|
183 |
|
|
|
184 |
|
|
|
185 |
|
|
input st_inst_vld_e;
|
186 |
|
|
input ld_inst_vld_e;
|
187 |
|
|
input ifu_lsu_alt_space_e; // alternate space ld/st
|
188 |
|
|
|
189 |
|
|
//interface between lsu_dctldp
|
190 |
|
|
input [7:0] lsu_ldst_va_m;
|
191 |
|
|
|
192 |
|
|
//interface between lsu_excpctl and lsu_dctl
|
193 |
|
|
|
194 |
|
|
output tte_data_perror_unc;
|
195 |
|
|
//output tte_data_perror_corr;
|
196 |
|
|
output asi_tte_data_perror ;
|
197 |
|
|
output asi_tte_tag_perror ;
|
198 |
|
|
|
199 |
|
|
|
200 |
|
|
input hpv_priv_m;
|
201 |
|
|
input hpstate_en_m;
|
202 |
|
|
|
203 |
|
|
input stb_cam_hit ;
|
204 |
|
|
|
205 |
|
|
input dtlb_bypass_m;
|
206 |
|
|
|
207 |
|
|
input lsu_alt_space_m;
|
208 |
|
|
input atomic_m;
|
209 |
|
|
// input atomic_g;
|
210 |
|
|
input ldst_dbl_m;
|
211 |
|
|
input fp_ldst_m;
|
212 |
|
|
// input lsu_inst_vld_w;
|
213 |
|
|
input lda_internal_m;
|
214 |
|
|
input sta_internal_m;
|
215 |
|
|
input cam_real_m;
|
216 |
|
|
// input va_wtchpt_match;
|
217 |
|
|
|
218 |
|
|
input data_rd_vld_g;
|
219 |
|
|
input tag_rd_vld_g;
|
220 |
|
|
input [1:0] ldst_sz_m;
|
221 |
|
|
input asi_internal_m;
|
222 |
|
|
|
223 |
|
|
// input dfill_thread0;
|
224 |
|
|
// input dfill_thread1;
|
225 |
|
|
// input dfill_thread2;
|
226 |
|
|
// input dfill_thread3;
|
227 |
|
|
|
228 |
|
|
wire ld_inst_vld_unflushed;
|
229 |
|
|
wire st_inst_vld_unflushed;
|
230 |
|
|
// input flsh_inst_g;
|
231 |
|
|
// input unc_err_trap_g;
|
232 |
|
|
|
233 |
|
|
//asi decode
|
234 |
|
|
input rd_only_ltlb_asi_e;
|
235 |
|
|
input wr_only_ltlb_asi_e;
|
236 |
|
|
input dfill_tlb_asi_e;
|
237 |
|
|
input ifill_tlb_asi_e;
|
238 |
|
|
|
239 |
|
|
input nofault_asi_m;
|
240 |
|
|
input as_if_user_asi_m;
|
241 |
|
|
|
242 |
|
|
input atomic_asi_m;
|
243 |
|
|
input phy_use_ec_asi_m;
|
244 |
|
|
input phy_byp_ec_asi_m;
|
245 |
|
|
// input tlb_byp_asi_m;
|
246 |
|
|
input quad_asi_m;
|
247 |
|
|
input binit_quad_asi_m;
|
248 |
|
|
input blk_asi_m;
|
249 |
|
|
// input blk_cmt_asi_m;
|
250 |
|
|
input recognized_asi_m;
|
251 |
|
|
input strm_asi_m;
|
252 |
|
|
input mmu_rd_only_asi_m;
|
253 |
|
|
input rd_only_asi_m;
|
254 |
|
|
input wr_only_asi_m;
|
255 |
|
|
input unimp_asi_m;
|
256 |
|
|
input lsu_nonalt_nucl_access_m ;
|
257 |
|
|
|
258 |
|
|
input va_wtchpt_cmp_en_m; //from dctl
|
259 |
|
|
input lsu_va_match_b47_b32_m; //from qdp1
|
260 |
|
|
input lsu_va_match_b31_b3_m; //from qdp1
|
261 |
|
|
|
262 |
|
|
input va_wtchpt_msk_match_m; //from dctldp
|
263 |
|
|
|
264 |
|
|
input ifu_tlu_inst_vld_m ;
|
265 |
|
|
|
266 |
|
|
input exu_tlu_misalign_addr_jmpl_rtn_m;// misaligned addr - jmpl or return addr
|
267 |
|
|
input exu_tlu_va_oor_m; // ??? - to be used in sfsr
|
268 |
|
|
input [3:0] tlu_dsfsr_flt_vld;
|
269 |
|
|
input [3:0] tlu_lsu_pstate_cle ; // current little endian
|
270 |
|
|
input [3:0] tlu_lsu_pstate_am ; // address mask
|
271 |
|
|
input [7:0] lsu_excpctl_asi_state_m ; // ASI State + imm asi
|
272 |
|
|
input lsu_tlu_nonalt_ldst_m ; // non-alternate load or store // FORCE
|
273 |
|
|
input lsu_squash_va_oor_m ; // squash va_oor for mem-op. // FORCE
|
274 |
|
|
input lsu_tlu_xslating_ldst_m ;// xslating ldst,atomic etc // FORCE
|
275 |
|
|
input [2:0] lsu_tlu_ctxt_sel_m; // context selected:0-p,1-s,2-n // FORCE
|
276 |
|
|
input lsu_tlu_write_op_m; // FORCE
|
277 |
|
|
input lsu_memref_m ;
|
278 |
|
|
input lsu_flsh_inst_m ;
|
279 |
|
|
|
280 |
|
|
|
281 |
|
|
input tte_data_parity_error ;
|
282 |
|
|
input tte_tag_parity_error ;
|
283 |
|
|
|
284 |
|
|
wire other_flush_pipe_w ;
|
285 |
|
|
wire defr_trp_taken ;
|
286 |
|
|
wire defr_trp_taken_m, defr_trp_taken_byp, defr_trp_taken_m_din ;
|
287 |
|
|
wire tlb_tte_vld_m, tlb_tte_vld_g ;
|
288 |
|
|
wire priv_pg_usr_mode_m, priv_pg_usr_mode_g, priv_pg_usr_mode;
|
289 |
|
|
wire nfo_pg_nonnfo_asi_m, nfo_pg_nonnfo_asi_g, nfo_pg_nonnfo_asi;
|
290 |
|
|
wire spec_access_epage_m, spec_access_epage_g, spec_access_epage ;
|
291 |
|
|
wire nonwr_pg_st_access;
|
292 |
113 |
albert.wat |
|
293 |
|
|
`ifdef SIMPLY_RISC_TWEAKS
|
294 |
|
|
wire va_wtchpt_en_g;
|
295 |
|
|
`endif
|
296 |
|
|
|
297 |
95 |
fafa1971 |
//=========================================================================================
|
298 |
|
|
// MISCELLANEOUS
|
299 |
|
|
//=========================================================================================
|
300 |
|
|
|
301 |
|
|
wire clk;
|
302 |
|
|
assign clk = rclk;
|
303 |
|
|
wire reset;
|
304 |
|
|
|
305 |
|
|
wire dbb_reset_l;
|
306 |
|
|
|
307 |
|
|
dffrl_async rstff(.din (grst_l),
|
308 |
|
|
.q (dbb_reset_l),
|
309 |
113 |
albert.wat |
.clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so(),
|
310 |
95 |
fafa1971 |
.rst_l (arst_l));
|
311 |
|
|
|
312 |
|
|
assign reset = ~dbb_reset_l ;
|
313 |
|
|
|
314 |
|
|
bw_u1_buf_30x UZsize_stb_cam_hit_bf1 (.a(stb_cam_hit), .z(stb_cam_hit_bf1)); //to dctl, stb_rwctl
|
315 |
|
|
bw_u1_buf_30x UZsize_stb_cam_hit_bf (.a(stb_cam_hit), .z(stb_cam_hit_bf )); //to qctl1
|
316 |
|
|
|
317 |
|
|
wire ld_inst_vld_m;
|
318 |
|
|
wire st_inst_vld_m;
|
319 |
|
|
|
320 |
113 |
albert.wat |
dff_s #(2) inst_vld_stgm (
|
321 |
95 |
fafa1971 |
.din ({ld_inst_vld_e, st_inst_vld_e}),
|
322 |
|
|
.q ({ld_inst_vld_m, st_inst_vld_m}),
|
323 |
|
|
.clk (clk),
|
324 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
325 |
95 |
fafa1971 |
);
|
326 |
|
|
|
327 |
113 |
albert.wat |
dff_s #(2) inst_vld_stgg (
|
328 |
95 |
fafa1971 |
.din ({ld_inst_vld_m, st_inst_vld_m}),
|
329 |
|
|
.q ({ld_inst_vld_unflushed, st_inst_vld_unflushed}),
|
330 |
|
|
.clk (clk),
|
331 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
332 |
95 |
fafa1971 |
);
|
333 |
|
|
|
334 |
|
|
wire tlu_priv_trap_g ;
|
335 |
113 |
albert.wat |
dff_s #(1) tprivtrp_g (
|
336 |
95 |
fafa1971 |
.din (tlu_lsu_priv_trap_m),
|
337 |
|
|
.q (tlu_priv_trap_g),
|
338 |
|
|
.clk (clk),
|
339 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
340 |
95 |
fafa1971 |
);
|
341 |
|
|
|
342 |
|
|
|
343 |
|
|
//=========================================================================================
|
344 |
|
|
// Thread Staging
|
345 |
|
|
//=========================================================================================
|
346 |
|
|
|
347 |
|
|
wire [1:0] thrid_m, thrid_g ;
|
348 |
113 |
albert.wat |
dff_s #(2) tid_stgm (
|
349 |
95 |
fafa1971 |
.din (ifu_tlu_thrid_e[1:0]),
|
350 |
|
|
.q (thrid_m[1:0]),
|
351 |
|
|
.clk (clk),
|
352 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
353 |
95 |
fafa1971 |
);
|
354 |
|
|
|
355 |
|
|
wire thread0_m, thread1_m, thread2_m, thread3_m;
|
356 |
|
|
|
357 |
|
|
assign thread0_m = ~thrid_m[1] & ~thrid_m[0] ;
|
358 |
|
|
assign thread1_m = ~thrid_m[1] & thrid_m[0] ;
|
359 |
|
|
assign thread2_m = thrid_m[1] & ~thrid_m[0] ;
|
360 |
|
|
assign thread3_m = thrid_m[1] & thrid_m[0] ;
|
361 |
|
|
|
362 |
|
|
wire thread0_g, thread1_g, thread2_g, thread3_g ;
|
363 |
113 |
albert.wat |
dff_s #(4) tid_stgg (
|
364 |
95 |
fafa1971 |
.din ({thread0_m, thread1_m, thread2_m, thread3_m}),
|
365 |
|
|
.q ({thread0_g, thread1_g, thread2_g, thread3_g}),
|
366 |
|
|
.clk (clk),
|
367 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
368 |
95 |
fafa1971 |
);
|
369 |
|
|
|
370 |
|
|
//=========================================================================================
|
371 |
|
|
// INST_VLD_W GENERATION
|
372 |
|
|
//=========================================================================================
|
373 |
|
|
|
374 |
|
|
|
375 |
|
|
assign thrid_g[0] = thread1_g | thread3_g ;
|
376 |
|
|
assign thrid_g[1] = thread2_g | thread3_g ;
|
377 |
|
|
|
378 |
|
|
wire flush_w_inst_vld_m ;
|
379 |
|
|
wire lsu_inst_vld_w ;
|
380 |
|
|
wire lsu_flush_pipe_w;
|
381 |
|
|
assign flush_w_inst_vld_m =
|
382 |
|
|
ifu_tlu_inst_vld_m &
|
383 |
|
|
~(lsu_flush_pipe_w & (thrid_m[1:0] == thrid_g[1:0])) ; // really lsu_flush_pipe_w
|
384 |
|
|
|
385 |
113 |
albert.wat |
dff_s stgw_ivld (
|
386 |
95 |
fafa1971 |
.din (flush_w_inst_vld_m),
|
387 |
|
|
.q (lsu_inst_vld_w),
|
388 |
|
|
.clk (clk),
|
389 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
390 |
95 |
fafa1971 |
);
|
391 |
|
|
|
392 |
|
|
//========================================================================
|
393 |
|
|
// Miscellaneous
|
394 |
|
|
//========================================================================
|
395 |
|
|
|
396 |
|
|
|
397 |
|
|
// Moved to excpctl from stb_rwctl as excpctl is closer to stb-cam.
|
398 |
|
|
mux4ds #(8) stbvld_mx (
|
399 |
|
|
.in0 (~stb_state_vld0[7:0]),
|
400 |
|
|
.in1 (~stb_state_vld1[7:0]),
|
401 |
|
|
.in2 (~stb_state_vld2[7:0]),
|
402 |
|
|
.in3 (~stb_state_vld3[7:0]),
|
403 |
|
|
.sel0 (thread0_g),
|
404 |
|
|
.sel1 (thread1_g),
|
405 |
|
|
.sel2 (thread2_g),
|
406 |
|
|
.sel3 (thread3_g),
|
407 |
|
|
.dout (stb_cam_sqsh_msk[7:0])
|
408 |
|
|
);
|
409 |
|
|
|
410 |
|
|
//========================================================================
|
411 |
|
|
// Exception Handling Begin
|
412 |
|
|
//========================================================================
|
413 |
|
|
|
414 |
|
|
//va watch point
|
415 |
|
|
wire va_match_g;
|
416 |
|
|
wire va_wtchpt_msk_match_g;
|
417 |
|
|
|
418 |
|
|
|
419 |
|
|
wire va_wtchpt_en_m ;
|
420 |
|
|
|
421 |
|
|
assign va_wtchpt_en_m =
|
422 |
|
|
va_wtchpt_cmp_en_m &
|
423 |
|
|
(((~asi_internal_m & recognized_asi_m) & lsu_alt_space_m) | ~lsu_alt_space_m) // Bug5226
|
424 |
|
|
& (ld_inst_vld_m | st_inst_vld_m) & //bug 3681
|
425 |
|
|
~(hpv_priv_m & hpstate_en_m) // ECO 4178
|
426 |
|
|
& ~cam_real_m ; // ECO 5470 (TO_2_0)
|
427 |
|
|
|
428 |
|
|
//bug6480
|
429 |
|
|
wire lsu_va_match_m;
|
430 |
|
|
wire pstate_am_m ;
|
431 |
|
|
|
432 |
|
|
assign lsu_va_match_m = ((lsu_va_match_b47_b32_m & lsu_va_match_b31_b3_m) & ~pstate_am_m) |
|
433 |
|
|
(lsu_va_match_b31_b3_m & pstate_am_m);
|
434 |
|
|
|
435 |
113 |
albert.wat |
dff_s #(3) stgwtch_g (
|
436 |
95 |
fafa1971 |
.din ({va_wtchpt_en_m,
|
437 |
|
|
lsu_va_match_m,
|
438 |
|
|
va_wtchpt_msk_match_m}),
|
439 |
|
|
.q ({va_wtchpt_en_g,
|
440 |
|
|
va_match_g,
|
441 |
|
|
va_wtchpt_msk_match_g}),
|
442 |
|
|
.clk (clk),
|
443 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
444 |
95 |
fafa1971 |
);
|
445 |
|
|
|
446 |
|
|
|
447 |
|
|
// These signals will eventually generate exceptions.
|
448 |
|
|
wire va_wtchpt_match;
|
449 |
|
|
|
450 |
|
|
assign va_wtchpt_match =
|
451 |
|
|
va_match_g & va_wtchpt_msk_match_g & lsu_inst_vld_w & va_wtchpt_en_g;
|
452 |
|
|
|
453 |
|
|
assign lsu_tlu_wtchpt_trp_g = va_wtchpt_match ;
|
454 |
|
|
|
455 |
|
|
|
456 |
|
|
// tlb related exceptions/errors
|
457 |
|
|
wire tlb_daccess_excptn_e, tlb_daccess_excptn_m ;
|
458 |
|
|
wire tlb_daccess_excptn_e_d1;
|
459 |
|
|
wire tlb_illgl_pgsz_m ;
|
460 |
|
|
|
461 |
|
|
assign tlb_daccess_excptn_e =
|
462 |
|
|
((rd_only_ltlb_asi_e & st_inst_vld_e) |
|
463 |
|
|
(wr_only_ltlb_asi_e & ld_inst_vld_e)) & ifu_lsu_alt_space_e ;
|
464 |
|
|
|
465 |
113 |
albert.wat |
dff_s #(1) tlbex_stgm (
|
466 |
95 |
fafa1971 |
.din ({tlb_daccess_excptn_e}),
|
467 |
|
|
.q ({tlb_daccess_excptn_e_d1}),
|
468 |
|
|
.clk (clk),
|
469 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
470 |
95 |
fafa1971 |
);
|
471 |
|
|
|
472 |
|
|
assign tlb_daccess_excptn_m = tlb_daccess_excptn_e_d1 | tlb_illgl_pgsz_m;
|
473 |
|
|
|
474 |
|
|
wire pstate_priv_m;
|
475 |
|
|
//wire pstate_priv;
|
476 |
|
|
|
477 |
|
|
mux4ds #(1) pstate_priv_m_mux (
|
478 |
|
|
.in0 (tlu_lsu_pstate_priv[0]),
|
479 |
|
|
.in1 (tlu_lsu_pstate_priv[1]),
|
480 |
|
|
.in2 (tlu_lsu_pstate_priv[2]),
|
481 |
|
|
.in3 (tlu_lsu_pstate_priv[3]),
|
482 |
|
|
.sel0 (thread0_m),
|
483 |
|
|
.sel1 (thread1_m),
|
484 |
|
|
.sel2 (thread2_m),
|
485 |
|
|
.sel3 (thread3_m),
|
486 |
|
|
.dout (pstate_priv_m)
|
487 |
|
|
);
|
488 |
|
|
|
489 |
|
|
//dff #(1) priv_stgg (
|
490 |
|
|
// .din (pstate_priv_m),
|
491 |
|
|
// .q (pstate_priv),
|
492 |
|
|
// .clk (clk),
|
493 |
113 |
albert.wat |
// .se (se), `SIMPLY_RISC_SCANIN, .so ()
|
494 |
95 |
fafa1971 |
// );
|
495 |
|
|
|
496 |
|
|
// privilege violation - priv page accessed in user mode
|
497 |
|
|
//timing
|
498 |
|
|
//assign priv_pg_usr_mode = // data access exception; TT=h30
|
499 |
|
|
// (ld_inst_vld_unflushed | st_inst_vld_unflushed) & ~(pstate_priv | hpv_priv) & tlb_rd_tte_data_pbit ;
|
500 |
|
|
|
501 |
|
|
//SC2 wire hpv_priv_m;
|
502 |
|
|
|
503 |
|
|
assign priv_pg_usr_mode_m = (ld_inst_vld_m | st_inst_vld_m) & ~(pstate_priv_m | hpv_priv_m);
|
504 |
|
|
|
505 |
113 |
albert.wat |
dff_s #(1) priv_pg_usr_mode_stgg (
|
506 |
95 |
fafa1971 |
.din (priv_pg_usr_mode_m),
|
507 |
|
|
.q (priv_pg_usr_mode_g),
|
508 |
|
|
.clk (clk),
|
509 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
510 |
95 |
fafa1971 |
);
|
511 |
|
|
|
512 |
|
|
assign priv_pg_usr_mode = priv_pg_usr_mode_g & tlb_rd_tte_data_pbit ;
|
513 |
|
|
|
514 |
|
|
// protection violation - store to a page that does not have write permission
|
515 |
|
|
//timing
|
516 |
|
|
//assign nonwr_pg_st_access = // data access protection; TT=h33
|
517 |
|
|
// st_inst_vld_unflushed &
|
518 |
|
|
// ~tlb_rd_tte_data_wbit & ~lsu_dtlb_bypass_g & tlb_cam_hit_g ;
|
519 |
|
|
// //lsu_dtlb_bypass_g) ; // W=1 in bypass mode - In bypass mode this trap will never happen !!!
|
520 |
|
|
|
521 |
|
|
assign nonwr_pg_st_access = ~tlb_rd_tte_data_wbit & st_inst_vld_unflushed & tlb_tte_vld_g;
|
522 |
|
|
|
523 |
|
|
wire daccess_prot ;
|
524 |
|
|
assign daccess_prot = nonwr_pg_st_access ;
|
525 |
|
|
//((~lsu_dtlb_bypass_g & tlb_cam_hit_g) | (tlb_byp_asi_g & lsu_alt_space_g)) ;
|
526 |
|
|
|
527 |
|
|
// access to a page marked with the nfo with an asi other than nfo asi.
|
528 |
|
|
//timing
|
529 |
|
|
//assign nfo_pg_nonnfo_asi = // data access exception; TT=h30
|
530 |
|
|
// (ld_inst_vld_unflushed | st_inst_vld_unflushed) & // any access
|
531 |
|
|
// ((~nofault_asi_g & lsu_alt_space_g) | ~lsu_alt_space_g) // in alternate space or not
|
532 |
|
|
// & tlb_rd_tte_data_nfobit ;
|
533 |
|
|
|
534 |
|
|
assign nfo_pg_nonnfo_asi_m = (ld_inst_vld_m | st_inst_vld_m) &
|
535 |
|
|
((~nofault_asi_m & lsu_alt_space_m) | ~lsu_alt_space_m) ;
|
536 |
|
|
|
537 |
113 |
albert.wat |
dff_s #(1) nfo_pg_nonnfo_asi_stgg (
|
538 |
95 |
fafa1971 |
.din (nfo_pg_nonnfo_asi_m),
|
539 |
|
|
.q (nfo_pg_nonnfo_asi_g),
|
540 |
|
|
.clk (clk),
|
541 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
542 |
95 |
fafa1971 |
);
|
543 |
|
|
assign nfo_pg_nonnfo_asi = nfo_pg_nonnfo_asi_g & tlb_rd_tte_data_nfobit ;
|
544 |
|
|
|
545 |
|
|
// as_if_usr asi accesses priv page.
|
546 |
|
|
//timing
|
547 |
|
|
//assign as_if_usr_priv_pg = // data access exception; TT=h30
|
548 |
|
|
// (ld_inst_vld_unflushed | st_inst_vld_unflushed) & as_if_user_asi_g & lsu_alt_space_g &
|
549 |
|
|
// tlb_rd_tte_data_pbit ;
|
550 |
|
|
|
551 |
|
|
wire as_if_usr_priv_pg_m, as_if_usr_priv_pg_g, as_if_usr_priv_pg;
|
552 |
|
|
assign as_if_usr_priv_pg_m = (ld_inst_vld_m | st_inst_vld_m) & as_if_user_asi_m & lsu_alt_space_m;
|
553 |
|
|
|
554 |
113 |
albert.wat |
dff_s #(1) as_if_usr_priv_pg_stgg (
|
555 |
95 |
fafa1971 |
.din (as_if_usr_priv_pg_m),
|
556 |
|
|
.q (as_if_usr_priv_pg_g),
|
557 |
|
|
.clk (clk),
|
558 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
559 |
95 |
fafa1971 |
);
|
560 |
|
|
assign as_if_usr_priv_pg = as_if_usr_priv_pg_g & tlb_rd_tte_data_pbit ;
|
561 |
|
|
|
562 |
|
|
// non-cacheable address - iospace PA[39] = 1
|
563 |
|
|
// atomic access to non-cacheable space.
|
564 |
|
|
wire atm_access_w_nc, atomic_g;
|
565 |
|
|
|
566 |
113 |
albert.wat |
dff_s #(1) atm_stgg (
|
567 |
95 |
fafa1971 |
.din (atomic_m),
|
568 |
|
|
.q (atomic_g),
|
569 |
|
|
.clk (clk),
|
570 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
571 |
95 |
fafa1971 |
);
|
572 |
|
|
|
573 |
|
|
|
574 |
|
|
assign atm_access_w_nc = atomic_g & tlb_pgnum_b39 ; // io space
|
575 |
|
|
|
576 |
|
|
// atomic inst with unsupported asi.
|
577 |
|
|
//timing
|
578 |
|
|
//assign atm_access_unsup_asi = atomic_g & ~atomic_asi_g & lsu_alt_space_g ;
|
579 |
|
|
wire atm_access_unsup_asi_m, atm_access_unsup_asi;
|
580 |
|
|
|
581 |
|
|
assign atm_access_unsup_asi_m = atomic_m & ~atomic_asi_m & lsu_alt_space_m;
|
582 |
|
|
|
583 |
113 |
albert.wat |
dff_s #(1) atm_access_unsup_asi_stgg (
|
584 |
95 |
fafa1971 |
.din (atm_access_unsup_asi_m),
|
585 |
|
|
.q (atm_access_unsup_asi),
|
586 |
|
|
.clk (clk),
|
587 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
588 |
95 |
fafa1971 |
);
|
589 |
|
|
|
590 |
|
|
|
591 |
|
|
//timing
|
592 |
|
|
//assign tlb_tte_vld_g = ~lsu_dtlb_bypass_g & tlb_cam_hit_g ;
|
593 |
|
|
|
594 |
|
|
wire dmmu_va_oor_m ;
|
595 |
|
|
assign tlb_tte_vld_m = ~dtlb_bypass_m & tlb_cam_hit &
|
596 |
|
|
~((unimp_asi_m | asi_internal_m | ~recognized_asi_m) &
|
597 |
|
|
lsu_alt_space_m) & // Bug 3541,5186
|
598 |
|
|
~dmmu_va_oor_m ; // Bug 5070
|
599 |
|
|
|
600 |
113 |
albert.wat |
dff_s #(1) tlb_tte_vld_stgg (
|
601 |
95 |
fafa1971 |
.din (tlb_tte_vld_m),
|
602 |
|
|
.q (tlb_tte_vld_g),
|
603 |
|
|
.clk (clk),
|
604 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
605 |
95 |
fafa1971 |
);
|
606 |
|
|
|
607 |
|
|
wire pg_with_ebit_m, pg_with_ebit_g, pg_with_ebit ;
|
608 |
|
|
//timing
|
609 |
|
|
//assign pg_with_ebit =
|
610 |
|
|
// (tlb_rd_tte_data_ebit & tlb_tte_vld_g) | // tte
|
611 |
|
|
// (lsu_dtlb_bypass_g & ~(phy_use_ec_asi_g & lsu_alt_space_g)) | // regular bypass
|
612 |
|
|
// (tlb_byp_asi_g & ~phy_use_ec_asi_g & lsu_alt_space_g) ; // phy_byp
|
613 |
|
|
|
614 |
|
|
assign pg_with_ebit_m =
|
615 |
|
|
(dtlb_bypass_m & ~(phy_use_ec_asi_m & lsu_alt_space_m) &
|
616 |
|
|
(lsu_ldst_va_b39_m & ~pstate_am_m)) |
|
617 |
|
|
// regular bypass // Bug 4296,5050 related.
|
618 |
|
|
(dtlb_bypass_m & (phy_byp_ec_asi_m & lsu_alt_space_m)) ; // phy_byp
|
619 |
|
|
|
620 |
113 |
albert.wat |
dff_s #(1) pg_with_ebit_stgg (
|
621 |
95 |
fafa1971 |
.din (pg_with_ebit_m),
|
622 |
|
|
.q (pg_with_ebit_g),
|
623 |
|
|
.clk (clk),
|
624 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
625 |
95 |
fafa1971 |
);
|
626 |
|
|
assign pg_with_ebit = (tlb_rd_tte_data_ebit & tlb_tte_vld_g) | // tte
|
627 |
|
|
pg_with_ebit_g;
|
628 |
|
|
|
629 |
|
|
//timing
|
630 |
|
|
//assign spec_access_epage =
|
631 |
|
|
// ((ld_inst_vld_unflushed & nofault_asi_g & lsu_alt_space_g) | // spec load
|
632 |
|
|
// flsh_inst_g) & // flush inst
|
633 |
|
|
// pg_with_ebit ; // page with side effects
|
634 |
|
|
//// tlb_rd_tte_data_ebit ; // page with side effects
|
635 |
|
|
|
636 |
|
|
assign spec_access_epage_m =
|
637 |
|
|
// Bug 5166
|
638 |
|
|
((ld_inst_vld_m & ~atomic_m) & nofault_asi_m & lsu_alt_space_m); // spec load
|
639 |
113 |
albert.wat |
dff_s #(1) spec_access_epage_stgg (
|
640 |
95 |
fafa1971 |
.din (spec_access_epage_m),
|
641 |
|
|
.q (spec_access_epage_g),
|
642 |
|
|
.clk (clk),
|
643 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
644 |
95 |
fafa1971 |
);
|
645 |
|
|
// remove flsh_inst_g ??
|
646 |
|
|
//assign spec_access_epage = (spec_access_epage_g | flsh_inst_g) & pg_with_ebit;
|
647 |
|
|
assign spec_access_epage = (spec_access_epage_g) & pg_with_ebit;
|
648 |
|
|
|
649 |
|
|
|
650 |
|
|
wire quad_asi_non_ldstda_m;
|
651 |
|
|
// covers regular quad asi AND binit.
|
652 |
|
|
assign quad_asi_non_ldstda_m =
|
653 |
|
|
quad_asi_m & lsu_alt_space_m &
|
654 |
|
|
((~ldst_dbl_m & ld_inst_vld_m) | // only lddbl should use
|
655 |
|
|
(fp_ldst_m & (ld_inst_vld_m | st_inst_vld_m))) ; // float should not use
|
656 |
|
|
|
657 |
|
|
wire true_quad_non_ldda_m ;
|
658 |
|
|
// catches case where st or non-ldd uses asi
|
659 |
|
|
assign true_quad_non_ldda_m =
|
660 |
|
|
(quad_asi_m & ~binit_quad_asi_m) & lsu_alt_space_m &
|
661 |
|
|
((~ldst_dbl_m & ld_inst_vld_m) | st_inst_vld_m) ;
|
662 |
|
|
|
663 |
|
|
wire blk_asi_non_ldstdfa_m ;
|
664 |
|
|
|
665 |
|
|
assign blk_asi_non_ldstdfa_m = blk_asi_m & lsu_alt_space_m &
|
666 |
|
|
~(ldst_dbl_m & fp_ldst_m) & (ld_inst_vld_m | st_inst_vld_m) ;
|
667 |
|
|
|
668 |
|
|
// trap on illegal asi
|
669 |
|
|
wire illegal_asi_trap_m, illegal_asi_trap_g, illegal_asi_trap_m_d1 ;
|
670 |
|
|
|
671 |
|
|
assign illegal_asi_trap_m =
|
672 |
|
|
((ld_inst_vld_m | st_inst_vld_m) & lsu_alt_space_m & ~recognized_asi_m) |
|
673 |
|
|
((ld_inst_vld_m | st_inst_vld_m) & asi_internal_m & fp_ldst_m & lsu_alt_space_m) | // Bug 4382
|
674 |
|
|
blk_asi_non_ldstdfa_m |
|
675 |
|
|
quad_asi_non_ldstda_m |
|
676 |
|
|
true_quad_non_ldda_m ;
|
677 |
|
|
|
678 |
113 |
albert.wat |
dff_s #(1) illegal_asi_trap_stgg (
|
679 |
95 |
fafa1971 |
.din (illegal_asi_trap_m),
|
680 |
|
|
.q (illegal_asi_trap_m_d1),
|
681 |
|
|
.clk (clk),
|
682 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
683 |
95 |
fafa1971 |
);
|
684 |
|
|
//need lsu_inst_vld_w ??
|
685 |
|
|
// assign illegal_asi_trap_g = illegal_asi_trap_m_d1 & lsu_inst_vld_w;
|
686 |
|
|
assign illegal_asi_trap_g = illegal_asi_trap_m_d1;
|
687 |
|
|
|
688 |
|
|
wire wr_to_strm_sync_m ;
|
689 |
|
|
//timing
|
690 |
|
|
//assign wr_to_strm_sync =
|
691 |
|
|
// strm_asi & ((ldst_va_g[7:0] == 8'hA0) | (ldst_va_g[7:0] == 8'h68)) &
|
692 |
|
|
// st_inst_vld_unflushed & lsu_alt_space_g ;
|
693 |
|
|
|
694 |
|
|
assign wr_to_strm_sync_m = // Bug 5742
|
695 |
|
|
strm_asi_m & (lsu_ldst_va_m[7:0] == 8'hA0) & st_inst_vld_m & lsu_alt_space_m ;
|
696 |
|
|
|
697 |
|
|
/*dff #(1) wr_to_strm_sync_stgg (
|
698 |
|
|
.din (wr_to_strm_sync_m),
|
699 |
|
|
.q (wr_to_strm_sync),
|
700 |
|
|
.clk (clk),
|
701 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
702 |
95 |
fafa1971 |
);*/
|
703 |
|
|
|
704 |
|
|
|
705 |
|
|
// HPV Changes
|
706 |
|
|
// Push back into previous stage.
|
707 |
|
|
// qualification with hpv_priv and hpstate_en required to ensure hypervisor
|
708 |
|
|
// is not trying to access.
|
709 |
|
|
//SC2 wire hpv_priv_e;
|
710 |
|
|
|
711 |
|
|
//SC2 mux4ds #(1) hpv_priv_e_mux (
|
712 |
|
|
//SC2 .in0 (tlu_lsu_hpv_priv[0]),
|
713 |
|
|
//SC2 .in1 (tlu_lsu_hpv_priv[1]),
|
714 |
|
|
//SC2 .in2 (tlu_lsu_hpv_priv[2]),
|
715 |
|
|
//SC2 .in3 (tlu_lsu_hpv_priv[3]),
|
716 |
|
|
//SC2 .sel0 (thread0_e),
|
717 |
|
|
//SC2 .sel1 (thread1_e),
|
718 |
|
|
//SC2 .sel2 (thread2_e),
|
719 |
|
|
//SC2 .sel3 (thread3_e),
|
720 |
|
|
//SC2 .dout (hpv_priv_e)
|
721 |
|
|
//SC2);
|
722 |
|
|
|
723 |
|
|
//SC2 wire hpstate_en_e;
|
724 |
|
|
|
725 |
|
|
//SC2 mux4ds #(1) hpstate_en_e_mux (
|
726 |
|
|
//SC2 .in0 (tlu_lsu_hpstate_en[0]),
|
727 |
|
|
//SC2 .in1 (tlu_lsu_hpstate_en[1]),
|
728 |
|
|
//SC2 .in2 (tlu_lsu_hpstate_en[2]),
|
729 |
|
|
//SC2 .in3 (tlu_lsu_hpstate_en[3]),
|
730 |
|
|
//SC2 .sel0 (thread0_e),
|
731 |
|
|
//SC2 .sel1 (thread1_e),
|
732 |
|
|
//SC2 .sel2 (thread2_e),
|
733 |
|
|
//SC2 .sel3 (thread3_e),
|
734 |
|
|
//SC2 .dout (hpstate_en_e)
|
735 |
|
|
//SC2);
|
736 |
|
|
//SC2 wire hpstate_en_m;
|
737 |
|
|
|
738 |
|
|
//SC2 dff #(2) hpv_stgm (
|
739 |
|
|
//SC2 .din ({hpv_priv_e, hpstate_en_e}),
|
740 |
|
|
//SC2 .q ({hpv_priv_m, hpstate_en_m}),
|
741 |
|
|
//SC2 .clk (clk),
|
742 |
113 |
albert.wat |
//SC2 .se (se), `SIMPLY_RISC_SCANIN, .so ()
|
743 |
95 |
fafa1971 |
//SC2 );
|
744 |
|
|
//SC2 wire hpv_priv, hpstate_en;
|
745 |
|
|
|
746 |
|
|
|
747 |
|
|
//SC2 dff #(2) hpv_stgg (
|
748 |
|
|
//SC2 .din ({hpv_priv_m, hpstate_en_m}),
|
749 |
|
|
//SC2 .q ({hpv_priv, hpstate_en}),
|
750 |
|
|
//SC2 .clk (clk),
|
751 |
113 |
albert.wat |
//SC2 .se (se), `SIMPLY_RISC_SCANIN, .so ()
|
752 |
95 |
fafa1971 |
//SC2 );
|
753 |
|
|
|
754 |
|
|
/*assign priv_action = (ld_inst_vld_unflushed | st_inst_vld_unflushed) & ~lsu_asi_state[7] &
|
755 |
|
|
~pstate_priv & ~(hpv_priv & hpstate_en) & lsu_alt_space_g ;*/
|
756 |
|
|
// Generate a stage earlier
|
757 |
|
|
wire priv_action_m, priv_action;
|
758 |
|
|
|
759 |
|
|
assign priv_action_m = (ld_inst_vld_m | st_inst_vld_m) &
|
760 |
|
|
((~lsu_excpctl_asi_state_m[7] & lsu_alt_space_m) | // alt_space
|
761 |
|
|
lsu_nonalt_nucl_access_m) & // non-alt space - nucleus ctxt
|
762 |
|
|
~pstate_priv_m & ~(hpv_priv_m & hpstate_en_m) ;
|
763 |
|
|
|
764 |
|
|
/*assign priv_action_m = (ld_inst_vld_m | st_inst_vld_m) & ~lsu_excpctl_asi_state_m[7] &
|
765 |
|
|
~pstate_priv_m & ~(hpv_priv_m & hpstate_en_m) & lsu_alt_space_m ;*/
|
766 |
|
|
|
767 |
113 |
albert.wat |
dff_s pact_stgg (
|
768 |
95 |
fafa1971 |
.din (priv_action_m),
|
769 |
|
|
.q (priv_action),
|
770 |
|
|
.clk (clk),
|
771 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
772 |
95 |
fafa1971 |
);
|
773 |
|
|
|
774 |
|
|
// Take data_access exception if supervisor uses hypervisor asi
|
775 |
|
|
wire hpv_asi_range_m;
|
776 |
|
|
wire spv_use_hpv_m ;
|
777 |
|
|
//timing
|
778 |
|
|
//assign hpv_asi_range =
|
779 |
|
|
// ~lsu_asi_state[7] & (
|
780 |
|
|
// (~lsu_asi_state[6] & lsu_asi_state[5] & lsu_asi_state[4]) | // 0x3?
|
781 |
|
|
// ( lsu_asi_state[6]));
|
782 |
|
|
|
783 |
|
|
assign hpv_asi_range_m =
|
784 |
|
|
~lsu_excpctl_asi_state_m[7] & (
|
785 |
|
|
(~lsu_excpctl_asi_state_m[6] & lsu_excpctl_asi_state_m[5] & lsu_excpctl_asi_state_m[4]) | // 0x3?
|
786 |
|
|
( lsu_excpctl_asi_state_m[6])); // 0x4?,5?,6?,7?
|
787 |
|
|
|
788 |
|
|
// Take data_access exception if supervisor uses hypervisor asi
|
789 |
|
|
|
790 |
|
|
assign spv_use_hpv_m = (ld_inst_vld_m | st_inst_vld_m) &
|
791 |
|
|
hpv_asi_range_m &
|
792 |
|
|
pstate_priv_m & ~hpv_priv_m & lsu_alt_space_m ;
|
793 |
|
|
|
794 |
|
|
// EARLY TRAPS
|
795 |
|
|
|
796 |
|
|
// memory address not aligned
|
797 |
|
|
wire qw_align_addr,blk_align_addr ;
|
798 |
|
|
wire hw_align_addr,wd_align_addr,dw_align_addr;
|
799 |
|
|
|
800 |
|
|
assign hw_align_addr = ~lsu_ldst_va_m[0] ; // half-word addr
|
801 |
|
|
assign wd_align_addr = ~lsu_ldst_va_m[1] & ~lsu_ldst_va_m[0] ; // word addr
|
802 |
|
|
assign dw_align_addr = ~lsu_ldst_va_m[2] & ~lsu_ldst_va_m[1] & ~lsu_ldst_va_m[0] ; // dw addr
|
803 |
|
|
assign qw_align_addr = ~lsu_ldst_va_m[3] & ~lsu_ldst_va_m[2] & ~lsu_ldst_va_m[1] & ~lsu_ldst_va_m[0] ; // qw addr
|
804 |
|
|
assign blk_align_addr =
|
805 |
|
|
~lsu_ldst_va_m[5] & ~lsu_ldst_va_m[4] & ~lsu_ldst_va_m[3] &
|
806 |
|
|
~lsu_ldst_va_m[2] & ~lsu_ldst_va_m[1] & ~lsu_ldst_va_m[0] ; // 64B aligned addr for block ld/st
|
807 |
|
|
|
808 |
|
|
wire hw_size,wd_size,dw_size;
|
809 |
|
|
|
810 |
|
|
//assign byte_size = ~ldst_sz_m[1] & ~ldst_sz_m[0] ; // byte size
|
811 |
|
|
assign hw_size = ~ldst_sz_m[1] & ldst_sz_m[0] ; // half-word size
|
812 |
|
|
assign wd_size = ldst_sz_m[1] & ~ldst_sz_m[0] ; // word size
|
813 |
|
|
assign dw_size = ldst_sz_m[1] & ldst_sz_m[0] ; // double-word size
|
814 |
|
|
|
815 |
|
|
wire mem_addr_not_align ;
|
816 |
|
|
|
817 |
|
|
assign mem_addr_not_align
|
818 |
|
|
= (((hw_size & ~hw_align_addr) | // half-word check
|
819 |
|
|
(wd_size & ~wd_align_addr) | // word check
|
820 |
|
|
(dw_size & ~dw_align_addr) | // double word check
|
821 |
|
|
//((quad_asi_m | binit_quad_asi_m) & lsu_alt_space_m & ldst_dbl_m & ~qw_align_addr) | // quad word check
|
822 |
|
|
(blk_asi_m & lsu_alt_space_m & fp_ldst_m & ldst_dbl_m & ~blk_align_addr)) & // 64B blk ld/st check
|
823 |
|
|
//(blk_asi_m & lsu_alt_space_m & blk_asi_m & ~blk_align_addr)) & // 64B blk ld/st check
|
824 |
|
|
(ld_inst_vld_m | st_inst_vld_m)) |
|
825 |
|
|
// check only for loads
|
826 |
|
|
(((quad_asi_m | binit_quad_asi_m) & lsu_alt_space_m & ldst_dbl_m & ~qw_align_addr) & ld_inst_vld_m) ; // quad word check
|
827 |
|
|
|
828 |
|
|
// To be removed !! Now supported for both ld and st thru unimp_asi.
|
829 |
|
|
//wire blkst_cmt_daccess_excp_m ;
|
830 |
|
|
//assign blkst_cmt_daccess_excp_m =
|
831 |
|
|
// (blk_cmt_asi_m & lsu_alt_space_m & fp_ldst_m & ldst_dbl_m & st_inst_vld_m) ;
|
832 |
|
|
|
833 |
|
|
wire stdf_maddr_not_align, lddf_maddr_not_align ;
|
834 |
|
|
|
835 |
|
|
assign stdf_maddr_not_align
|
836 |
|
|
= st_inst_vld_m & fp_ldst_m & ldst_dbl_m & wd_align_addr & ~dw_align_addr
|
837 |
|
|
& ~((blk_asi_m | quad_asi_m) & lsu_alt_space_m);
|
838 |
|
|
|
839 |
|
|
assign lddf_maddr_not_align
|
840 |
|
|
= ld_inst_vld_m & fp_ldst_m & ldst_dbl_m & wd_align_addr & ~dw_align_addr
|
841 |
|
|
& ~((blk_asi_m | quad_asi_m) & lsu_alt_space_m);
|
842 |
|
|
|
843 |
|
|
// internal asi access by ld/st other than ldxa/stxa/lddfa/stdfa.
|
844 |
|
|
wire asi_internal_non_xdw ;
|
845 |
|
|
|
846 |
|
|
assign asi_internal_non_xdw
|
847 |
|
|
= (st_inst_vld_m | ld_inst_vld_m) & lsu_alt_space_m & asi_internal_m &
|
848 |
|
|
~(dw_size & (~ldst_dbl_m | fp_ldst_m)) ; //bug4149;
|
849 |
|
|
|
850 |
|
|
|
851 |
|
|
// asi related
|
852 |
|
|
// rd-only mmu asi requiring va decode.
|
853 |
|
|
wire mmu_rd_only_asi_wva_m ;
|
854 |
|
|
assign mmu_rd_only_asi_wva_m =
|
855 |
|
|
((lsu_excpctl_asi_state_m[7:0]==8'h58) & (
|
856 |
|
|
(lsu_ldst_va_m[7:0] == 8'h00) | // dtag_target
|
857 |
|
|
(lsu_ldst_va_m[7:0] == 8'h20))) | // dsync_far
|
858 |
|
|
((lsu_excpctl_asi_state_m[7:0]==8'h50) &
|
859 |
|
|
(lsu_ldst_va_m[7:0] == 8'h00)) ; // itag_target
|
860 |
|
|
|
861 |
|
|
wire wr_to_rd_only_asi, rd_of_wr_only_asi, unimp_asi_used;
|
862 |
|
|
|
863 |
|
|
assign wr_to_rd_only_asi =
|
864 |
|
|
((mmu_rd_only_asi_wva_m |// mmu with non-unique asi
|
865 |
|
|
mmu_rd_only_asi_m | // mmu with unique asi
|
866 |
|
|
rd_only_asi_m) // non mmu
|
867 |
|
|
& st_inst_vld_m & lsu_alt_space_m) |
|
868 |
|
|
wr_to_strm_sync_m ; // Bug 5399
|
869 |
|
|
|
870 |
|
|
assign rd_of_wr_only_asi = wr_only_asi_m & ld_inst_vld_m & lsu_alt_space_m ;
|
871 |
|
|
assign unimp_asi_used = unimp_asi_m & (ld_inst_vld_m | st_inst_vld_m) & lsu_alt_space_m ;
|
872 |
|
|
|
873 |
|
|
wire asi_related_trap_m ; // asi_related_trap_g;
|
874 |
|
|
|
875 |
|
|
assign asi_related_trap_m = wr_to_rd_only_asi | rd_of_wr_only_asi | unimp_asi_used | asi_internal_non_xdw ;
|
876 |
|
|
|
877 |
|
|
// Illegal page size for tlb fill
|
878 |
|
|
|
879 |
|
|
wire [2:0] pgszr_m,pgszv_m ;
|
880 |
113 |
albert.wat |
dff_s #(6) pgsz_stgm (
|
881 |
95 |
fafa1971 |
.din ({lsu_sun4r_pgsz_b2t0_e[2:0],lsu_sun4v_pgsz_b2t0_e[2:0]}),
|
882 |
|
|
.q ({pgszr_m[2:0],pgszv_m[2:0]}),
|
883 |
|
|
.clk (clk),
|
884 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
885 |
95 |
fafa1971 |
);
|
886 |
|
|
|
887 |
|
|
wire [2:0] pgsz_m ;
|
888 |
|
|
|
889 |
|
|
assign pgsz_m[2:0] = lsu_sun4r_va_m_l ? pgszv_m[2:0] : pgszr_m[2:0] ;
|
890 |
|
|
|
891 |
|
|
wire illgl_pgsz_m ;
|
892 |
|
|
assign illgl_pgsz_m =
|
893 |
|
|
(~pgsz_m[2] & pgsz_m[1] & ~pgsz_m[0]) | // 010 ; 512K
|
894 |
|
|
( pgsz_m[2] & ~pgsz_m[1] & ~pgsz_m[0]) | // 100 ; 32M
|
895 |
|
|
( pgsz_m[2] & pgsz_m[1] & ~pgsz_m[0]) | // 110 ; 2G
|
896 |
|
|
( pgsz_m[2] & pgsz_m[1] & pgsz_m[0]) ; // 111 ; 16G
|
897 |
|
|
|
898 |
|
|
wire ifill_tlb_asi_m,dfill_tlb_asi_m ;
|
899 |
113 |
albert.wat |
dff_s #(2) idfill_stgm (
|
900 |
95 |
fafa1971 |
.din ({ifill_tlb_asi_e,dfill_tlb_asi_e}),
|
901 |
|
|
.q ({ifill_tlb_asi_m,dfill_tlb_asi_m}),
|
902 |
|
|
.clk (clk),
|
903 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
904 |
95 |
fafa1971 |
);
|
905 |
|
|
|
906 |
|
|
assign tlb_illgl_pgsz_m =
|
907 |
|
|
(ifill_tlb_asi_m | dfill_tlb_asi_m) & st_inst_vld_m & lsu_alt_space_m & illgl_pgsz_m ;
|
908 |
|
|
|
909 |
|
|
wire [8:0] early_ttype_m,early_ttype_g ;
|
910 |
|
|
wire early_trap_vld_m, early_trap_vld_g ;
|
911 |
|
|
assign early_trap_vld_m =
|
912 |
|
|
stdf_maddr_not_align | lddf_maddr_not_align |
|
913 |
|
|
mem_addr_not_align ;
|
914 |
|
|
|
915 |
|
|
wire lsu_tlu_misalign_addr_ldst_atm_m ;
|
916 |
|
|
assign lsu_tlu_misalign_addr_ldst_atm_m = early_trap_vld_m ;
|
917 |
|
|
|
918 |
|
|
// mux select order must be maintained
|
919 |
|
|
assign early_ttype_m[8:0] =
|
920 |
|
|
stdf_maddr_not_align ? 9'h036 :
|
921 |
|
|
lddf_maddr_not_align ? 9'h035 :
|
922 |
|
|
mem_addr_not_align ? 9'h034 : 9'hxxx ;
|
923 |
|
|
|
924 |
113 |
albert.wat |
dff_s #(10) etrp_stgg (
|
925 |
95 |
fafa1971 |
.din ({early_ttype_m[8:0],early_trap_vld_m}),
|
926 |
|
|
.q ({early_ttype_g[8:0],early_trap_vld_g}),
|
927 |
|
|
.clk (clk),
|
928 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
929 |
95 |
fafa1971 |
);
|
930 |
|
|
|
931 |
|
|
wire daccess_excptn_early_m, daccess_excptn_early_g ;
|
932 |
|
|
|
933 |
|
|
wire atm_access_w_nc_byp_m,atm_access_w_nc_byp_g ;
|
934 |
|
|
assign atm_access_w_nc_byp_m =
|
935 |
|
|
atomic_m & dtlb_bypass_m & (lsu_ldst_va_b39_m & ~pstate_am_m) ;
|
936 |
|
|
//Bug 5050
|
937 |
|
|
|
938 |
113 |
albert.wat |
dff_s atmbyp_stgg (
|
939 |
95 |
fafa1971 |
.din (atm_access_w_nc_byp_m),
|
940 |
|
|
.q (atm_access_w_nc_byp_g),
|
941 |
|
|
.clk (clk),
|
942 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
943 |
95 |
fafa1971 |
);
|
944 |
|
|
|
945 |
|
|
assign daccess_excptn_early_m =
|
946 |
|
|
asi_related_trap_m | tlb_daccess_excptn_m |
|
947 |
|
|
spv_use_hpv_m |
|
948 |
|
|
atm_access_w_nc_byp_m ; // Bug 4281.
|
949 |
|
|
|
950 |
113 |
albert.wat |
dff_s #(1) dearly_stgg (
|
951 |
95 |
fafa1971 |
.din (daccess_excptn_early_m),
|
952 |
|
|
.q (daccess_excptn_early_g),
|
953 |
|
|
.clk (clk),
|
954 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
955 |
95 |
fafa1971 |
);
|
956 |
|
|
|
957 |
|
|
wire daccess_excptn;
|
958 |
|
|
|
959 |
|
|
assign daccess_excptn =
|
960 |
|
|
(priv_pg_usr_mode | as_if_usr_priv_pg | nfo_pg_nonnfo_asi |
|
961 |
|
|
atm_access_w_nc ) & tlb_tte_vld_g |
|
962 |
|
|
illegal_asi_trap_g | daccess_excptn_early_g | atm_access_unsup_asi | //bug4622
|
963 |
|
|
spec_access_epage ;
|
964 |
|
|
|
965 |
|
|
wire [3:0] lsu_nceen_d1;
|
966 |
113 |
albert.wat |
dff_s #(4) nceen_d1_ff (
|
967 |
95 |
fafa1971 |
.din (ifu_lsu_nceen[3:0]),
|
968 |
|
|
.q (lsu_nceen_d1[3:0]),
|
969 |
|
|
.clk (clk),
|
970 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
971 |
95 |
fafa1971 |
);
|
972 |
|
|
|
973 |
|
|
wire nceen_pipe_g ;
|
974 |
|
|
assign nceen_pipe_g =
|
975 |
|
|
(thread0_g & lsu_nceen_d1[0]) | (thread1_g & lsu_nceen_d1[1]) |
|
976 |
|
|
(thread2_g & lsu_nceen_d1[2]) | (thread3_g & lsu_nceen_d1[3]) ;
|
977 |
|
|
|
978 |
|
|
// correctible dtlb data parity error on cam will cause dmmu miss.
|
979 |
|
|
// prefetch will rely on the ld_inst_vld/st_inst_vld not being asserted
|
980 |
|
|
// to prevent mmu_miss from being signalled if prefetch does not translate.
|
981 |
|
|
// Timing Change : Remove data perror from dmmu_miss ; to be treated as disrupting trap.
|
982 |
|
|
wire dmmu_miss_m, dmmu_miss_m_d1;
|
983 |
|
|
|
984 |
|
|
assign dmmu_miss_m =
|
985 |
|
|
~tlb_cam_hit & ~dtlb_bypass_m &
|
986 |
|
|
(ld_inst_vld_m | st_inst_vld_m) &
|
987 |
|
|
~(lda_internal_m | sta_internal_m | early_trap_vld_m) ;
|
988 |
|
|
|
989 |
113 |
albert.wat |
dff_s #(1) dmmu_miss_stgg (
|
990 |
95 |
fafa1971 |
.din (dmmu_miss_m),
|
991 |
|
|
.q (dmmu_miss_m_d1),
|
992 |
|
|
.clk (clk),
|
993 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
994 |
95 |
fafa1971 |
);
|
995 |
|
|
//need lsu_inst_vld_w ??
|
996 |
|
|
wire dmmu_miss_g;
|
997 |
|
|
|
998 |
|
|
assign dmmu_miss_g = dmmu_miss_m_d1 & lsu_inst_vld_w;
|
999 |
|
|
|
1000 |
|
|
|
1001 |
|
|
wire [8:0] dmiss_type ;
|
1002 |
|
|
wire cam_real_g;
|
1003 |
|
|
|
1004 |
113 |
albert.wat |
dff_s #(1) cam_real_stgg (
|
1005 |
95 |
fafa1971 |
.din (cam_real_m),
|
1006 |
|
|
.q (cam_real_g),
|
1007 |
|
|
.clk (clk),
|
1008 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
1009 |
95 |
fafa1971 |
);
|
1010 |
|
|
assign dmiss_type[8:0] = cam_real_g ? 9'h03f : 9'h068 ;
|
1011 |
|
|
|
1012 |
|
|
// two wtchpt matches
|
1013 |
|
|
//assign lsu_tlu_ttype_m2[8:0] =
|
1014 |
|
|
// early_trap_vld_g ? early_ttype_g[8:0] :
|
1015 |
|
|
// priv_action ? 9'h037 :
|
1016 |
|
|
// va_wtchpt_match ? 9'h062 :
|
1017 |
|
|
// daccess_excptn ? 9'h030 :
|
1018 |
|
|
// dmmu_miss_g ? dmiss_type[8:0] : // dmmu_miss
|
1019 |
|
|
// daccess_error ? 9'h032 :
|
1020 |
|
|
// daccess_prot ? 9'h06c :
|
1021 |
|
|
// spubyp_trap_active_g ? {3'b000,spubyp_ttype[5:0]} : // should be no other tttype to compare to.
|
1022 |
|
|
// 9'bx_xxxx_xxxx ;
|
1023 |
|
|
|
1024 |
|
|
wire early_trap_vld_sel, priv_action_sel, va_wtchpt_match_sel, daccess_excptn_sel, dmmu_miss_sel,
|
1025 |
|
|
daccess_prot_sel ;
|
1026 |
|
|
|
1027 |
|
|
// Need to maintain this order in selects. Based on priority of traps
|
1028 |
|
|
assign early_trap_vld_sel = early_trap_vld_g;
|
1029 |
|
|
assign priv_action_sel = ~early_trap_vld_sel & priv_action;
|
1030 |
|
|
assign va_wtchpt_match_sel = ~early_trap_vld_sel & ~priv_action_sel & va_wtchpt_match;
|
1031 |
|
|
assign daccess_excptn_sel = ~early_trap_vld_sel & ~priv_action_sel & ~va_wtchpt_match_sel &
|
1032 |
|
|
daccess_excptn;
|
1033 |
|
|
assign dmmu_miss_sel = ~early_trap_vld_sel & ~priv_action_sel & ~va_wtchpt_match_sel &
|
1034 |
|
|
~daccess_excptn_sel & dmmu_miss_g;
|
1035 |
|
|
|
1036 |
|
|
assign daccess_prot_sel = ~early_trap_vld_sel & ~priv_action_sel & ~va_wtchpt_match_sel &
|
1037 |
|
|
~daccess_excptn_sel & ~dmmu_miss_sel & daccess_prot;
|
1038 |
|
|
|
1039 |
|
|
assign lsu_tlu_ttype_m2[8:0] =
|
1040 |
|
|
({9{early_trap_vld_sel}} & early_ttype_g[8:0]) |
|
1041 |
|
|
({9{priv_action_sel}} & 9'h037 ) |
|
1042 |
|
|
({9{va_wtchpt_match_sel}} & 9'h062 ) |
|
1043 |
|
|
({9{daccess_excptn_sel}} & 9'h030 ) |
|
1044 |
|
|
({9{dmmu_miss_sel}} & dmiss_type[8:0] ) |
|
1045 |
|
|
({9{daccess_prot_sel}} & 9'h06c ) ;
|
1046 |
|
|
|
1047 |
|
|
assign lsu_tlu_ttype_vld_m2 = dmmu_miss_g | daccess_excptn | daccess_prot |
|
1048 |
|
|
priv_action | early_trap_vld_g |
|
1049 |
|
|
va_wtchpt_match ;
|
1050 |
|
|
|
1051 |
|
|
assign lsu_ttype_vld_m2 = lsu_tlu_ttype_vld_m2 | defr_trp_taken ; //to stb_rwctl
|
1052 |
|
|
|
1053 |
|
|
assign lsu_ttype_vld_m2_bf1 = lsu_ttype_vld_m2; //to dctl, qctl1
|
1054 |
|
|
|
1055 |
|
|
wire squash_priority_g ; // Bug 4678
|
1056 |
|
|
assign squash_priority_g = priv_action | early_trap_vld_g | va_wtchpt_match ;
|
1057 |
|
|
|
1058 |
|
|
assign lsu_tlu_dmmu_miss_g = dmmu_miss_g & ~squash_priority_g ;
|
1059 |
|
|
assign lsu_tlu_priv_violtn_g = (priv_pg_usr_mode | as_if_usr_priv_pg) & tlb_tte_vld_g ;
|
1060 |
|
|
wire dmmu_va_oor_g ;
|
1061 |
|
|
assign lsu_tlu_daccess_excptn_g =
|
1062 |
|
|
(daccess_excptn | dmmu_va_oor_g // Bug 5036
|
1063 |
|
|
| tlu_priv_trap_g) & ~squash_priority_g ;
|
1064 |
|
|
|
1065 |
|
|
// prioritize daccess_excptn higher than daccess_prot. This may
|
1066 |
|
|
// be a critical path which needs to be resolved -> qual. now
|
1067 |
|
|
// in mmu.
|
1068 |
|
|
//assign lsu_tlu_daccess_prot_g = daccess_prot ;
|
1069 |
|
|
wire daccess_prot_g;
|
1070 |
|
|
assign daccess_prot_g = daccess_prot &
|
1071 |
|
|
~(tlu_priv_trap_g | daccess_excptn | squash_priority_g) ;
|
1072 |
|
|
assign lsu_tlu_daccess_prot_g = daccess_prot & ~squash_priority_g ; // Bug 5336.
|
1073 |
|
|
assign lsu_tlu_priv_action_g = priv_action ;
|
1074 |
|
|
//assign lsu_tlu_tte_ebit_g = tlb_rd_tte_data_ebit & tlb_tte_vld_g ;
|
1075 |
|
|
wire lsu_tlu_tte_ebit_g;
|
1076 |
|
|
assign lsu_tlu_tte_ebit_g = pg_with_ebit ;
|
1077 |
|
|
//assign lsu_tlu_spec_access_epage_g = spec_access_epage & tlb_tte_vld_g ; // page with side effects
|
1078 |
|
|
wire lsu_tlu_spec_access_epage_g ;
|
1079 |
|
|
assign lsu_tlu_spec_access_epage_g = spec_access_epage ; // page with side effects
|
1080 |
|
|
wire lsu_tlu_uncache_atomic_g;
|
1081 |
|
|
assign lsu_tlu_uncache_atomic_g =
|
1082 |
|
|
(atm_access_w_nc & tlb_tte_vld_g) |
|
1083 |
|
|
(atm_access_w_nc_byp_g) ;
|
1084 |
|
|
// Define illegal asi actions
|
1085 |
|
|
// see sfsr description - excludes cases where 02 and 04 are set for ftype !!!
|
1086 |
|
|
wire lsu_tlu_flt_ld_nfo_pg_g;
|
1087 |
|
|
assign lsu_tlu_flt_ld_nfo_pg_g = nfo_pg_nonnfo_asi & tlb_tte_vld_g ;
|
1088 |
|
|
|
1089 |
|
|
wire illgl_asi_action_pre_m,illgl_asi_action_pre_g ;
|
1090 |
|
|
assign illgl_asi_action_pre_m = asi_related_trap_m | tlb_daccess_excptn_m | illegal_asi_trap_m | spv_use_hpv_m ; // bug 4181; //bug3660
|
1091 |
|
|
|
1092 |
113 |
albert.wat |
dff_s illglasi_g (
|
1093 |
95 |
fafa1971 |
.din (illgl_asi_action_pre_m),
|
1094 |
|
|
.q (illgl_asi_action_pre_g),
|
1095 |
|
|
.clk (clk),
|
1096 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
1097 |
95 |
fafa1971 |
);
|
1098 |
|
|
|
1099 |
|
|
wire lsu_tlu_illegal_asi_action_g;
|
1100 |
|
|
assign lsu_tlu_illegal_asi_action_g =
|
1101 |
|
|
atm_access_unsup_asi | (illgl_asi_action_pre_g) & // Bug 4825
|
1102 |
|
|
~(lsu_tlu_spec_access_epage_g | lsu_tlu_uncache_atomic_g) ;
|
1103 |
|
|
//(illgl_asi_action_pre_g | (atm_access_unsup_asi)) &
|
1104 |
|
|
//~(lsu_tlu_spec_access_epage_g | lsu_tlu_uncache_atomic_g) ;
|
1105 |
|
|
|
1106 |
|
|
//=========================================================================================
|
1107 |
|
|
// Generate Flush Pipe
|
1108 |
|
|
//=========================================================================================
|
1109 |
|
|
|
1110 |
|
|
|
1111 |
|
|
assign other_flush_pipe_w =
|
1112 |
|
|
tlu_early_flush_pipe_w | (lsu_tlu_ttype_vld_m2 & lsu_inst_vld_w) |
|
1113 |
|
|
defr_trp_taken ; // deferred trap.
|
1114 |
|
|
assign lsu_ifu_flush_pipe_w = other_flush_pipe_w ;
|
1115 |
|
|
assign lsu_exu_flush_pipe_w = other_flush_pipe_w ;
|
1116 |
|
|
assign lsu_mmu_flush_pipe_w = other_flush_pipe_w ;
|
1117 |
|
|
assign lsu_ffu_flush_pipe_w = other_flush_pipe_w ;
|
1118 |
|
|
|
1119 |
|
|
|
1120 |
|
|
assign lsu_flush_pipe_w = other_flush_pipe_w | ifu_lsu_flush_w ;
|
1121 |
|
|
|
1122 |
|
|
//assign lsu_qctl1_flush_pipe_w = lsu_flush_pipe_w ;
|
1123 |
|
|
//assign lsu_stbctl_flush_pipe_w = lsu_flush_pipe_w ;
|
1124 |
|
|
//assign lsu_stbrwctl_flush_pipe_w = lsu_flush_pipe_w ;
|
1125 |
|
|
|
1126 |
|
|
//=========================================================================================
|
1127 |
|
|
// Early Traps to SPU
|
1128 |
|
|
//=========================================================================================
|
1129 |
|
|
|
1130 |
|
|
// detect st to ma/strm sync - data-access exception.
|
1131 |
|
|
//wire st_to_sync_dexcp_m ;
|
1132 |
|
|
// qual with alt_space not required - spu will do it.
|
1133 |
|
|
//assign st_to_sync_dexcp_m = // Bug 5704
|
1134 |
|
|
//strm_asi_m & ((lsu_ldst_va_m[7:0] == 8'ha0) | (lsu_ldst_va_m[7:0] == 8'h68)) & st_inst_vld_m ;
|
1135 |
|
|
|
1136 |
|
|
wire early_flush_m ;
|
1137 |
|
|
|
1138 |
|
|
assign early_flush_m =
|
1139 |
|
|
(atomic_m & lsu_alt_space_m) | // Bug 4650 - alt-space atomics should flush.
|
1140 |
|
|
priv_action_m |
|
1141 |
|
|
early_trap_vld_m | // mem-addr-not-aligned.
|
1142 |
|
|
illegal_asi_trap_m | // for fp non use of internal asi.
|
1143 |
|
|
//st_to_sync_dexcp_m | // Bug 5742
|
1144 |
|
|
//wr_to_strm_sync_m | // Bug 5890 - redundant - make room.
|
1145 |
|
|
defr_trp_taken_m_din | // Bug 5890
|
1146 |
|
|
daccess_excptn_early_m ;
|
1147 |
|
|
/*asi_related_trap_m | // Bug 2592
|
1148 |
|
|
spv_use_hpv_m |
|
1149 |
|
|
wr_to_strm_sync_m;*/
|
1150 |
|
|
|
1151 |
|
|
|
1152 |
113 |
albert.wat |
dff_s eflushspu_g (
|
1153 |
95 |
fafa1971 |
.din (early_flush_m),
|
1154 |
|
|
.q (lsu_spu_early_flush_g),
|
1155 |
|
|
.clk (clk),
|
1156 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
1157 |
95 |
fafa1971 |
);
|
1158 |
|
|
|
1159 |
113 |
albert.wat |
dff_s eflushspu2_g (
|
1160 |
95 |
fafa1971 |
.din (early_flush_m),
|
1161 |
|
|
.q (lsu_local_early_flush_g),
|
1162 |
|
|
.clk (clk),
|
1163 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
1164 |
95 |
fafa1971 |
);
|
1165 |
|
|
|
1166 |
113 |
albert.wat |
dff_s eflushtlu_g (
|
1167 |
95 |
fafa1971 |
.din (early_flush_m),
|
1168 |
|
|
.q (lsu_tlu_early_flush_w),
|
1169 |
|
|
.clk (clk),
|
1170 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
1171 |
95 |
fafa1971 |
);
|
1172 |
|
|
|
1173 |
113 |
albert.wat |
dff_s eflushtlu2_g (
|
1174 |
95 |
fafa1971 |
.din (early_flush_m),
|
1175 |
|
|
.q (lsu_tlu_early_flush2_w),
|
1176 |
|
|
.clk (clk),
|
1177 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
1178 |
95 |
fafa1971 |
);
|
1179 |
|
|
|
1180 |
|
|
|
1181 |
|
|
//=========================================================================================
|
1182 |
|
|
// Parity Error Checking
|
1183 |
|
|
//=========================================================================================
|
1184 |
|
|
|
1185 |
|
|
// DTLB Parity Errors.
|
1186 |
|
|
// ASI read of Tag/Data :
|
1187 |
|
|
// - uncorrectible error
|
1188 |
|
|
// - logging occurs on read.
|
1189 |
|
|
// - precise trap is taken when ldxa completes if nceen set.
|
1190 |
|
|
// - if not set then ldxa is allowed to complete.
|
1191 |
|
|
// CAM Read of Tag/Data :
|
1192 |
|
|
// - correctible if locked bit not set.
|
1193 |
|
|
// - takes disrupting trap later.
|
1194 |
|
|
// - uncorrectible if locked bit set.
|
1195 |
|
|
// - both are treated as precise traps.
|
1196 |
|
|
// - if errors not enabled, then load completes as if hit in L1.
|
1197 |
|
|
// ** TLB error will cause a trap which will preclude concurrent dcache,dtag **
|
1198 |
|
|
// ** parity errors. **
|
1199 |
|
|
|
1200 |
|
|
// cam related tte data parity error - error assumed correctible if locked
|
1201 |
|
|
// bit is not set. Will cause a dmmu_miss for correction.
|
1202 |
|
|
// qualify with cam_hit ??
|
1203 |
|
|
wire tte_data_perror_unc ;
|
1204 |
|
|
|
1205 |
|
|
assign lsu_tlb_perr_ld_rq_kill_w =
|
1206 |
|
|
//tte_data_perror_corr | (tte_data_perror_unc & nceen_pipe_g) ;
|
1207 |
|
|
(tte_data_perror_unc & nceen_pipe_g) ;
|
1208 |
|
|
|
1209 |
|
|
// correctible dtlb errors no longer supported.
|
1210 |
|
|
/*assign tte_data_perror_corr =
|
1211 |
|
|
tte_data_parity_error & ~tlb_rd_tte_data_locked & tlb_tte_vld_g &
|
1212 |
|
|
(ld_inst_vld_unflushed | st_inst_vld_unflushed) & lsu_inst_vld_w ;*/
|
1213 |
|
|
|
1214 |
|
|
// caused for both locked and unlocked entries.
|
1215 |
|
|
assign tte_data_perror_unc =
|
1216 |
|
|
//tte_data_parity_error & tlb_rd_tte_data_locked & tlb_tte_vld_g &
|
1217 |
|
|
tte_data_parity_error & tlb_tte_vld_g &
|
1218 |
|
|
(ld_inst_vld_unflushed | st_inst_vld_unflushed) & lsu_inst_vld_w &
|
1219 |
|
|
~lsu_flush_pipe_w ;
|
1220 |
|
|
|
1221 |
|
|
// Asi rd parity error detection
|
1222 |
|
|
wire asi_tte_data_perror,asi_tte_tag_perror ;
|
1223 |
|
|
|
1224 |
|
|
assign asi_tte_data_perror =
|
1225 |
|
|
tte_data_parity_error & data_rd_vld_g ;
|
1226 |
|
|
// For data tte read, both tag and data arrays are read.
|
1227 |
|
|
// Parity error on asi read of tag should not be reported.
|
1228 |
|
|
assign asi_tte_tag_perror =
|
1229 |
|
|
tte_tag_parity_error & tag_rd_vld_g & ~data_rd_vld_g ;
|
1230 |
|
|
|
1231 |
|
|
wire st_dtlb_perror ;
|
1232 |
|
|
assign st_dtlb_perror = tte_data_parity_error & tlb_tte_vld_g &
|
1233 |
|
|
st_inst_vld_unflushed & lsu_inst_vld_w ;
|
1234 |
|
|
// ~lsu_flush_pipe_w ;
|
1235 |
|
|
|
1236 |
|
|
wire cancel_err_flush ;
|
1237 |
|
|
assign cancel_err_flush = // Bug 5165
|
1238 |
|
|
((priv_pg_usr_mode | nfo_pg_nonnfo_asi |
|
1239 |
|
|
atm_access_w_nc) & tlb_tte_vld_g) | // bug6052/eco6620
|
1240 |
|
|
spec_access_epage |
|
1241 |
|
|
nonwr_pg_st_access ;
|
1242 |
|
|
|
1243 |
|
|
// Bug 6877
|
1244 |
|
|
wire squash_err ;
|
1245 |
|
|
assign squash_err =
|
1246 |
|
|
// assume always higher priority. BE - share common terms elsewhere.
|
1247 |
|
|
tlu_early_flush_pipe_w | defr_trp_taken | ifu_lsu_flush_w |
|
1248 |
|
|
// isolate to daccess_excptn/daccess_prot as per Bug 5165.
|
1249 |
|
|
(lsu_tlu_ttype_vld_m2 & ~(daccess_excptn_sel | daccess_prot_sel)) |
|
1250 |
|
|
((daccess_excptn_sel | daccess_prot_sel) & ~cancel_err_flush) ;
|
1251 |
|
|
|
1252 |
|
|
wire tlb_data_su_g ;
|
1253 |
|
|
assign tlb_data_su_g = st_dtlb_perror & ~atomic_g &
|
1254 |
|
|
~squash_err ;
|
1255 |
|
|
//~(lsu_flush_pipe_w & ~cancel_err_flush) ; // Bug 6877
|
1256 |
|
|
|
1257 |
|
|
wire ld_dtlb_perror ;
|
1258 |
|
|
assign ld_dtlb_perror = tte_data_parity_error & tlb_tte_vld_g &
|
1259 |
|
|
ld_inst_vld_unflushed & lsu_inst_vld_w &
|
1260 |
|
|
~squash_err ;
|
1261 |
|
|
|
1262 |
|
|
wire tlb_data_ue_g ;
|
1263 |
|
|
assign tlb_data_ue_g =
|
1264 |
|
|
ld_dtlb_perror | // synchronous to pipe - xslate ; ue is for ld now.
|
1265 |
|
|
lsu_tlb_asi_data_perr_g ; // asychronous to pipe - asi rd
|
1266 |
|
|
|
1267 |
|
|
/* Simplify for Bug 5888.
|
1268 |
|
|
wire st_noatom_dtlb_perr ; // atomics not represented.
|
1269 |
|
|
assign st_noatom_dtlb_perr = st_dtlb_perror & ~lsu_flush_pipe_w & ~atomic_g ;
|
1270 |
|
|
wire st_noatom_dtlb_perr_en ;
|
1271 |
|
|
assign st_noatom_dtlb_perr_en = st_noatom_dtlb_perr & nceen_pipe_g ; */
|
1272 |
|
|
wire st_noatom_dtlb_perr_en ;
|
1273 |
|
|
wire st_dtlb_perr_en ;
|
1274 |
|
|
assign st_noatom_dtlb_perr_en = st_dtlb_perr_en & ~atomic_g ;
|
1275 |
|
|
|
1276 |
|
|
// rm corr err. reporting
|
1277 |
113 |
albert.wat |
dff_s #(3) terr_stgd1 (
|
1278 |
95 |
fafa1971 |
.din ({tlb_data_su_g,tlb_data_ue_g,lsu_tlb_asi_tag_perr_g}),
|
1279 |
|
|
//.din ({st_noatom_dtlb_perr,tlb_data_ue_g,lsu_tlb_asi_tag_perr_g}),
|
1280 |
|
|
.q ({lsu_ifu_tlb_data_su,lsu_ifu_tlb_data_ue,lsu_ifu_tlb_tag_ue}),
|
1281 |
|
|
.clk (clk),
|
1282 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
1283 |
95 |
fafa1971 |
);
|
1284 |
|
|
|
1285 |
|
|
// If st dtlb parity error detected, then need to invalidate st in stb.
|
1286 |
|
|
// Considered unrecoverable for the thread itself.
|
1287 |
|
|
|
1288 |
|
|
assign st_dtlb_perr_en = st_dtlb_perror & ~lsu_flush_pipe_w & nceen_pipe_g ;
|
1289 |
|
|
|
1290 |
|
|
// Kill will happen for atomics also.
|
1291 |
|
|
//assign lsu_exu_st_dtlb_perr_g = st_dtlb_perr_en ;
|
1292 |
|
|
assign lsu_exu_st_dtlb_perr_g = st_noatom_dtlb_perr_en ; // Bug 5888
|
1293 |
|
|
|
1294 |
|
|
assign lsu_ffu_st_dtlb_perr_g = st_noatom_dtlb_perr_en ; // Bug 5910/ECO 6529
|
1295 |
|
|
|
1296 |
|
|
assign lsu_st_dtlb_perr_g[0] = st_dtlb_perr_en & thread0_g ;
|
1297 |
|
|
assign lsu_st_dtlb_perr_g[1] = st_dtlb_perr_en & thread1_g ;
|
1298 |
|
|
assign lsu_st_dtlb_perr_g[2] = st_dtlb_perr_en & thread2_g ;
|
1299 |
|
|
assign lsu_st_dtlb_perr_g[3] = st_dtlb_perr_en & thread3_g ;
|
1300 |
|
|
|
1301 |
|
|
//==========================================================================
|
1302 |
|
|
// DEFERRED TRAP DUE TO STORE
|
1303 |
|
|
//==========================================================================
|
1304 |
|
|
|
1305 |
|
|
// Cases :
|
1306 |
|
|
// defr_trp_m=1,ifu_flush_w=0.
|
1307 |
|
|
// - defr_trp is generated.
|
1308 |
|
|
// - next inst will not take redundant deferred trap as
|
1309 |
|
|
// its inst_vld will be annulled by trap flush.
|
1310 |
|
|
// defr_trp_m=1,ifu_flush_w=1.
|
1311 |
|
|
// - defr_trp is generated. TLU annuls.
|
1312 |
|
|
// - Other units see redundant defr_trp flush ORed with ifu_flush_w.
|
1313 |
|
|
// - next inst will not take redundant deferred trap as
|
1314 |
|
|
// its inst_vld will be annulled by ifu_flush_w .
|
1315 |
|
|
|
1316 |
|
|
|
1317 |
|
|
// Log Deferred trap. Take on next available inst from thread.
|
1318 |
|
|
// Inst vld must be qualified with flush.
|
1319 |
|
|
|
1320 |
|
|
wire st_defr_trp_en0,st_defr_trp_en1,st_defr_trp_en2,st_defr_trp_en3 ;
|
1321 |
|
|
wire st_defr_trp0,st_defr_trp1,st_defr_trp2,st_defr_trp3 ;
|
1322 |
|
|
|
1323 |
|
|
assign st_defr_trp_en0 = st_noatom_dtlb_perr_en & thread0_g ;
|
1324 |
|
|
assign st_defr_trp_en1 = st_noatom_dtlb_perr_en & thread1_g ;
|
1325 |
|
|
assign st_defr_trp_en2 = st_noatom_dtlb_perr_en & thread2_g ;
|
1326 |
|
|
assign st_defr_trp_en3 = st_noatom_dtlb_perr_en & thread3_g ;
|
1327 |
|
|
|
1328 |
|
|
wire stpend_rst0_m,stpend_rst1_m,stpend_rst2_m,stpend_rst3_m;
|
1329 |
|
|
wire stpend_rst0_w,stpend_rst1_w,stpend_rst2_w,stpend_rst3_w;
|
1330 |
|
|
wire stpend_rst0,stpend_rst1,stpend_rst2,stpend_rst3;
|
1331 |
|
|
assign stpend_rst0_m = reset |
|
1332 |
|
|
((st_defr_trp0 | st_defr_trp_en0) & thread0_m & flush_w_inst_vld_m);
|
1333 |
|
|
assign stpend_rst1_m = reset |
|
1334 |
|
|
((st_defr_trp1 | st_defr_trp_en1) & thread1_m & flush_w_inst_vld_m);
|
1335 |
|
|
assign stpend_rst2_m = reset |
|
1336 |
|
|
((st_defr_trp2 | st_defr_trp_en2) & thread2_m & flush_w_inst_vld_m);
|
1337 |
|
|
assign stpend_rst3_m = reset |
|
1338 |
|
|
((st_defr_trp3 | st_defr_trp_en3) & thread3_m & flush_w_inst_vld_m);
|
1339 |
|
|
|
1340 |
|
|
// Postphone reset by a cycle - 4916
|
1341 |
113 |
albert.wat |
dff_s #(4) stpend_d1 (
|
1342 |
95 |
fafa1971 |
.din ({stpend_rst3_m,stpend_rst2_m,stpend_rst1_m,stpend_rst0_m}),
|
1343 |
|
|
.q ({stpend_rst3_w,stpend_rst2_w,stpend_rst1_w,stpend_rst0_w}),
|
1344 |
|
|
.clk (clk),
|
1345 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
1346 |
95 |
fafa1971 |
);
|
1347 |
|
|
|
1348 |
|
|
// Prevent reset if inst is flushed by ifu.
|
1349 |
|
|
assign stpend_rst3 = stpend_rst3_w & ~ifu_lsu_flush_w ;
|
1350 |
|
|
assign stpend_rst2 = stpend_rst2_w & ~ifu_lsu_flush_w ;
|
1351 |
|
|
assign stpend_rst1 = stpend_rst1_w & ~ifu_lsu_flush_w ;
|
1352 |
|
|
assign stpend_rst0 = stpend_rst0_w & ~ifu_lsu_flush_w ;
|
1353 |
|
|
|
1354 |
113 |
albert.wat |
dffre_s #(1) deftrp_t0 (
|
1355 |
95 |
fafa1971 |
.din (st_defr_trp_en0),
|
1356 |
|
|
.q (st_defr_trp0),
|
1357 |
|
|
.rst (stpend_rst0),
|
1358 |
|
|
.en (st_defr_trp_en0),
|
1359 |
|
|
.clk (clk),
|
1360 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
1361 |
95 |
fafa1971 |
);
|
1362 |
|
|
|
1363 |
113 |
albert.wat |
dffre_s #(1) deftrp_t1 (
|
1364 |
95 |
fafa1971 |
.din (st_defr_trp_en1),
|
1365 |
|
|
.q (st_defr_trp1),
|
1366 |
|
|
.rst (stpend_rst1),
|
1367 |
|
|
.en (st_defr_trp_en1),
|
1368 |
|
|
.clk (clk),
|
1369 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
1370 |
95 |
fafa1971 |
);
|
1371 |
|
|
|
1372 |
113 |
albert.wat |
dffre_s #(1) deftrp_t2 (
|
1373 |
95 |
fafa1971 |
.din (st_defr_trp_en2),
|
1374 |
|
|
.q (st_defr_trp2),
|
1375 |
|
|
.rst (stpend_rst2),
|
1376 |
|
|
.en (st_defr_trp_en2),
|
1377 |
|
|
.clk (clk),
|
1378 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
1379 |
95 |
fafa1971 |
);
|
1380 |
|
|
|
1381 |
113 |
albert.wat |
dffre_s #(1) deftrp_t3 (
|
1382 |
95 |
fafa1971 |
.din (st_defr_trp_en3),
|
1383 |
|
|
.q (st_defr_trp3),
|
1384 |
|
|
.rst (stpend_rst3),
|
1385 |
|
|
.en (st_defr_trp_en3),
|
1386 |
|
|
.clk (clk),
|
1387 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
1388 |
95 |
fafa1971 |
);
|
1389 |
|
|
|
1390 |
|
|
// Deferred trap can be taken on any instruction.
|
1391 |
|
|
// Selection is based on next thread available.
|
1392 |
|
|
|
1393 |
|
|
//instruction n+2, and the following...
|
1394 |
|
|
|
1395 |
|
|
assign defr_trp_taken_m =
|
1396 |
|
|
//ifu_tlu_inst_vld_m & (
|
1397 |
|
|
flush_w_inst_vld_m & ( // <= rely of flush by defr-trp to clear
|
1398 |
|
|
// pended defr-trp
|
1399 |
|
|
(st_defr_trp0 & thread0_m) |
|
1400 |
|
|
(st_defr_trp1 & thread1_m) |
|
1401 |
|
|
(st_defr_trp2 & thread2_m) |
|
1402 |
|
|
(st_defr_trp3 & thread3_m)) ;
|
1403 |
|
|
|
1404 |
|
|
assign defr_trp_taken_byp =
|
1405 |
|
|
//ifu_tlu_inst_vld_m & (
|
1406 |
|
|
flush_w_inst_vld_m & (
|
1407 |
|
|
(st_defr_trp_en0 & thread0_m) |
|
1408 |
|
|
(st_defr_trp_en1 & thread1_m) |
|
1409 |
|
|
(st_defr_trp_en2 & thread2_m) |
|
1410 |
|
|
(st_defr_trp_en3 & thread3_m) );
|
1411 |
|
|
|
1412 |
|
|
|
1413 |
|
|
assign defr_trp_taken_m_din = defr_trp_taken_m | defr_trp_taken_byp;
|
1414 |
|
|
|
1415 |
113 |
albert.wat |
dff_s #(1) defr_trp_taken_stgg (
|
1416 |
95 |
fafa1971 |
.din (defr_trp_taken_m_din),
|
1417 |
|
|
.q (defr_trp_taken),
|
1418 |
|
|
.clk (clk),
|
1419 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
1420 |
95 |
fafa1971 |
);
|
1421 |
|
|
|
1422 |
|
|
assign lsu_defr_trp_taken_g = defr_trp_taken ;
|
1423 |
|
|
assign lsu_tlu_defr_trp_taken_g = defr_trp_taken ;
|
1424 |
|
|
assign lsu_mmu_defr_trp_taken_g = defr_trp_taken ;
|
1425 |
|
|
|
1426 |
|
|
//==========================================================================
|
1427 |
|
|
// DSFSR/SFAR WR
|
1428 |
|
|
//==========================================================================
|
1429 |
|
|
|
1430 |
|
|
|
1431 |
|
|
|
1432 |
|
|
wire [3:0] pstate_cle,pstate_am ;
|
1433 |
|
|
// flop'n use to prevent timing path.
|
1434 |
113 |
albert.wat |
dff_s #(8) cle_stg (
|
1435 |
95 |
fafa1971 |
.din ({tlu_lsu_pstate_cle[3:0],tlu_lsu_pstate_am[3:0]}),
|
1436 |
|
|
.q ({pstate_cle[3:0],pstate_am[3:0]}),
|
1437 |
|
|
.clk (clk),
|
1438 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
1439 |
95 |
fafa1971 |
);
|
1440 |
|
|
|
1441 |
|
|
wire pstate_cle_m ;
|
1442 |
|
|
assign pstate_cle_m =
|
1443 |
|
|
(thread0_m & pstate_cle[0]) |
|
1444 |
|
|
(thread1_m & pstate_cle[1]) |
|
1445 |
|
|
(thread2_m & pstate_cle[2]) |
|
1446 |
|
|
(thread3_m & pstate_cle[3]);
|
1447 |
|
|
|
1448 |
|
|
wire [3:0] dsfsr_asi_sel_m ;
|
1449 |
|
|
wire prim_asi_sel ;
|
1450 |
|
|
assign prim_asi_sel =
|
1451 |
|
|
exu_tlu_misalign_addr_jmpl_rtn_m | (lsu_tlu_nonalt_ldst_m & ~lsu_nonalt_nucl_access_m) ;
|
1452 |
|
|
assign dsfsr_asi_sel_m[0] = // ASI_PRIMARY
|
1453 |
|
|
prim_asi_sel & ~pstate_cle_m;
|
1454 |
|
|
// Does asi_primary_little make sense for jmpl/return ?
|
1455 |
|
|
assign dsfsr_asi_sel_m[1] = // ASI_PRIMARY_LITTLE
|
1456 |
|
|
prim_asi_sel & pstate_cle_m;
|
1457 |
|
|
assign dsfsr_asi_sel_m[2] = // ASI_NUCLEUS
|
1458 |
|
|
lsu_nonalt_nucl_access_m & ~pstate_cle_m;
|
1459 |
|
|
assign dsfsr_asi_sel_m[3] = // ASI_NUCLEUS_LITTLE
|
1460 |
|
|
lsu_nonalt_nucl_access_m & pstate_cle_m;
|
1461 |
|
|
/*assign dsfsr_asi_sel_m[4] = // assigned asi
|
1462 |
|
|
~(exu_tlu_misalign_addr_jmpl_rtn_m | lsu_tlu_nonalt_ldst_m);*/
|
1463 |
|
|
|
1464 |
|
|
wire [7:0] asi_state_g ;
|
1465 |
|
|
// flop'n use to prevent timing path.
|
1466 |
113 |
albert.wat |
dff_s #(8) asistate_stgg (
|
1467 |
95 |
fafa1971 |
.din (lsu_excpctl_asi_state_m[7:0]),
|
1468 |
|
|
.q (asi_state_g[7:0]),
|
1469 |
|
|
.clk (clk),
|
1470 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
1471 |
95 |
fafa1971 |
);
|
1472 |
|
|
|
1473 |
|
|
wire [7:0] dsfsr_asi_g ;
|
1474 |
|
|
wire [3:0] dsfsr_asi_sel_g ;
|
1475 |
|
|
|
1476 |
|
|
/*assign dsfsr_asi_g[7:0] =(dsfsr_asi_sel_g[0] ? 8'h80 : 8'h00) |
|
1477 |
|
|
(dsfsr_asi_sel_g[1] ? 8'h88 : 8'h00) |
|
1478 |
|
|
(dsfsr_asi_sel_g[2] ? asi_state_g[7:0] : 8'h00);*/
|
1479 |
|
|
// Bug 4212 - spec problem
|
1480 |
|
|
assign dsfsr_asi_g[7:0] =(dsfsr_asi_sel_g[0] ? 8'h80 :
|
1481 |
|
|
(dsfsr_asi_sel_g[1] ? 8'h88 :
|
1482 |
|
|
(dsfsr_asi_sel_g[2] ? 8'h04 :
|
1483 |
|
|
(dsfsr_asi_sel_g[3] ? 8'h0C : asi_state_g[7:0]))));
|
1484 |
|
|
|
1485 |
|
|
assign pstate_am_m =
|
1486 |
|
|
(thread0_m & pstate_am[0]) |
|
1487 |
|
|
(thread1_m & pstate_am[1]) |
|
1488 |
|
|
(thread2_m & pstate_am[2]) |
|
1489 |
|
|
(thread3_m & pstate_am[3]);
|
1490 |
|
|
|
1491 |
|
|
assign dmmu_va_oor_m = exu_tlu_va_oor_m & ~pstate_am_m & lsu_memref_m & ~lsu_squash_va_oor_m;
|
1492 |
|
|
|
1493 |
|
|
wire [3:0] dsfsr_flt_vld;
|
1494 |
113 |
albert.wat |
dff_s #(4) fltvld_stgd1 (
|
1495 |
95 |
fafa1971 |
.din (tlu_dsfsr_flt_vld[3:0]),
|
1496 |
|
|
.q (dsfsr_flt_vld[3:0]),
|
1497 |
|
|
.clk (clk),
|
1498 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
1499 |
95 |
fafa1971 |
);
|
1500 |
|
|
|
1501 |
|
|
wire dsfsr_flt_vld_m ;
|
1502 |
|
|
assign dsfsr_flt_vld_m =
|
1503 |
|
|
(thread0_m & dsfsr_flt_vld[0]) |
|
1504 |
|
|
(thread1_m & dsfsr_flt_vld[1]) |
|
1505 |
|
|
(thread2_m & dsfsr_flt_vld[2]) |
|
1506 |
|
|
(thread3_m & dsfsr_flt_vld[3]);
|
1507 |
|
|
|
1508 |
|
|
wire ldst_xslate_g,flsh_inst_g,dsfsr_flt_vld_g,dsfsr_wr_op_g ;
|
1509 |
|
|
wire misalign_addr_jmpl_rtn_g,misalign_addr_ldst_atm_g ;
|
1510 |
|
|
wire [2:0] dsfsr_ctxt_sel ;
|
1511 |
|
|
|
1512 |
|
|
// flop flt_vld and use
|
1513 |
113 |
albert.wat |
dff_s #(14) dsfsr_stgg (
|
1514 |
95 |
fafa1971 |
.din ({dsfsr_asi_sel_m[3:0],dmmu_va_oor_m,// memref_m,
|
1515 |
|
|
lsu_tlu_xslating_ldst_m,lsu_flsh_inst_m,lsu_tlu_ctxt_sel_m[2:0],
|
1516 |
|
|
dsfsr_flt_vld_m,lsu_tlu_write_op_m,exu_tlu_misalign_addr_jmpl_rtn_m,
|
1517 |
|
|
lsu_tlu_misalign_addr_ldst_atm_m}),
|
1518 |
|
|
.q ({dsfsr_asi_sel_g[3:0],dmmu_va_oor_g,ldst_xslate_g,// memref_g,
|
1519 |
|
|
flsh_inst_g,dsfsr_ctxt_sel[2:0],dsfsr_flt_vld_g, dsfsr_wr_op_g,
|
1520 |
|
|
misalign_addr_jmpl_rtn_g,misalign_addr_ldst_atm_g}),
|
1521 |
|
|
.clk (clk),
|
1522 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
1523 |
95 |
fafa1971 |
);
|
1524 |
|
|
|
1525 |
|
|
// To be set only for data_access_exception traps - only one can be
|
1526 |
|
|
// reported at any time.
|
1527 |
|
|
|
1528 |
|
|
wire [6:0] dsfsr_ftype_g ;
|
1529 |
|
|
assign dsfsr_ftype_g[6] = 1'b0;
|
1530 |
|
|
assign dsfsr_ftype_g[5] = dmmu_va_oor_g | lsu_tlu_wtchpt_trp_g;
|
1531 |
|
|
assign dsfsr_ftype_g[4] = lsu_tlu_flt_ld_nfo_pg_g;
|
1532 |
|
|
assign dsfsr_ftype_g[3] = lsu_tlu_illegal_asi_action_g
|
1533 |
|
|
| tlu_priv_trap_g ; // Bug 4799
|
1534 |
|
|
//assign dsfsr_ftype_g[3] = lsu_tlu_illegal_asi_action_g | tlu_mmu_sync_data_excp_g;
|
1535 |
|
|
assign dsfsr_ftype_g[2] = (lsu_tlu_uncache_atomic_g & ~atm_access_unsup_asi);
|
1536 |
|
|
assign dsfsr_ftype_g[1] = lsu_tlu_spec_access_epage_g;
|
1537 |
|
|
assign dsfsr_ftype_g[0] = lsu_tlu_priv_violtn_g;
|
1538 |
|
|
|
1539 |
|
|
wire dsfsr_side_effect_g ;
|
1540 |
|
|
assign dsfsr_side_effect_g = lsu_tlu_tte_ebit_g & (ldst_xslate_g | flsh_inst_g);
|
1541 |
|
|
|
1542 |
|
|
// Fault Type based on Priority Encoding of Traps
|
1543 |
|
|
wire [6:0] dsfsr_pe_ftype_g ;
|
1544 |
|
|
wire dsfsr_ftype_zero ;
|
1545 |
|
|
// Is this needed ? Doesn't it default to zero ?
|
1546 |
|
|
assign dsfsr_pe_ftype_g[6:0] = dsfsr_ftype_zero ? 7'h00 : dsfsr_ftype_g[6:0];
|
1547 |
|
|
|
1548 |
|
|
// set to 11 when the access does not have a translating asi.
|
1549 |
|
|
wire [1:0] dsfsr_ctxt_g ;
|
1550 |
|
|
assign dsfsr_ctxt_g[1:0] =
|
1551 |
|
|
dsfsr_ctxt_sel[0] ? 2'b00 :
|
1552 |
|
|
dsfsr_ctxt_sel[1] ? 2'b01 :
|
1553 |
|
|
dsfsr_ctxt_sel[2] ? 2'b10 : 2'b11;
|
1554 |
|
|
|
1555 |
|
|
|
1556 |
|
|
assign lsu_dsfsr_din_g[23:0] =
|
1557 |
|
|
{dsfsr_asi_g[7:0],
|
1558 |
|
|
2'b0,
|
1559 |
|
|
dsfsr_pe_ftype_g[6:0],
|
1560 |
|
|
dsfsr_side_effect_g,
|
1561 |
|
|
dsfsr_ctxt_g[1:0],
|
1562 |
|
|
1'b0, // Bug 3323 - Arch change
|
1563 |
|
|
//pstate_priv,
|
1564 |
|
|
dsfsr_wr_op_g, // pipe
|
1565 |
|
|
dsfsr_flt_vld_g,
|
1566 |
|
|
1'b1};
|
1567 |
|
|
|
1568 |
|
|
// This is going to be a critical path !!!
|
1569 |
|
|
// Assume that traps in front-end cause instructions to be no`oped
|
1570 |
|
|
// further down the pipeline. Thus there is no need to qualify writes
|
1571 |
|
|
// to dsfsr with writes to isfsr
|
1572 |
|
|
wire dsfsr_trp_wr_g ;
|
1573 |
|
|
wire dsfsr_trp_wr_pre_m,dsfsr_trp_wr_pre_g ;
|
1574 |
|
|
|
1575 |
|
|
|
1576 |
|
|
assign dsfsr_trp_wr_pre_m =
|
1577 |
|
|
spv_use_hpv_m | // Bug 3254 ; add new data-access-excp
|
1578 |
|
|
// spec_access_epage_m | // Bug 3515
|
1579 |
|
|
priv_action_m |
|
1580 |
|
|
exu_tlu_misalign_addr_jmpl_rtn_m |
|
1581 |
|
|
lsu_tlu_misalign_addr_ldst_atm_m ;
|
1582 |
|
|
|
1583 |
113 |
albert.wat |
dff_s dsfsrtrg_stgg (
|
1584 |
95 |
fafa1971 |
.din (dsfsr_trp_wr_pre_m),
|
1585 |
|
|
.q (dsfsr_trp_wr_pre_g),
|
1586 |
|
|
.clk (clk),
|
1587 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so ()
|
1588 |
95 |
fafa1971 |
);
|
1589 |
|
|
|
1590 |
|
|
assign dsfsr_trp_wr_g =
|
1591 |
|
|
((lsu_tlu_priv_violtn_g |
|
1592 |
|
|
lsu_tlu_spec_access_epage_g | // Bug 3515 - uncomment out.
|
1593 |
|
|
lsu_tlu_uncache_atomic_g | lsu_tlu_illegal_asi_action_g |
|
1594 |
|
|
lsu_tlu_flt_ld_nfo_pg_g | dmmu_va_oor_g) | // data access exceptions
|
1595 |
|
|
daccess_prot | // daccess_excptn not excluded.
|
1596 |
|
|
lsu_tlu_wtchpt_trp_g | // watchpoint trap
|
1597 |
|
|
dsfsr_trp_wr_pre_g |
|
1598 |
|
|
tlu_priv_trap_g // scratchpad/queue daccess;Bug 4799
|
1599 |
|
|
) &
|
1600 |
|
|
lsu_inst_vld_w & ~(ifu_lsu_flush_w | defr_trp_taken) ; // Bug 4444,5196
|
1601 |
|
|
|
1602 |
|
|
assign dsfsr_ftype_zero =
|
1603 |
|
|
daccess_prot_g | lsu_tlu_priv_action_g | lsu_tlu_wtchpt_trp_g |
|
1604 |
|
|
misalign_addr_jmpl_rtn_g | misalign_addr_ldst_atm_g;
|
1605 |
|
|
|
1606 |
|
|
// terms below can be made common. (grape)
|
1607 |
|
|
assign lsu_dmmu_sfsr_trp_wr[0] = dsfsr_trp_wr_g & thread0_g;
|
1608 |
|
|
assign lsu_dmmu_sfsr_trp_wr[1] = dsfsr_trp_wr_g & thread1_g;
|
1609 |
|
|
assign lsu_dmmu_sfsr_trp_wr[2] = dsfsr_trp_wr_g & thread2_g;
|
1610 |
|
|
assign lsu_dmmu_sfsr_trp_wr[3] = dsfsr_trp_wr_g & thread3_g;
|
1611 |
|
|
|
1612 |
|
|
//==========================================================================
|
1613 |
|
|
// Exception Handling End
|
1614 |
|
|
//==========================================================================
|
1615 |
|
|
|
1616 |
|
|
endmodule // lsu_dctl1
|
1617 |
|
|
|