1 | // ========== Copyright Header Begin ========================================== |
---|
2 | // |
---|
3 | // OpenSPARC T1 Processor File: tlu_tcl.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: Trap Control Logic |
---|
24 | */ |
---|
25 | |
---|
26 | //////////////////////////////////////////////////////////////////////// |
---|
27 | // Local header file includes / local defines |
---|
28 | //////////////////////////////////////////////////////////////////////// |
---|
29 | `include "tlu.h" |
---|
30 | |
---|
31 | module tlu_tcl (/*AUTOARG*/ |
---|
32 | // Outputs |
---|
33 | tlu_ifu_trappc_vld_w1, tlu_ifu_trapnpc_vld_w1, tlu_ifu_trap_tid_w1, |
---|
34 | tlu_trap_hpstate_enb, tsa_wr_tpl, tsa_rd_tid, tsa_rd_tpl, tsa_rd_en, |
---|
35 | tsa_wr_tid, tsa_wr_vld, tsa_rd_vld_e, tlu_lsu_tl_zero, tlu_restore_pc_sel_w1, |
---|
36 | tlu_early_flush_pipe_w, tlu_early_flush_pipe2_w, tlu_exu_early_flush_pipe_w, |
---|
37 | tlu_agp_tid_w2, tsa_tstate_en, tsa_ttype_en, tlu_tl_gt_0_w2, |
---|
38 | tlu_exu_agp_tid, tlu_true_pc_sel_w, // tlu_retry_inst_m, tlu_done_inst_m, |
---|
39 | tlu_tick_en_l, tlu_tickcmp_en_l, tlu_stickcmp_en_l, tlu_local_flush_w, |
---|
40 | tlu_tba_en_l, tlu_thrd_wsel_w2, tlu_thread_wsel_g, tlu_final_ttype_w2, |
---|
41 | tlu_thread_inst_vld_g, tlu_update_pc_l_w, tlu_htickcmp_en_l, |
---|
42 | tsa_pc_en, tsa_npc_en, tlu_hyperv_rdpr_sel, tlu_wsr_inst_nq_g, |
---|
43 | tlu_exu_priv_trap_m, tlu_ibrkpt_trap_w2, tlu_full_flush_pipe_w2, |
---|
44 | tlu_pstate_din_sel0, tlu_pstate_din_sel1, tlu_pstate_din_sel2, |
---|
45 | tlu_pstate_din_sel3, tlu_update_pstate_l_w2, tlu_trp_lvl, |
---|
46 | tlu_pil, tlu_wr_tsa_inst_w2, tlu_trap_cwp_en, // tlu_lsu_priv_trap_w, |
---|
47 | tlu_exu_cwp_retry_m, tlu_exu_cwpccr_update_m, tlu_lsu_priv_trap_m, |
---|
48 | tlu_lsu_asi_update_m, tlu_lsu_tid_m, tlu_pc_mxsel_w2, // tlu_lsu_asi_m, |
---|
49 | tlu_select_tba_w2, tdp_select_tba_w2, tlu_set_sftint_l_g, |
---|
50 | tlu_clr_sftint_l_g, tlu_wr_sftint_l_g, tlu_sftint_mx_sel, tlu_itag_acc_sel_g, |
---|
51 | tlu_sftint_en_l_g, tlu_sftint_penc_sel, tlu_sftint_vld, tlu_int_tid_m, |
---|
52 | tlu_tickcmp_sel, tlu_incr_tick, immu_sfsr_trp_wr, tlu_select_redmode, |
---|
53 | tlu_isfsr_din_g, // tlu_dsfsr_din_g, tlu_tag_access_ctxt_sel_m, |
---|
54 | tlu_tick_npt, tlu_thrd_rsel_e, tlu_inst_vld_nq_m, tlu_pic_cnt_en_m, |
---|
55 | tlu_rdpr_mx1_sel, tlu_rdpr_mx2_sel, tlu_rdpr_mx3_sel, tlu_rdpr_mx4_sel, |
---|
56 | tlu_rdpr_mx5_sel, tlu_rdpr_mx6_sel, tlu_rdpr_mx7_sel, tlu_lsu_pstate_am, |
---|
57 | tlu_lsu_redmode_rst_d1, lsu_tlu_rsr_data_mod_e, tlu_addr_msk_g, |
---|
58 | // added for hypervisor support |
---|
59 | tlu_dnrtry0_inst_g, tlu_dnrtry1_inst_g, tlu_dnrtry2_inst_g, tlu_dnrtry3_inst_g, |
---|
60 | tlu_thrd_traps_w2, tlu_tick_ctl_din, tsa_htstate_en, tlu_por_rstint_g, |
---|
61 | tlu_hintp_vld, tlu_rerr_vld, tlu_final_offset_w1, // tlu_ifu_trapnpc_w2, |
---|
62 | so, tlu_sscan_tcl_data, tlu_rst, // tlu_ifu_trappc_w2, tlu_rst_l, |
---|
63 | // Inputs |
---|
64 | ifu_tlu_sraddr_d, ifu_tlu_rsr_inst_d, lsu_tlu_early_flush_w, ifu_tlu_pc_oor_e, |
---|
65 | tlu_wsr_data_b63_w, tlu_wsr_data_w, lsu_tlu_ttype_m2, ifu_tlu_flush_fd_w, |
---|
66 | lsu_tlu_ttype_vld_m2, ifu_tlu_done_inst_d, ifu_tlu_retry_inst_d, ifu_tlu_ttype_m, |
---|
67 | ifu_tlu_ttype_vld_m, exu_tlu_ttype_m, exu_tlu_ttype_vld_m, exu_tlu_spill, |
---|
68 | exu_tlu_spill_other, exu_tlu_spill_wtype, exu_tlu_va_oor_m, exu_tlu_spill_tid, |
---|
69 | ifu_tlu_sir_inst_m, ifu_tlu_inst_vld_m, ifu_tlu_thrid_d, tlu_tckctr_in, |
---|
70 | ifu_tlu_immu_miss_m, exu_tlu_va_oor_jl_ret_m, ifu_tlu_trap_m, lsu_tlu_wsr_inst_e, |
---|
71 | exu_tlu_cwp_cmplt, exu_tlu_cwp_retry, exu_tlu_cwp_cmplt_tid, exu_tlu_ue_trap_m, |
---|
72 | ifu_tlu_rstint_m, ifu_tlu_hwint_m, ifu_tlu_swint_m, pich_wrap_flg, tlu_pic_wrap_e, |
---|
73 | pich_onebelow_flg, pich_twobelow_flg, pib_picl_wrap, pib_pich_wrap, tlu_tcc_inst_w, |
---|
74 | int_tlu_rstid_m, tlu_int_pstate_ie, tlu_int_redmode, ifu_npc_w, tlu_pcr_ut, |
---|
75 | tlu_sftint_id, lsu_tlu_async_ttype_vld_g, lsu_tlu_defr_trp_taken_g, tlu_pcr_st, |
---|
76 | lsu_tlu_misalign_addr_ldst_atm_m, exu_tlu_misalign_addr_jmpl_rtn_m, |
---|
77 | lsu_tlu_async_tid_g, lsu_tlu_priv_action_g, lsu_tlu_async_ttype_g, lsu_tlu_wtchpt_trp_g, |
---|
78 | ifu_tlu_priv_violtn_m, ifu_lsu_memref_d, tlu_pstate_priv, tlu_isfsr_flt_vld, |
---|
79 | tlu_pstate_am, ffu_tlu_trap_ieee754, ffu_tlu_trap_other, ffu_tlu_trap_ue, |
---|
80 | ffu_ifu_tid_w2, ffu_tlu_ill_inst_m, ifu_tlu_npc_m, // ifu_tlu_pc_m, |
---|
81 | lsu_tlu_rsr_data_e, lsu_tlu_squash_va_oor_m, // tlu_restore_npc_w1, |
---|
82 | spu_tlu_rsrv_illgl_m, // exu_tlu_cwp0, exu_tlu_cwp1, exu_tlu_cwp2, exu_tlu_cwp3, |
---|
83 | // |
---|
84 | // added for hypervisor support |
---|
85 | tlu_hpstate_priv, tlu_htstate_rw_d, tlu_htstate_rw_g, tlu_cwp_no_change_m, |
---|
86 | tlu_hscpd_dacc_excpt_m, tlu_htickcmp_rw_e, tlu_gl_rw_m, // tlu_gl_rw_g, |
---|
87 | tlu_hpstate_enb, tlu_cpu_mondo_cmp, tlu_dev_mondo_cmp, |
---|
88 | tlu_resum_err_cmp, tlu_hintp, tlu_hpstate_tlz, tlu_qtail_dacc_excpt_m, |
---|
89 | pib_priv_act_trap_m, rclk, arst_l, grst_l, si, se, rst_tri_en, ctu_sscan_tid |
---|
90 | ); |
---|
91 | |
---|
92 | /*AUTOINPUT*/ |
---|
93 | // Beginning of automatic inputs (from unused autoinst inputs) |
---|
94 | // End of automatics |
---|
95 | input [`TLU_ASR_ADDR_WIDTH-1:0] ifu_tlu_sraddr_d; // addr of sr(st/pr) |
---|
96 | input ifu_tlu_rsr_inst_d; // valid rd sr(st/pr) |
---|
97 | // input ifu_tlu_wsr_inst_d; // valid wr sr(st/pr) |
---|
98 | input lsu_tlu_wsr_inst_e; // valid wr sr(st/pr) |
---|
99 | input tlu_wsr_data_b63_w; // b63 of wsr data |
---|
100 | // input tlu_wsr_data_b16_w; // b16 of wsr data |
---|
101 | input [3:0] tlu_wsr_data_w; // pr/st data to irf. |
---|
102 | input [8:0] lsu_tlu_ttype_m2; // trap type in m2. |
---|
103 | input lsu_tlu_ttype_vld_m2; // trap is signaled. |
---|
104 | // added asynchronize trap to handle correctable dmmu parity errors |
---|
105 | input lsu_tlu_defr_trp_taken_g; // lsu asynchronous trap valid |
---|
106 | input lsu_tlu_async_ttype_vld_g; // lsu asynchronous trap valid |
---|
107 | input [6:0] lsu_tlu_async_ttype_g; // lsu asynchronous trap type |
---|
108 | input [1:0] lsu_tlu_async_tid_g; // asynchronous trap - thread |
---|
109 | // Removed unused bits |
---|
110 | // input [1:0] lsu_tlu_ttype_tid_m2; // trapping thread |
---|
111 | input ifu_tlu_done_inst_d; // done is valid |
---|
112 | input ifu_tlu_retry_inst_d; // retry is valid |
---|
113 | |
---|
114 | input [8:0] ifu_tlu_ttype_m; // trap type in m2. |
---|
115 | input ifu_tlu_ttype_vld_m; // trap is signaled. |
---|
116 | input ifu_tlu_trap_m; // trap is signaled. |
---|
117 | // modified for timing |
---|
118 | input ifu_tlu_flush_fd_w; // instruction flush signal |
---|
119 | // input ifu_tlu_flush_m; // instruction flush signal |
---|
120 | input lsu_tlu_early_flush_w; // early flush with tlb from LSU |
---|
121 | |
---|
122 | input [8:0] exu_tlu_ttype_m; // exu src ttype |
---|
123 | input exu_tlu_ttype_vld_m; // exu src ttype vld |
---|
124 | input exu_tlu_ue_trap_m; // exu ue ecc trap indicator |
---|
125 | // |
---|
126 | // added for timing |
---|
127 | /* |
---|
128 | input [2:0] exu_tlu_cwp0; // cwp - thread0 |
---|
129 | input [2:0] exu_tlu_cwp1; // cwp - thread1 |
---|
130 | input [2:0] exu_tlu_cwp2; // cwp - thread2 |
---|
131 | input [2:0] exu_tlu_cwp3; // cwp - thread3 |
---|
132 | */ |
---|
133 | // |
---|
134 | input exu_tlu_spill; // spill trap |
---|
135 | input [1:0] exu_tlu_spill_tid; // spill trap - thrid |
---|
136 | input exu_tlu_spill_other; // From exu of sparc_exu.v |
---|
137 | input [2:0] exu_tlu_spill_wtype; // From exu of sparc_exu.v |
---|
138 | input exu_tlu_va_oor_m; // ??? - to be used in sfsr |
---|
139 | input exu_tlu_va_oor_jl_ret_m; // ??? - to be used in sfsr |
---|
140 | input ifu_tlu_sir_inst_m; // sir instruction executed |
---|
141 | |
---|
142 | input ifu_tlu_inst_vld_m; // inst in w-stage of pipe. |
---|
143 | input ifu_tlu_pc_oor_e; // inst in w-stage of pipe. |
---|
144 | input [1:0] ifu_tlu_thrid_d; // Thread id. |
---|
145 | // input lsu_tlu_dmmu_miss_g; // ld/st misses in dtlb. |
---|
146 | // |
---|
147 | // modified the stage for timing |
---|
148 | //input ifu_tlu_immu_miss_e; // i-side page fault |
---|
149 | input ifu_tlu_immu_miss_m; // i-side page fault |
---|
150 | |
---|
151 | input exu_tlu_cwp_cmplt; |
---|
152 | input exu_tlu_cwp_retry; |
---|
153 | input [1:0] exu_tlu_cwp_cmplt_tid; |
---|
154 | input tlu_cwp_no_change_m; |
---|
155 | // input exu_tlu_cwp_fastcmplt_w; |
---|
156 | // input moved to tlu_misctl |
---|
157 | // input [2:0] tsa_rdata_cwp; |
---|
158 | // input [`TSA_TTYPE_WIDTH-1:0] tsa_rdata_ttype; |
---|
159 | // input [7:0] tsa_rdata_ccr; |
---|
160 | // input [7:0] tsa_rdata_asi; |
---|
161 | |
---|
162 | input ifu_tlu_rstint_m; // reset interrupt |
---|
163 | input ifu_tlu_hwint_m; // hw interrupt |
---|
164 | input ifu_tlu_swint_m; // sw interrupt |
---|
165 | input [5:0] int_tlu_rstid_m; // reset type |
---|
166 | input [`TLU_THRD_NUM-1:0] tlu_int_pstate_ie; // interrupt enable |
---|
167 | input [`TLU_THRD_NUM-1:0] tlu_int_redmode; // redmode |
---|
168 | // input [`TLU_THRD_NUM-1:0] const_cpuid; |
---|
169 | |
---|
170 | input [`TLU_THRD_NUM-1:0] tlu_sftint_id; |
---|
171 | input [`TLU_THRD_NUM-1:0] pich_wrap_flg; |
---|
172 | input [`TLU_THRD_NUM-1:0] pich_onebelow_flg; |
---|
173 | input [`TLU_THRD_NUM-1:0] pich_twobelow_flg; |
---|
174 | input [`TLU_THRD_NUM-1:0] pib_picl_wrap; |
---|
175 | // modified for bug 5436: Niagara 2.0 |
---|
176 | input [`TLU_THRD_NUM-1:0] tlu_pcr_ut; |
---|
177 | input [`TLU_THRD_NUM-1:0] tlu_pcr_st; |
---|
178 | // input tlu_pic_wrap_e, tlu_pcr_ut_e, tlu_pcr_st_e; |
---|
179 | input tlu_pic_wrap_e; |
---|
180 | |
---|
181 | // input tlu_tick_match; // match between tick and tick-cmp |
---|
182 | // input tlu_stick_match; // match between tick and stick-cmp |
---|
183 | // input [`TLU_THRD_NUM-1:0] pib_pic_wrap; // overflow for the pic registers - lvl15 int |
---|
184 | // modified for timing support |
---|
185 | // input [`TLU_THRD_NUM-1:0] pib_priv_act_trap; // access priv violation of the pics |
---|
186 | input [`TLU_THRD_NUM-1:0] pib_priv_act_trap_m; // access priv violation of the pics |
---|
187 | |
---|
188 | input lsu_tlu_misalign_addr_ldst_atm_m;// misaligned addr - ld,st,atomic |
---|
189 | input exu_tlu_misalign_addr_jmpl_rtn_m;// misaligned addr - jmpl or return addr |
---|
190 | // input lsu_tlu_priv_violtn_g; // privileged violation trap |
---|
191 | input lsu_tlu_priv_action_g; // privileged action trap |
---|
192 | input lsu_tlu_wtchpt_trp_g; // watchpt trap has occurred. |
---|
193 | |
---|
194 | input ifu_tlu_priv_violtn_m; |
---|
195 | input ifu_lsu_memref_d; |
---|
196 | input [3:0] tlu_pstate_priv; |
---|
197 | input [3:0] tlu_pstate_am; |
---|
198 | input [3:0] tlu_isfsr_flt_vld; |
---|
199 | input ffu_tlu_trap_ieee754; |
---|
200 | input ffu_tlu_trap_other; |
---|
201 | input ffu_tlu_trap_ue; |
---|
202 | input ffu_tlu_ill_inst_m; // illegal instruction trap from ffu |
---|
203 | input [1:0] ffu_ifu_tid_w2; |
---|
204 | input [7:0] lsu_tlu_rsr_data_e; |
---|
205 | input lsu_tlu_squash_va_oor_m; // squash va_oor for mem-op. |
---|
206 | input spu_tlu_rsrv_illgl_m; // illegal instruction trap from spu |
---|
207 | input tlu_htstate_rw_d; |
---|
208 | input tlu_htstate_rw_g; |
---|
209 | input tlu_htickcmp_rw_e; |
---|
210 | // input tlu_gl_rw_g; |
---|
211 | input tlu_gl_rw_m; |
---|
212 | input [`TLU_THRD_NUM-1:0] tlu_hpstate_priv; |
---|
213 | input [`TLU_THRD_NUM-1:0] tlu_hpstate_enb; |
---|
214 | input [`TLU_THRD_NUM-1:0] tlu_hpstate_tlz; |
---|
215 | input [`TLU_THRD_NUM-1:0] tlu_cpu_mondo_cmp; |
---|
216 | input [`TLU_THRD_NUM-1:0] tlu_dev_mondo_cmp; |
---|
217 | input [`TLU_THRD_NUM-1:0] tlu_resum_err_cmp; |
---|
218 | input [`TLU_THRD_NUM-1:0] tlu_hintp; |
---|
219 | // input [48:0] ifu_tlu_pc_m; |
---|
220 | input [48:0] ifu_tlu_npc_m; |
---|
221 | // input [33:0] tlu_partial_trap_pc_w1; |
---|
222 | // modified for bug 3017 |
---|
223 | // logic moved to tlu_misctl |
---|
224 | input tlu_hscpd_dacc_excpt_m; |
---|
225 | input tlu_qtail_dacc_excpt_m; |
---|
226 | // added for timing |
---|
227 | input [4:0] tlu_hyperv_rdpr_sel; |
---|
228 | input [1:0] tlu_tckctr_in; |
---|
229 | input rclk; // clock |
---|
230 | // sscan tid |
---|
231 | input [`TLU_THRD_NUM-1:0] ctu_sscan_tid; |
---|
232 | // |
---|
233 | // modified to abide to the niagara reset methodology |
---|
234 | input grst_l; // global reset - active log |
---|
235 | input arst_l; // global reset - active log |
---|
236 | input rst_tri_en; // global reset - active log |
---|
237 | input si; // global scan-in |
---|
238 | input se; // global scan-out |
---|
239 | |
---|
240 | /*autooutput*/ |
---|
241 | // beginning of automatic outputs (from unused autoinst outputs) |
---|
242 | // end of automatics |
---|
243 | output tlu_ifu_trappc_vld_w1; // trap pc or pc on retry. |
---|
244 | output tlu_ifu_trapnpc_vld_w1;// trap pc or pc on retry. |
---|
245 | output [1:0] tlu_ifu_trap_tid_w1; // thread id. |
---|
246 | output tlu_trap_hpstate_enb; |
---|
247 | output tlu_restore_pc_sel_w1; |
---|
248 | output [`TLU_THRD_NUM-1:0] pib_pich_wrap; |
---|
249 | output tlu_tcc_inst_w; |
---|
250 | |
---|
251 | output [2:0] tsa_wr_tpl; // trap level for wr. |
---|
252 | output [1:0] tsa_rd_tid; // thread id for wr. |
---|
253 | output [2:0] tsa_rd_tpl; // trap level for rd. |
---|
254 | output [1:0] tsa_wr_tid; // thread id for rd. |
---|
255 | output [1:0] tsa_wr_vld; // write pointer vld |
---|
256 | // modified for timing |
---|
257 | output tsa_rd_vld_e; // read pointer |
---|
258 | output tsa_rd_en; // read pointer |
---|
259 | output [3:0] tlu_lsu_tl_zero; // trap level is zero. |
---|
260 | // output tlu_ifu_flush_pipe_w; // exception related flush |
---|
261 | // output tlu_flush_pipe_w; // exception related flush - local copy |
---|
262 | // added for timing |
---|
263 | // output tlu_flush_all_w2; // exception related flush - local copy |
---|
264 | // output tlu_flush_all_w; // exception related flush - local copy |
---|
265 | output tlu_local_flush_w; // exception related flush - local copy |
---|
266 | output tlu_early_flush_pipe_w; // exception related flush - local copy |
---|
267 | output tlu_early_flush_pipe2_w; // exception related flush - local copy |
---|
268 | output tlu_exu_early_flush_pipe_w; // exception related flush - to exu |
---|
269 | output tlu_full_flush_pipe_w2; // exception related flush - to exu |
---|
270 | // output [2:0] tlu_exu_agp; // alternate global pointer |
---|
271 | // output tlu_exu_agp_swap; // switch globals |
---|
272 | // modified due to timing |
---|
273 | // output [1:0] tlu_agp_tid_g; // thread that agp refers to |
---|
274 | output [1:0] tlu_agp_tid_w2; // thread that agp refers to |
---|
275 | output [1:0] tlu_exu_agp_tid; // thread that agp refers to |
---|
276 | output tsa_pc_en; // enable write of pc in tsa. |
---|
277 | output tsa_npc_en; // enable write of npc in tsa. |
---|
278 | output tsa_tstate_en; // enable write of tstate in tsa. |
---|
279 | output tsa_htstate_en; // enable write of htstate in tsa. |
---|
280 | output tsa_ttype_en; // enable write of ttype in tsa. |
---|
281 | // modified due to timing |
---|
282 | // output tlu_tl_gt_0_g; // trp lvl gt then 0 |
---|
283 | output tlu_tl_gt_0_w2; // trp lvl gt then 0 |
---|
284 | // modified for timing |
---|
285 | output [2:0] tlu_true_pc_sel_w; |
---|
286 | // output tlu_retry_inst_m; // valid retry inst |
---|
287 | // output tlu_done_inst_m; // valid done inst |
---|
288 | // output tlu_dnrtry_inst_m_l; // valid done/retry inst - g |
---|
289 | output tlu_tick_en_l; // tick reg write enable |
---|
290 | output [`TLU_THRD_NUM-1:0] tlu_tickcmp_en_l; // tick compare reg write enable |
---|
291 | output [`TLU_THRD_NUM-1:0] tlu_stickcmp_en_l; // stick compare reg write enable |
---|
292 | output [`TLU_THRD_NUM-1:0] tlu_htickcmp_en_l; // update htickcmp register |
---|
293 | output [`TLU_THRD_NUM-1:0] tlu_tba_en_l; // tba reg write enable |
---|
294 | output [`TLU_THRD_NUM-1:0] tlu_thrd_wsel_w2; // thread requiring tsa write. |
---|
295 | output [`TLU_THRD_NUM-1:0] tlu_thread_wsel_g; // thread for instruction fetched |
---|
296 | output [`TSA_TTYPE_WIDTH-1:0] tlu_final_ttype_w2; // selected ttype - w2 |
---|
297 | // output tlu_async_trap_taken_g; // async trap taken |
---|
298 | output [`TLU_THRD_NUM-1:0] tlu_thread_inst_vld_g; // valid inst for a thread |
---|
299 | // output [`TLU_THRD_NUM-1:0] tlu_thread_inst_vld_w2; // valid inst for a thread |
---|
300 | // output [`TLU_THRD_NUM-1:0] tlu_update_pc_l_m; // update pc or npc for a thread |
---|
301 | output [`TLU_THRD_NUM-1:0] tlu_update_pc_l_w; // update pc or npc for a thread |
---|
302 | // output [`TLU_THRD_NUM-1:0] tlu_thrd_rsel_g; // thread requiring tsa read |
---|
303 | // modified for bug 1767 |
---|
304 | // output tlu_select_tle; // tle/cle value on trap |
---|
305 | // output [1:0] tlu_select_mmodel; // mem. model on trap |
---|
306 | output tlu_select_redmode; // redmode setting on trap |
---|
307 | // Modified for bug 1575 |
---|
308 | // |
---|
309 | // output [2:0] tlu_pstate_din_sel; // sel source of tsa wdata |
---|
310 | output [1:0] tlu_pstate_din_sel0; // sel source of tsa wdata |
---|
311 | output [1:0] tlu_pstate_din_sel1; // sel source of tsa wdata |
---|
312 | output [1:0] tlu_pstate_din_sel2; // sel source of tsa wdata |
---|
313 | output [1:0] tlu_pstate_din_sel3; // sel source of tsa wdata |
---|
314 | // |
---|
315 | // modified due to timing |
---|
316 | // output [3:0] tlu_update_pstate_l_g; // pstate write enable |
---|
317 | output [3:0] tlu_update_pstate_l_w2; // pstate write enable |
---|
318 | output [2:0] tlu_trp_lvl; // trp lvl - mx'ed |
---|
319 | output [3:0] tlu_pil; // pil - mx'ed |
---|
320 | // output tlu_wsr_inst_g; // write state inst |
---|
321 | // |
---|
322 | // added for timing |
---|
323 | output tlu_wsr_inst_nq_g; // write state inst |
---|
324 | // output tlu_wr_tsa_inst_g; // write state inst |
---|
325 | output tlu_wr_tsa_inst_w2; // write state inst |
---|
326 | output tlu_exu_priv_trap_m; // local traps send to exu |
---|
327 | output tlu_lsu_priv_trap_m; // local traps send to lsu |
---|
328 | // output tlu_lsu_priv_trap_w; // local traps send to lsu |
---|
329 | // experiment |
---|
330 | output tlu_pic_cnt_en_m; // local traps send to exu |
---|
331 | // output tlu_exu_pic_onebelow_m; // local traps send to exu |
---|
332 | // output tlu_exu_pic_twobelow_m; // local traps send to exu |
---|
333 | output tlu_exu_cwp_retry_m; |
---|
334 | output tlu_exu_cwpccr_update_m; |
---|
335 | // output moved to tlu_misctl |
---|
336 | // output [2:0] tlu_exu_cwp_m; |
---|
337 | // output [7:0] tlu_exu_ccr_m; |
---|
338 | // output [7:0] tlu_lsu_asi_m; // asi from stack |
---|
339 | // added for bug3499 |
---|
340 | output [`TLU_THRD_NUM-1:0] tlu_trap_cwp_en; |
---|
341 | |
---|
342 | output tlu_lsu_asi_update_m; // update asi |
---|
343 | output [1:0] tlu_lsu_tid_m; // thread for asi update |
---|
344 | |
---|
345 | // output tlu_assist_boot_rst_g; // use rstvaddr all zeroes |
---|
346 | // modified due to timing |
---|
347 | // output tlu_self_boot_rst_g; // use rstvaddr all ones |
---|
348 | // output tlu_select_tba_g; // use tba |
---|
349 | // output tlu_select_htba_g; // use htba |
---|
350 | // modified for one-hot mux problem |
---|
351 | // output tlu_self_boot_rst_w2; // use rstvaddr all ones |
---|
352 | // output tlu_select_htba_w2; // use htba |
---|
353 | output [2:0] tlu_pc_mxsel_w2; |
---|
354 | output tlu_select_tba_w2; // use tba |
---|
355 | output tdp_select_tba_w2; // use tba |
---|
356 | // |
---|
357 | output tlu_set_sftint_l_g; // set sftint |
---|
358 | output tlu_clr_sftint_l_g; // clr sftint |
---|
359 | output tlu_wr_sftint_l_g; // wr to sftin (asr 16) |
---|
360 | output [`TLU_THRD_NUM-1:0] tlu_sftint_en_l_g; // wr en sftint regs. |
---|
361 | output [`TLU_THRD_NUM-1:0] tlu_sftint_mx_sel; // mux sel sftint regs. |
---|
362 | // |
---|
363 | // removed due to sftint recode |
---|
364 | // output [3:0] tlu_sftint_lvl14_int; // level 14 sft interrupt |
---|
365 | |
---|
366 | output [3:0] tlu_sftint_penc_sel; // select appr. thread for pr. encd. |
---|
367 | output [3:0] tlu_sftint_vld; // a sftint is valid for a thread |
---|
368 | output [1:0] tlu_int_tid_m; // thread id |
---|
369 | output [1:0] tlu_incr_tick; // increment tick reg |
---|
370 | output [3:0] tlu_tickcmp_sel; // select src for tickcmp |
---|
371 | |
---|
372 | output [3:0] immu_sfsr_trp_wr; |
---|
373 | output tlu_itag_acc_sel_g; |
---|
374 | |
---|
375 | output [23:0] tlu_isfsr_din_g; |
---|
376 | // |
---|
377 | // removed due to sftint code cleanup |
---|
378 | output tlu_tick_npt; // npt bit of tick |
---|
379 | output [3:0] tlu_thrd_rsel_e; // read select for threaded regs |
---|
380 | |
---|
381 | output tlu_inst_vld_nq_m; // not qualified inst vld |
---|
382 | |
---|
383 | output [3:0] tlu_lsu_pstate_am; // ship to lsu |
---|
384 | |
---|
385 | output [2:0] tlu_rdpr_mx1_sel; |
---|
386 | output [2:0] tlu_rdpr_mx2_sel; |
---|
387 | output [1:0] tlu_rdpr_mx3_sel; |
---|
388 | output [1:0] tlu_rdpr_mx4_sel; |
---|
389 | output [2:0] tlu_rdpr_mx5_sel; |
---|
390 | output [2:0] tlu_rdpr_mx6_sel; |
---|
391 | output [3:0] tlu_rdpr_mx7_sel; |
---|
392 | // |
---|
393 | output [`TSA_TTYPE_WIDTH-1:0] tlu_final_offset_w1; |
---|
394 | // output [3:0] tlu_lsu_redmode; // redmode |
---|
395 | // output [3:0] tlu_lsu_redmode_rst; |
---|
396 | // output [`TLU_THRD_NUM-1:0] tlu_lsu_async_ack_w2; |
---|
397 | output [3:0] tlu_lsu_redmode_rst_d1; |
---|
398 | output [7:0] lsu_tlu_rsr_data_mod_e; |
---|
399 | output tlu_addr_msk_g; // address masking active for thread in pipe. |
---|
400 | // |
---|
401 | // added for hypervisor support |
---|
402 | // modified for timing |
---|
403 | // output tlu_thrd0_traps, tlu_thrd1_traps; |
---|
404 | // output tlu_thrd2_traps, tlu_thrd3_traps; |
---|
405 | output [`TLU_THRD_NUM-1:0] tlu_thrd_traps_w2; |
---|
406 | output tlu_dnrtry0_inst_g, tlu_dnrtry1_inst_g; |
---|
407 | output tlu_dnrtry2_inst_g, tlu_dnrtry3_inst_g; |
---|
408 | // output tlu_ibrkpt_trap_g; |
---|
409 | output tlu_ibrkpt_trap_w2; |
---|
410 | output tlu_tick_ctl_din; |
---|
411 | output [`TLU_THRD_NUM-1:0] tlu_por_rstint_g; |
---|
412 | output [`TLU_THRD_NUM-1:0] tlu_hintp_vld; // From tcl of tlu_tcl.v |
---|
413 | output [`TLU_THRD_NUM-1:0] tlu_rerr_vld; // From tcl of tlu_tcl.v |
---|
414 | // modified for bug 3017 |
---|
415 | // moved to tlu_misctl |
---|
416 | output [48:0] ifu_npc_w; //ifu_pc_w, |
---|
417 | // |
---|
418 | // shadow scan data from tcl tl and ttype |
---|
419 | output [`TCL_SSCAN_WIDTH-1:0] tlu_sscan_tcl_data; |
---|
420 | |
---|
421 | // |
---|
422 | // added to abide to the niagara reset methodology |
---|
423 | output tlu_rst; // local unit reset - active high |
---|
424 | // output tlu_rst_l; // local unit reset - active low |
---|
425 | output so; // global scan-out |
---|
426 | |
---|
427 | /*AUTOWIRE*/ |
---|
428 | // Beginning of automatic wires (for undeclared instantiated-module outputs) |
---|
429 | // End of automatics |
---|
430 | |
---|
431 | // this signal were added to abide to the niagara reset methodology |
---|
432 | wire local_rst; |
---|
433 | wire local_rst_l; |
---|
434 | wire tlu_rst_l; // local unit reset - active low |
---|
435 | |
---|
436 | wire [1:0] tlu_exu_tid_m; |
---|
437 | wire [3:0] pstate_rmode; |
---|
438 | |
---|
439 | // wire select_tba_g; // use tba |
---|
440 | wire local_select_tba_w2; // use tba |
---|
441 | wire [1:0] select_tba_element_w2; // use tba |
---|
442 | // wire select_htba_g; // use htba |
---|
443 | // |
---|
444 | // added for early flush timing fix |
---|
445 | // wire tlu_early_flush_pipe_m; |
---|
446 | wire local_early_flush_pipe_w; |
---|
447 | wire local_early_flush_pipe2_w; |
---|
448 | wire local_early_flush_pipe3_w; |
---|
449 | wire local_early_flush_pipe4_w; |
---|
450 | wire lsu_ttype_vld_w, lsu_ttype_vld_w2; |
---|
451 | wire tlu_flush_all_w; |
---|
452 | wire tlu_ifu_flush_pipe_w; // exception related flush |
---|
453 | wire tlu_flush_pipe_w; // exception related flush |
---|
454 | wire tlu_flush_all_w2; |
---|
455 | // wire tlu_wr_tsa_inst_g; // write state inst |
---|
456 | wire tlu_self_boot_rst_g, tlu_self_boot_rst_w2; |
---|
457 | wire dnrtry_inst_g; |
---|
458 | wire dnrtry0_inst_g, dnrtry1_inst_g; |
---|
459 | wire dnrtry2_inst_g, dnrtry3_inst_g; |
---|
460 | wire [`TLU_THRD_NUM-1:0] dnrtry_inst_w2; |
---|
461 | wire thrd0_traps,thrd1_traps; |
---|
462 | wire thrd2_traps,thrd3_traps; |
---|
463 | // wire [`TLU_THRD_NUM-1:0] async_trap_ack_g; |
---|
464 | // wire [`TLU_THRD_NUM-1:0] async_trap_ack_w2; |
---|
465 | wire [2:0] trp_lvl0,trp_lvl0_new; |
---|
466 | wire [2:0] trp_lvl1,trp_lvl1_new; |
---|
467 | wire [2:0] trp_lvl2,trp_lvl2_new; |
---|
468 | wire [2:0] trp_lvl3,trp_lvl3_new; |
---|
469 | wire tl0_en, tl0_gt_0; |
---|
470 | wire tl1_en, tl1_gt_0; |
---|
471 | wire tl2_en, tl2_gt_0; |
---|
472 | wire tl3_en, tl3_gt_0; |
---|
473 | wire [1:0] agp_tid_g, agp_tid_w2, agp_tid_w3; // thread that agp refers to |
---|
474 | // wire tlu_pic_onebelow_e, tlu_pic_twobelow_e; |
---|
475 | // experiment |
---|
476 | wire pich_wrap_flg_m, tlu_pich_wrap_flg_m; // pich_wrap_flg_e, |
---|
477 | wire tlu_picl_wrap_flg_m; // pich_wrap_flg_e, |
---|
478 | // modified for bug 5436 - Niagara 2.0 |
---|
479 | wire [`TLU_THRD_NUM-1:0] pic_cnt_en; |
---|
480 | wire pic_cnt_en_e, pic_cnt_en_m, pic_cnt_en_w, pic_cnt_en_w2; |
---|
481 | // wire pic_trap_en_e; |
---|
482 | //wire pcr_ut_e, pcr_st_e; |
---|
483 | // wire [`TLU_THRD_NUM-1:0] pich_exu_wrap_e; |
---|
484 | // wire pic_hpstate_enb_e, pic_hpstate_priv_e, pic_pstate_priv_e; |
---|
485 | // |
---|
486 | wire [`TLU_THRD_NUM-1:0] tlz_thread_set, tlz_thread_data; |
---|
487 | wire [`TLU_THRD_NUM-1:0] tlz_thread; |
---|
488 | wire [`TLU_THRD_NUM-1:0] tlz_trap_m, tlz_exu_trap_m; |
---|
489 | wire [`TLU_THRD_NUM-1:0] tlz_trap_nq_g, tlz_trap_g; |
---|
490 | wire [`TLU_THRD_NUM-1:0] ifu_thrd_flush_w; |
---|
491 | wire [`TLU_THRD_NUM-1:0] tlu_none_priv; |
---|
492 | wire cpu_mondo_trap_g, dev_mondo_trap_g; |
---|
493 | wire cpu_mondo_trap_w2, dev_mondo_trap_w2; |
---|
494 | wire [`TLU_THRD_NUM-1:0] tlu_cpu_mondo_trap; |
---|
495 | wire [`TLU_THRD_NUM-1:0] tlu_dev_mondo_trap; |
---|
496 | wire [`TLU_THRD_NUM-1:0] tlu_resum_err_trap; |
---|
497 | wire [`TLU_THRD_NUM-1:0] tlu_hyper_lite; |
---|
498 | wire [3:0] local_rdpr_mx6_sel; |
---|
499 | wire [3:0] local_rdpr_mx5_sel; |
---|
500 | wire [2:0] local_rdpr_mx4_sel; |
---|
501 | wire [2:0] local_rdpr_mx3_sel; |
---|
502 | wire [3:0] local_rdpr_mx2_sel; |
---|
503 | wire [3:0] local_rdpr_mx1_sel; |
---|
504 | wire tlu_none_priv_m; |
---|
505 | wire ibrkpt_trap_m, ibrkpt_trap_g, ibrkpt_trap_w2; |
---|
506 | wire va_oor_jl_ret_g; |
---|
507 | wire done_inst_m_tmp; |
---|
508 | wire retry_inst_m_tmp; |
---|
509 | wire done_inst_w2; |
---|
510 | wire retry_inst_w2; |
---|
511 | wire [2:0] true_pc_sel_m, true_pc_sel_w; |
---|
512 | // wire dsfsr_flt_vld_g; |
---|
513 | wire done_inst_e, retry_inst_e; |
---|
514 | wire done_inst_m, retry_inst_m; |
---|
515 | wire exu_done_inst_m, exu_retry_inst_m; |
---|
516 | // logic moved to misctl |
---|
517 | // wire cwp_no_change_m; |
---|
518 | // wire [2:0] cwp_xor_m, trap_old_cwp_m; |
---|
519 | wire done_inst_g, retry_inst_g; |
---|
520 | wire [1:0] thrid_d, thrid_e, thrid_m, thrid_g; |
---|
521 | wire [1:0] thrid_w2; |
---|
522 | // |
---|
523 | // added for tsa_wr_tid bug |
---|
524 | // |
---|
525 | // wire thread0_wtrp_g, thread1_wtrp_g, thread2_wtrp_g, thread3_wtrp_g; |
---|
526 | wire thread0_wtrp_w2, thread1_wtrp_w2, thread2_wtrp_w2, thread3_wtrp_w2; |
---|
527 | wire thread0_wsel_g, thread1_wsel_g, thread2_wsel_g, thread3_wsel_g; |
---|
528 | wire thread0_wsel_w2, thread1_wsel_w2, thread2_wsel_w2, thread3_wsel_w2; |
---|
529 | wire thread0_rsel_dec_g,thread1_rsel_dec_g; |
---|
530 | wire thread2_rsel_dec_g,thread3_rsel_dec_g; |
---|
531 | wire thread0_rsel_d, thread1_rsel_d, thread2_rsel_d, thread3_rsel_d; |
---|
532 | wire thread0_rsel_m, thread1_rsel_m, thread2_rsel_m, thread3_rsel_m; |
---|
533 | wire thread0_stg_m, thread1_stg_m, thread2_stg_m, thread3_stg_m; |
---|
534 | wire thread0_stg_m_buf, thread1_stg_m_buf, thread2_stg_m_buf, thread3_stg_m_buf; |
---|
535 | wire thread0_rsel_g, thread1_rsel_g, thread2_rsel_g, thread3_rsel_g; |
---|
536 | wire thread0_rsel_e, thread1_rsel_e, thread2_rsel_e, thread3_rsel_e; |
---|
537 | wire inst_vld_w2, inst_vld_g, inst_vld_m, inst_vld_nf_g; |
---|
538 | wire [`TLU_THRD_NUM-1:0] thread_inst_vld_g; |
---|
539 | wire [`TLU_THRD_NUM-1:0] thread_inst_vld_w2; |
---|
540 | // wire tlu_inst_vld_m; // qualified inst vld |
---|
541 | wire exu_ttype_vld_g, ifu_ttype_vld_g, exu_ue_trap_g; |
---|
542 | wire [8:0] exu_ttype_g, ifu_ttype_tmp_g, ifu_ttype_g; |
---|
543 | wire [8:0] exu_spill_ttype; |
---|
544 | // added for timing fix |
---|
545 | wire spu_ill_inst_m ; // illegal instruction trap from spu |
---|
546 | wire spu_ill_inst_uf_g ; // illegal instruction trap from spu |
---|
547 | wire spu_ill_inst_g ; // illegal instruction trap from spu |
---|
548 | wire pib_priv_act_trap_g ; // privilege action trap from pib |
---|
549 | wire pib_priv_act_trap_uf_g ; // privilege action trap from pib |
---|
550 | wire pib_priv_act_early_trap_m ; // privilege action trap from pib |
---|
551 | wire ffu_ill_inst_uf_g ; // illegal instruction trap from ffu - unflushed |
---|
552 | wire ffu_ill_inst_g ; // illegal instruction trap from ffu |
---|
553 | wire ffu_higher_pri_g ; // illegal instruction trap from ffu |
---|
554 | wire exu_higher_pri_g ; // UE ECC trap from exu |
---|
555 | // wire lsu_ill_inst_uf_g ; // illegal instruction trap from lsu - unflushed |
---|
556 | // wire lsu_ill_inst_g ; // illegal instruction trap from lsu |
---|
557 | // wire [`TLU_THRD_NUM-1:0] lsu_defr_thrd_g; |
---|
558 | wire lsu_defr_trap_g, lsu_defr_trap_w2 ; // deferred trap from lsu |
---|
559 | wire local_lsu_async_ttype_vld_w; // deferred trap from lsu |
---|
560 | // wire local_lsu_defr_trp_taken_g; // deferred trap from lsu |
---|
561 | wire [`TLU_THRD_NUM-1:0] lsu_defr_trp_taken_w2; |
---|
562 | // wire lsu_tlu_defr_trp_taken_w2 ; // deferred trap from lsu - signled in g for w2 |
---|
563 | // trap need to sync up with lsu_tlu_async_ttype_vld_g |
---|
564 | wire htrap_ill_inst_m ; // illegal instruction trap from htrap |
---|
565 | wire htrap_ill_inst_uf_g ; // illegal instruction trap from htrap - unflushed |
---|
566 | wire htrap_ill_inst_g ; // illegal instruction trap from htrap |
---|
567 | |
---|
568 | wire [`TLU_ASR_ADDR_WIDTH-1:0] sraddr; |
---|
569 | wire [`TLU_ASR_ADDR_WIDTH-1:0] sraddr2; |
---|
570 | // modified due to timing |
---|
571 | // wire wsr_inst_d; |
---|
572 | wire asr_hyperp, asr_priv; |
---|
573 | wire tpc_rw_d, tnpc_rw_d, tstate_rw_d, ttype_rw_d; |
---|
574 | wire tick_rw_d, tickcmp_rw_d, tick_npriv_r_d; |
---|
575 | wire pcr_rsr_d, pic_rsr_d; |
---|
576 | wire pcr_rsr_e, pic_rsr_e; |
---|
577 | wire tlu_gl_rw_g; |
---|
578 | // |
---|
579 | // added for hypervisor support |
---|
580 | wire maxtl_wr_sel; |
---|
581 | wire [3:0] maxstl_wr_sel; |
---|
582 | wire [2:0] wsr_trp_lvl0_data_w, wsr_trp_lvl1_data_w; |
---|
583 | wire [2:0] wsr_trp_lvl2_data_w, wsr_trp_lvl3_data_w; |
---|
584 | wire [2:0] wsr_trp_lvl0_data_w2, wsr_trp_lvl1_data_w2; |
---|
585 | wire [2:0] wsr_trp_lvl2_data_w2, wsr_trp_lvl3_data_w2; |
---|
586 | wire stick_rw_d, stickcmp_rw_d, stickcmp_rw_e; |
---|
587 | wire stickcmp_rw_m, stickcmp_rw_g; |
---|
588 | // wire [3:0] stickcmp_int; // interrupt caused by stick_ticktmp |
---|
589 | // wire [3:0] stick_intclr; // use to clear the stick_int bit |
---|
590 | |
---|
591 | wire tba_rw_d, pstate_rw_d, pil_rw_d, tl_rw_d; |
---|
592 | wire tsa_wr_tid_sel_g, tsa_wr_tid_sel_tim_g, tsa_wr_tid_sel_w2; |
---|
593 | wire immu_miss_g; |
---|
594 | wire trap_taken_g, trap_taken_w2; |
---|
595 | wire [1:0] trap_tid_g; |
---|
596 | // wire [1:0] tsa_wr_tid_g; |
---|
597 | wire [1:0] pend_trap_tid_g, pend_trap_tid_w2; |
---|
598 | wire [`TSA_TTYPE_WIDTH-1:0] final_ttype_w2; |
---|
599 | wire [`TSA_TTYPE_WIDTH-1:0] tba_ttype_w1; |
---|
600 | wire [`TSA_TTYPE_WIDTH-1:0] final_offset_w1; |
---|
601 | wire tsa_rd_vld; |
---|
602 | // modified for bug 3017 |
---|
603 | // logic moved to tlu_misctl |
---|
604 | // wire [48:0] normal_trap_pc_w1, normal_trap_npc_w1; |
---|
605 | // wire [48:0] trap_pc_w1, trap_npc_w1; |
---|
606 | // wire [48:0] trap_pc_w2, trap_npc_w2; |
---|
607 | // wire tsa_rd_vld_e, tsa_rd_vld_m; |
---|
608 | wire [`TLU_THRD_NUM-1:0] sscan_tid_sel; |
---|
609 | // logic moved to tlu_misctl |
---|
610 | /* |
---|
611 | wire [`TLU_THRD_NUM-1:0] sscan_ttype_en; |
---|
612 | wire [`TLU_THRD_NUM-1:0] sscan_tt_rd_sel; |
---|
613 | wire [`TLU_THRD_NUM-1:0] sscan_tt_wr_sel; |
---|
614 | wire [`TSA_TTYPE_WIDTH-1:0] sscan_tt0_data; |
---|
615 | wire [`TSA_TTYPE_WIDTH-1:0] sscan_tt1_data; |
---|
616 | wire [`TSA_TTYPE_WIDTH-1:0] sscan_tt2_data; |
---|
617 | wire [`TSA_TTYPE_WIDTH-1:0] sscan_tt3_data; |
---|
618 | wire [`TSA_TTYPE_WIDTH-1:0] sscan_tt0_din; |
---|
619 | wire [`TSA_TTYPE_WIDTH-1:0] sscan_tt1_din; |
---|
620 | wire [`TSA_TTYPE_WIDTH-1:0] sscan_tt2_din; |
---|
621 | wire [`TSA_TTYPE_WIDTH-1:0] sscan_tt3_din; |
---|
622 | wire [`TSA_TTYPE_WIDTH-1:0] tsa_rdata_ttype_m; |
---|
623 | */ |
---|
624 | wire [`TCL_SSCAN_WIDTH-1:0] tcl_sscan_test_data; |
---|
625 | wire tba_ttype_sel_w2; |
---|
626 | wire [3:0] final_ttype_sel_g, final_ttype_sel_w2; |
---|
627 | // modified due to one-hot mux bug |
---|
628 | wire [1:0] final_offset_en_g, final_offset_en_w1; |
---|
629 | wire [2:0] final_offset_sel_w1; |
---|
630 | wire restore_pc_sel_g, restore_pc_sel_w1; |
---|
631 | // removed for timing |
---|
632 | // wire [`TSA_TTYPE_WIDTH-1:0] sync_ttype_g; |
---|
633 | // added to support lsu dferred traps |
---|
634 | wire priority_trap_sel0, priority_trap_sel1, priority_trap_sel2; |
---|
635 | wire sync_trap_taken_g, sync_trap_taken_w2; |
---|
636 | // added for timing fix |
---|
637 | wire sync_trap_taken_m ; |
---|
638 | wire ifu_ttype_early_vld_m ; |
---|
639 | // wire [3:0] tickcmp_int; // interrupt caused by tick_ticktmp |
---|
640 | wire fp_trap_thrd0,fp_trap_thrd1,fp_trap_thrd2,fp_trap_thrd3; |
---|
641 | wire [`TSA_TTYPE_WIDTH-1:0] ffu_async_ttype; |
---|
642 | wire spill_thrd0,spill_thrd1,spill_thrd2,spill_thrd3; |
---|
643 | wire [`TLU_THRD_NUM-1:0] trap_cwp_enb; |
---|
644 | wire [`TLU_THRD_NUM-1:0] lsu_async_vld_en_g, lsu_async_vld_en_w2; |
---|
645 | wire dmmu_async_thrd0, dmmu_async_thrd1; |
---|
646 | wire dmmu_async_thrd2, dmmu_async_thrd3; |
---|
647 | wire [`TSA_TTYPE_WIDTH-1:0] dmmu_async_ttype; |
---|
648 | wire pend_to_thrd0_en, pend_to_thrd1_en; |
---|
649 | wire pend_to_thrd2_en, pend_to_thrd3_en; |
---|
650 | wire pend_to_thrd0_reset, pend_to_thrd1_reset; |
---|
651 | wire pend_to_thrd2_reset, pend_to_thrd3_reset; |
---|
652 | wire tlu_pich_cnt_hld; |
---|
653 | wire [`TLU_THRD_NUM-1:0] pich_cnt_hld_rst_g; |
---|
654 | wire [`TLU_THRD_NUM-1:0] pich_cnt_hld_rst_w2; |
---|
655 | wire [`TLU_THRD_NUM-1:0] pend_pich_cnt_hld; |
---|
656 | wire [`TLU_THRD_NUM-1:0] pend_pich_cnt_hld_q; |
---|
657 | wire [`TLU_THRD_NUM-1:0] pend_pich_cnt_hld_noqual; |
---|
658 | wire [`TLU_THRD_NUM-1:0] pend_pich_cnt_hld_early; |
---|
659 | wire [`TLU_THRD_NUM-1:0] pend_pich_cnt_adj; |
---|
660 | wire [`TLU_THRD_NUM-1:0] cwp_en_thrd_reset; |
---|
661 | // wire pend_to_thrd0_taken, pend_to_thrd1_taken; |
---|
662 | // wire pend_to_thrd2_taken, pend_to_thrd3_taken; |
---|
663 | wire [`TSA_TTYPE_WIDTH-1:0] pend_ttype0,pend_ttype1,pend_ttype2,pend_ttype3; |
---|
664 | wire pending_trap0,pending_trap1,pending_trap2,pending_trap3; |
---|
665 | wire [`TSA_TTYPE_WIDTH-1:0] pending_ttype0,pending_ttype1,pending_ttype2,pending_ttype3; |
---|
666 | wire [`TSA_TTYPE_WIDTH-1:0] pending_ttype, pending_ttype_w2; |
---|
667 | // |
---|
668 | // Added for bug 1575 |
---|
669 | wire agp_tid_sel; |
---|
670 | // modified due to timing |
---|
671 | // wire update_pstate0_g,update_pstate1_g; |
---|
672 | // wire update_pstate2_g,update_pstate3_g; |
---|
673 | // wire [`TLU_THRD_NUM-1:0] update_pstate_g;, |
---|
674 | wire [`TLU_THRD_NUM-1:0] update_pstate_w2; |
---|
675 | wire thrd0_traps_w2, thrd1_traps_w2; |
---|
676 | wire thrd2_traps_w2, thrd3_traps_w2; |
---|
677 | wire ifu_ttype_vld_tmp_g; |
---|
678 | // |
---|
679 | // added for timing, move qualification from ifu to tlu |
---|
680 | wire ifu_ttype_vld_m; |
---|
681 | wire cwp_cmplt0,cwp_cmplt1,cwp_cmplt2,cwp_cmplt3; |
---|
682 | wire cwp_cmplt_w2, cwp_cmplt_g; |
---|
683 | wire cwp_cmplt_rtry_w2, cwp_cmplt_rtry_g; |
---|
684 | wire cwp_fastcmplt_w2; |
---|
685 | wire cwp_cmplt0_pending, cwp_cmplt1_pending; |
---|
686 | wire cwp_cmplt2_pending, cwp_cmplt3_pending; |
---|
687 | wire cwp_retry0,cwp_retry1,cwp_retry2,cwp_retry3; |
---|
688 | wire pending_thrd0_event_taken, pending_thrd1_event_taken; |
---|
689 | wire pending_thrd2_event_taken, pending_thrd3_event_taken; |
---|
690 | // wire pending_thrd0_event_taken_w2, pending_thrd1_event_taken_w2; |
---|
691 | // wire pending_thrd2_event_taken_w2, pending_thrd3_event_taken_w2; |
---|
692 | wire cwp_fastcmplt_m, cwp_fastcmplt_uq_g, cwp_fastcmplt_g; |
---|
693 | wire pending_dntry0_taken, pending_dntry1_taken; |
---|
694 | wire pending_dntry2_taken, pending_dntry3_taken; |
---|
695 | wire rstint_g,hwint_g,swint_g; |
---|
696 | wire [2:0] early_ttype_sel; |
---|
697 | // wire [2:0] rst_ttype_sel; |
---|
698 | wire [1:0] rst_ttype_sel; |
---|
699 | wire rst_hwint_sel_w2; |
---|
700 | // modified for timing |
---|
701 | // wire [3:0] rst_hwdr_ttype_sel; |
---|
702 | wire rst_hwdr_ttype_sel_w2; |
---|
703 | wire onehot_pending_ttype_sel; |
---|
704 | wire early_priv_traps_g, exu_hyper_traps_g; |
---|
705 | wire exu_pib_priv_act_trap_m; |
---|
706 | wire [`TLU_THRD_NUM-1:0] pib_wrap_m; |
---|
707 | wire [`TLU_THRD_NUM-1:0] pib_pich_wrap_m; |
---|
708 | wire pib_wrap_trap_nq_g, pib_wrap_trap_g, pib_wrap_trap_m; |
---|
709 | wire [`TLU_THRD_NUM-1:0] pib_trap_en; |
---|
710 | wire [`TLU_THRD_NUM-1:0] picl_wrap_pend; |
---|
711 | // |
---|
712 | // added for timing; moved qualification from IFU to TLU |
---|
713 | wire ifu_rstint_m,ifu_hwint_m,ifu_swint_m; // swint_nq_g; |
---|
714 | wire sftint_penc_update; |
---|
715 | wire sftint_user_update_g, sftint_user_update_w2; |
---|
716 | wire penc_sel_user_update; |
---|
717 | wire [5:0] rstid_g; |
---|
718 | wire trp_lvl0_incr_w2, trp_lvl1_incr_w2; |
---|
719 | wire trp_lvl2_incr_w2, trp_lvl3_incr_w2; |
---|
720 | wire rstint_taken,hwint_taken,swint_taken; |
---|
721 | // wire swint_thrd0_taken, swint_thrd1_taken; |
---|
722 | // wire swint_thrd2_taken, swint_thrd3_taken; |
---|
723 | wire sirint_taken; |
---|
724 | // wire [`TLU_THRD_NUM-2:0] swint_thrd_g; |
---|
725 | wire [`TLU_THRD_NUM-2:0] sftint_penc_thrd; |
---|
726 | wire por_rstint_g, xir_rstint_g; |
---|
727 | wire por_rstint0_g, por_rstint1_g; |
---|
728 | wire por_rstint2_g, por_rstint3_g; |
---|
729 | wire por_rstint_w2; |
---|
730 | wire por_rstint0_w2, por_rstint1_w2; |
---|
731 | wire por_rstint2_w2, por_rstint3_w2; |
---|
732 | wire trp_lvl0_at_maxtl,trp_lvl1_at_maxtl; |
---|
733 | wire trp_lvl2_at_maxtl,trp_lvl3_at_maxtl; |
---|
734 | wire internal_wdr; |
---|
735 | wire [`TLU_THRD_NUM-1:0] internal_wdr_trap; |
---|
736 | // added for hypervispor support |
---|
737 | wire [`TLU_THRD_NUM-1:0] pil_cmp_en; |
---|
738 | wire [`TLU_THRD_NUM-1:0] sftint_only_vld; |
---|
739 | wire [`TLU_THRD_NUM-1:0] tlu_int_sftint_pend; |
---|
740 | wire [`TLU_THRD_NUM-1:0] sftint_pend_wait; |
---|
741 | wire [`TLU_THRD_NUM-1:0] sftint_wait_rst; |
---|
742 | // |
---|
743 | wire [3:0] true_pil0, true_pil1; |
---|
744 | wire [3:0] true_pil2, true_pil3; |
---|
745 | wire pil0_en,pil1_en,pil2_en,pil3_en; |
---|
746 | wire set_sftint_d, clr_sftint_d, sftint_rg_rw_d; |
---|
747 | // modified for timing and bug 5117 |
---|
748 | wire [6:0] final_swint_id_w2; |
---|
749 | // wire [6:0] final_swint_id; |
---|
750 | // wire [6:0] final_swint0_id, final_swint1_id; |
---|
751 | // wire [6:0] final_swint2_id, final_swint3_id; |
---|
752 | // modified for bug 3705 |
---|
753 | // wire [6:0] tlz_swint_ttype; |
---|
754 | // wire [6:0] hwint_swint_ttype; |
---|
755 | wire [6:0] wrap_tlz_ttype; |
---|
756 | wire [3:0] sftint0_id,sftint1_id,sftint2_id,sftint3_id; |
---|
757 | wire [3:0] sftint_id_w2; |
---|
758 | // wire [6:0] sftint_ttype; |
---|
759 | wire done_inst_g_tmp, retry_inst_g_tmp; |
---|
760 | wire immu_va_oor_brnchetc_m; |
---|
761 | wire pstate_am;// pstate_priv pstate_priv_g; |
---|
762 | wire memref_e, memref_m; |
---|
763 | wire [2:0] isfsr_ftype_sel; |
---|
764 | wire [6:0] isfsr_ftype_m,isfsr_ftype_g; |
---|
765 | wire isfsr_flt_vld_m,isfsr_flt_vld_g; |
---|
766 | wire isfsr_trp_wr_m,isfsr_trp_wr_g; |
---|
767 | wire itag_acc_sel_g; |
---|
768 | // wire flsh_inst_m, flsh_inst_g; |
---|
769 | // wire pstate_cle; |
---|
770 | // wire [2:0] dsfsr_asi_sel_m, dsfsr_asi_sel_g; |
---|
771 | // wire [1:0] dsfsr_asi_sel_m, // dsfsr_asi_sel_g; |
---|
772 | wire dmmu_va_oor_m, dmmu_va_oor_g; |
---|
773 | // wire ldst_xslate_g; |
---|
774 | // wire [2:0] dsfsr_ctxt_sel; |
---|
775 | // wire dsfsr_wr_op_g; |
---|
776 | // wire dsfsr_flt_vld_m; |
---|
777 | // |
---|
778 | // logic moved to lsu_expctl due to timing |
---|
779 | /* |
---|
780 | wire dsfsr_ftype_zero; |
---|
781 | wire [1:0] dsfsr_ctxt_g, |
---|
782 | wire [7:0] dsfsr_asi_g; |
---|
783 | // wire [6:0] dsfsr_ftype_g, dsfsr_pe_ftype_g; |
---|
784 | wire dsfsr_side_effect_g; |
---|
785 | wire dsfsr_trp_wr_g; |
---|
786 | */ |
---|
787 | wire [1:0] isfsr_ctxt_g; |
---|
788 | wire [`TLU_THRD_NUM-1:0] tick_en; |
---|
789 | wire local_sync_trap_m, local_sync_trap_g; |
---|
790 | wire dside_sync_trap_g, early_dside_trap_g; |
---|
791 | wire true_hscpd_dacc_excpt_m; |
---|
792 | wire true_qtail_dacc_excpt_m; |
---|
793 | // wire lsu_higher_priority; |
---|
794 | // wire dside_higher_priority; |
---|
795 | wire [`TSA_TTYPE_WIDTH-1:0] local_sync_ttype_g; |
---|
796 | wire local_higher_ttype_flg; |
---|
797 | // wire [`TSA_TTYPE_WIDTH-1:0] dside_sync_ttype_pre_g; |
---|
798 | // wire [`TSA_TTYPE_WIDTH-1:0] dside_sync_ttype_g; |
---|
799 | wire [`TSA_TTYPE_WIDTH-1:0] early_sync_ttype_g, early_sync_ttype_w2; |
---|
800 | wire [`TSA_TTYPE_WIDTH-1:0] adj_lsu_ttype_w2; |
---|
801 | wire [`TSA_TTYPE_WIDTH-1:0] lsu_tlu_ttype_w2; |
---|
802 | // wire [`TSA_TTYPE_WIDTH-3:0] lsu_tlu_async_ttype_w2; |
---|
803 | // wire [`TSA_TTYPE_WIDTH-3:0] rst_ttype_g; |
---|
804 | wire [`TSA_TTYPE_WIDTH-3:0] rst_hwint_ttype_g, rst_hwint_ttype_w2; |
---|
805 | wire [`TSA_TTYPE_WIDTH-3:0] rst_ttype_w2, rst_hwdr_ttype_w2; |
---|
806 | wire [`TSA_TTYPE_WIDTH-1:0] early_ttype_g; |
---|
807 | wire trp_lvl0_at_maxtlless1,trp_lvl1_at_maxtlless1; |
---|
808 | wire trp_lvl2_at_maxtlless1,trp_lvl3_at_maxtlless1; |
---|
809 | wire trp_lvl_at_maxtlless1; |
---|
810 | wire [`TLU_THRD_NUM-1:0] tpl_maxless1; |
---|
811 | wire redmode_insertion, redmode_insertion_w2; |
---|
812 | wire [`TLU_THRD_NUM-1:0] tlu_lsu_redmode_rst; |
---|
813 | wire trap_to_redmode; |
---|
814 | wire pending_thrd_event_taken; |
---|
815 | // added or modified for timing |
---|
816 | wire [`TLU_THRD_NUM-2:0] thrd_rsel_g; |
---|
817 | wire [`TLU_THRD_NUM-2:0] thrd_rsel_w2; |
---|
818 | wire va_oor_inst_acc_excp_g; // qualified va_oor_jl_ret trap |
---|
819 | wire va_oor_data_acc_excp_g, va_oor_data_acc_excp_w2; // qualified exu_tlu_va_oor_m trap |
---|
820 | wire sir_inst_g; |
---|
821 | wire [`TLU_THRD_NUM-1:0] pending_trap_sel; |
---|
822 | // |
---|
823 | // modified to support lsu_deferred traps; modified for timing |
---|
824 | wire reset_sel_g, reset_sel_w2; |
---|
825 | wire [2:0] reset_id_g; |
---|
826 | wire tick_npt0,tick_npt1,tick_npt2,tick_npt3; |
---|
827 | wire tick_ctl_din; |
---|
828 | // modified due to early_flush_pipe timing fix |
---|
829 | // wire tlu_tick_npt_priv_act; |
---|
830 | wire tick_npt_priv_act_g; |
---|
831 | wire tick_npt_priv_act_m; |
---|
832 | wire exu_tick_npt_priv_act_m; |
---|
833 | // |
---|
834 | // moved the tick_indis and stick_intdis logic to tlu_tdp |
---|
835 | // wire tick_intdis0,tick_intdis1,tick_intdis2,tick_intdis3; |
---|
836 | // wire stick_intdis0,stick_intdis1,stick_intdis2,stick_intdis3; |
---|
837 | // wire [`TLU_THRD_NUM-1:0] tick_intrpt; |
---|
838 | // wire [`TLU_THRD_NUM-1:0] tick_intclr; // use to clear the tick_int bit |
---|
839 | // wire wsr_tick_intclr_g; // clear the tick_int through asr write |
---|
840 | // wire wsr_tick_intset_g; // set the tick_int through asr write |
---|
841 | // add and/or modified for hypervisor support |
---|
842 | // wire [1:0] cwp_cmplt_tid_w2, cwp_cmplt_tid_g; |
---|
843 | // wire wsr_illeg_globals_g; // mutual exclusiveness of the pstate globals |
---|
844 | // wire wsr_stick_intclr_g; // clear the stick_int through asr write |
---|
845 | // wire wsr_stick_intset_g; // set the stick_int through asr write |
---|
846 | // wire [`TLU_THRD_NUM-1:0] stick_intrpt; |
---|
847 | // wire [`TLU_THRD_NUM-1:0] stick_int_en, stick_int_din; |
---|
848 | // wire [`TLU_THRD_NUM-1:0] tick_int_en, tick_int_din; |
---|
849 | // |
---|
850 | // wire [1:0] cwp_cmplt_tid_g; |
---|
851 | wire [1:0] true_trap_tid_g; |
---|
852 | wire [1:0] early_trap_tid_g; |
---|
853 | wire [1:0] true_trap_tid_w2; |
---|
854 | wire trp_lvl_zero; |
---|
855 | wire misalign_addr_jmpl_rtn_g,misalign_addr_ldst_atm_g; |
---|
856 | wire tt_init_en; |
---|
857 | wire [`TLU_THRD_NUM-1:0] tt_init_rst; |
---|
858 | wire [`TLU_THRD_NUM-1:0] tt_unwritten; |
---|
859 | wire ttype_written; |
---|
860 | wire ttype_unwritten_sel; |
---|
861 | wire reset_d1; |
---|
862 | wire thread_tl_zero; |
---|
863 | // wire iside_trap; |
---|
864 | wire [7:0] isfsr_asi_g; |
---|
865 | wire thread_tl_zero_m,thread_tl_zero_g; |
---|
866 | wire tlu_trap_to_hyper_g, tlu_trap_to_hyper_w2; |
---|
867 | // wire hyper_wdr_trap; |
---|
868 | wire hyper_wdr_early_trap_g, hyper_wdr_early_trap_w2, hyper_wdr_trap_w2; |
---|
869 | wire tlu_priv_traps_w2; |
---|
870 | wire [2:0] tlu_early_priv_element_g; |
---|
871 | wire [2:0] tlu_early_priv_element_w2; |
---|
872 | wire [`TLU_THRD_NUM-1:0] trp_lvl_gte_maxstl; |
---|
873 | wire [`TLU_THRD_NUM-1:0] trp_lvl_at_maxstl; |
---|
874 | |
---|
875 | // This section was modified to abide to the Niagara synthesis methodology |
---|
876 | // |
---|
877 | //reg tpc_rw_e, tpc_rw_m, tpc_rw_g; |
---|
878 | //reg tnpc_rw_e, tnpc_rw_m, tnpc_rw_g; |
---|
879 | //reg tstate_rw_e, tstate_rw_m, tstate_rw_g, tstate_rw_w2; |
---|
880 | //reg ttype_rw_e, ttype_rw_m, ttype_rw_g, ttype_rw_w2; |
---|
881 | //reg tick_rw_e, tick_rw_m, tick_rw_g; |
---|
882 | //reg tick_npriv_r_e, tick_npriv_r_m, tick_npriv_r_g; |
---|
883 | //reg tickcmp_rw_e, tickcmp_rw_m, tickcmp_rw_g; |
---|
884 | //reg tba_rw_e, tba_rw_m, tba_rw_g; |
---|
885 | //reg pstate_rw_e, pstate_rw_m, pstate_rw_g; |
---|
886 | //reg pil_rw_e, pil_rw_m, pil_rw_g; |
---|
887 | //reg tl_rw_e, tl_rw_m, tl_rw_g; |
---|
888 | //reg wsr_inst_e, wsr_inst_m, wsr_inst_g_unflushed; |
---|
889 | //reg set_sftint_e, clr_sftint_e, sftint_rg_rw_e; |
---|
890 | //reg set_sftint_m, clr_sftint_m, sftint_rg_rw_m; |
---|
891 | //reg set_sftint_g, clr_sftint_g, sftint_rg_rw_g; |
---|
892 | // |
---|
893 | wire tpc_rw_e, tpc_rw_m, tpc_rw_g, tpc_rw_w2; |
---|
894 | wire tnpc_rw_e, tnpc_rw_m, tnpc_rw_g, tnpc_rw_w2; |
---|
895 | wire tstate_rw_e, tstate_rw_m, tstate_rw_g, tstate_rw_w2; |
---|
896 | wire ttype_rw_e, ttype_rw_m, ttype_rw_g, ttype_rw_w2; |
---|
897 | wire htstate_rw_w2; |
---|
898 | wire tick_rw_e, tick_rw_m, tick_rw_g; |
---|
899 | wire tick_npriv_r_e, tick_npriv_r_m, tick_npriv_r_g; |
---|
900 | wire tickcmp_rw_e, tickcmp_rw_m, tickcmp_rw_g; |
---|
901 | wire tba_rw_e, tba_rw_m, tba_rw_g; |
---|
902 | wire pstate_rw_e, pstate_rw_m, pstate_rw_g, pstate_rw_w2; |
---|
903 | wire pil_rw_e, pil_rw_m, pil_rw_g; |
---|
904 | wire tl_rw_e, tl_rw_m, tl_rw_g, tl_rw_w2; |
---|
905 | wire htickcmp_rw_m, htickcmp_rw_g; |
---|
906 | wire wsr_inst_e, wsr_inst_m, wsr_inst_g_unflushed; |
---|
907 | wire set_sftint_e, clr_sftint_e, sftint_rg_rw_e; |
---|
908 | wire set_sftint_m, clr_sftint_m, sftint_rg_rw_m; |
---|
909 | wire set_sftint_g, clr_sftint_g, sftint_rg_rw_g; |
---|
910 | // |
---|
911 | wire wsr_inst_g, wsr_inst_w2; |
---|
912 | wire inst_ifu_flush_w; |
---|
913 | wire inst_ifu_flush2_w; |
---|
914 | wire clk; |
---|
915 | |
---|
916 | //========================================================================================= |
---|
917 | //========================================================================================= |
---|
918 | //========================================================================================= |
---|
919 | |
---|
920 | wire [3:0] tlu_pstate_priv_buf; |
---|
921 | |
---|
922 | assign tlu_pstate_priv_buf[3:0] = tlu_pstate_priv[3:0]; |
---|
923 | |
---|
924 | //========================================================================================= |
---|
925 | //========================================================================================= |
---|
926 | //========================================================================================= |
---|
927 | // reset |
---|
928 | //========================================================================================= |
---|
929 | |
---|
930 | dffrl_async dffrl_local_rst_l( |
---|
931 | .din (grst_l), |
---|
932 | .clk (clk), |
---|
933 | .rst_l(arst_l), |
---|
934 | .q (local_rst_l), |
---|
935 | .se (se), |
---|
936 | .si (), |
---|
937 | .so () |
---|
938 | ); |
---|
939 | |
---|
940 | assign tlu_rst = ~tlu_rst_l; |
---|
941 | assign local_rst = ~tlu_rst_l; |
---|
942 | assign tlu_rst_l = local_rst_l; |
---|
943 | |
---|
944 | //========================================================================================= |
---|
945 | // Rename |
---|
946 | //========================================================================================= |
---|
947 | |
---|
948 | // assign tlu_lsu_redmode[3:0] = tlu_int_redmode[3:0]; |
---|
949 | assign clk = rclk; |
---|
950 | |
---|
951 | //========================================================================================= |
---|
952 | // Misc. TDP Control |
---|
953 | //========================================================================================= |
---|
954 | // |
---|
955 | // modified for bug 5436: Niagara 2.0 |
---|
956 | /* |
---|
957 | assign pcr_ut_e = |
---|
958 | (tlu_thrd_rsel_e[0]) ? tlu_pcr_ut[0]: |
---|
959 | (tlu_thrd_rsel_e[1]) ? tlu_pcr_ut[1]: |
---|
960 | (tlu_thrd_rsel_e[2]) ? tlu_pcr_ut[2]: |
---|
961 | tlu_pcr_ut[3]; |
---|
962 | |
---|
963 | assign pcr_st_e = |
---|
964 | (tlu_thrd_rsel_e[0]) ? tlu_pcr_st[0]: |
---|
965 | (tlu_thrd_rsel_e[1]) ? tlu_pcr_st[1]: |
---|
966 | (tlu_thrd_rsel_e[2]) ? tlu_pcr_st[2]: |
---|
967 | tlu_pcr_st[3]; |
---|
968 | */ |
---|
969 | |
---|
970 | assign tlu_thread_inst_vld_g[0] = |
---|
971 | inst_vld_g & thread0_rsel_g & ~pend_pich_cnt_hld[0]; |
---|
972 | assign tlu_thread_inst_vld_g[1] = |
---|
973 | inst_vld_g & thread1_rsel_g & ~pend_pich_cnt_hld[1]; |
---|
974 | assign tlu_thread_inst_vld_g[2] = |
---|
975 | inst_vld_g & thread2_rsel_g & ~pend_pich_cnt_hld[2]; |
---|
976 | assign tlu_thread_inst_vld_g[3] = |
---|
977 | inst_vld_g & thread3_rsel_g & ~pend_pich_cnt_hld[3]; |
---|
978 | |
---|
979 | assign thread_inst_vld_w2[0] = inst_vld_w2 & thread0_wsel_w2; |
---|
980 | assign thread_inst_vld_w2[1] = inst_vld_w2 & thread1_wsel_w2; |
---|
981 | assign thread_inst_vld_w2[2] = inst_vld_w2 & thread2_wsel_w2; |
---|
982 | assign thread_inst_vld_w2[3] = inst_vld_w2 & thread3_wsel_w2; |
---|
983 | |
---|
984 | assign thread_inst_vld_g[0] = inst_vld_g & thread0_rsel_g; |
---|
985 | assign thread_inst_vld_g[1] = inst_vld_g & thread1_rsel_g; |
---|
986 | assign thread_inst_vld_g[2] = inst_vld_g & thread2_rsel_g; |
---|
987 | assign thread_inst_vld_g[3] = inst_vld_g & thread3_rsel_g; |
---|
988 | |
---|
989 | // added for timing |
---|
990 | // |
---|
991 | assign tlu_trp_lvl[2:0] = |
---|
992 | thread0_rsel_e ? trp_lvl0[2:0] : |
---|
993 | thread1_rsel_e ? trp_lvl1[2:0] : |
---|
994 | thread2_rsel_e ? trp_lvl2[2:0] : |
---|
995 | thread3_rsel_e ? trp_lvl3[2:0] : 3'bxxx; |
---|
996 | |
---|
997 | assign tlu_pil[3:0] = |
---|
998 | thread0_rsel_e ? true_pil0[3:0] : |
---|
999 | thread1_rsel_e ? true_pil1[3:0] : |
---|
1000 | thread2_rsel_e ? true_pil2[3:0] : |
---|
1001 | thread3_rsel_e ? true_pil3[3:0] : 4'bxxx; |
---|
1002 | |
---|
1003 | assign tlu_tba_en_l[0] = ~(tba_rw_g & wsr_inst_g & thread0_wsel_g); |
---|
1004 | assign tlu_tba_en_l[1] = ~(tba_rw_g & wsr_inst_g & thread1_wsel_g); |
---|
1005 | assign tlu_tba_en_l[2] = ~(tba_rw_g & wsr_inst_g & thread2_wsel_g); |
---|
1006 | assign tlu_tba_en_l[3] = ~(tba_rw_g & wsr_inst_g & thread3_wsel_g); |
---|
1007 | |
---|
1008 | |
---|
1009 | assign tlu_tick_en_l = ~(tick_rw_g & wsr_inst_g); |
---|
1010 | // the logic equations can be made common (grape) |
---|
1011 | // reset may not have to be factored in !!! |
---|
1012 | assign tick_en[0] = (tick_rw_g & wsr_inst_g & thread0_wsel_g) | local_rst | por_rstint0_g; |
---|
1013 | assign tick_en[1] = (tick_rw_g & wsr_inst_g & thread1_wsel_g) | local_rst | por_rstint1_g; |
---|
1014 | assign tick_en[2] = (tick_rw_g & wsr_inst_g & thread2_wsel_g) | local_rst | por_rstint2_g; |
---|
1015 | assign tick_en[3] = (tick_rw_g & wsr_inst_g & thread3_wsel_g) | local_rst | por_rstint3_g; |
---|
1016 | |
---|
1017 | // modified for bug 4763 |
---|
1018 | assign tlu_tickcmp_en_l[0] = ~((tickcmp_rw_g & wsr_inst_g & thread0_wsel_g)); |
---|
1019 | assign tlu_tickcmp_en_l[1] = ~((tickcmp_rw_g & wsr_inst_g & thread1_wsel_g)); |
---|
1020 | assign tlu_tickcmp_en_l[2] = ~((tickcmp_rw_g & wsr_inst_g & thread2_wsel_g)); |
---|
1021 | assign tlu_tickcmp_en_l[3] = ~((tickcmp_rw_g & wsr_inst_g & thread3_wsel_g)); |
---|
1022 | // |
---|
1023 | // modified for bug 4763 |
---|
1024 | assign tlu_stickcmp_en_l[0] = ~((stickcmp_rw_g & wsr_inst_g & thread0_wsel_g)); |
---|
1025 | assign tlu_stickcmp_en_l[1] = ~((stickcmp_rw_g & wsr_inst_g & thread1_wsel_g)); |
---|
1026 | assign tlu_stickcmp_en_l[2] = ~((stickcmp_rw_g & wsr_inst_g & thread2_wsel_g)); |
---|
1027 | assign tlu_stickcmp_en_l[3] = ~((stickcmp_rw_g & wsr_inst_g & thread3_wsel_g)); |
---|
1028 | // |
---|
1029 | // modified for bug 4763 |
---|
1030 | assign tlu_htickcmp_en_l[0] = ~((htickcmp_rw_g & wsr_inst_g & thread0_wsel_g)); |
---|
1031 | assign tlu_htickcmp_en_l[1] = ~((htickcmp_rw_g & wsr_inst_g & thread1_wsel_g)); |
---|
1032 | assign tlu_htickcmp_en_l[2] = ~((htickcmp_rw_g & wsr_inst_g & thread2_wsel_g)); |
---|
1033 | assign tlu_htickcmp_en_l[3] = ~((htickcmp_rw_g & wsr_inst_g & thread3_wsel_g)); |
---|
1034 | |
---|
1035 | // modified for bug 1266 and 1264 |
---|
1036 | dff_s dff_stgg_va_oor_jl_ret_g ( |
---|
1037 | .din (exu_tlu_va_oor_jl_ret_m), |
---|
1038 | .q (va_oor_jl_ret_g), |
---|
1039 | .clk (clk), |
---|
1040 | .se (se), |
---|
1041 | .si (), |
---|
1042 | .so () |
---|
1043 | ); |
---|
1044 | |
---|
1045 | // This may have to be changed as all lsu traps may not use mmu globals |
---|
1046 | // ffu traps may have to be factored in once round-robin selection in place. |
---|
1047 | // factor in ldst related mem-address exceptions. |
---|
1048 | // |
---|
1049 | // modified for bug 1264 and 1266 |
---|
1050 | // prioritize the exu_tlu_va_oor_jl_ret_m trap; if no higher traps are happening initiate the trap |
---|
1051 | // |
---|
1052 | assign va_oor_inst_acc_excp_g = |
---|
1053 | va_oor_jl_ret_g & inst_vld_g & |
---|
1054 | ~(exu_ttype_vld_g | ifu_ttype_vld_g | lsu_tlu_priv_action_g | local_sync_trap_g); |
---|
1055 | // |
---|
1056 | // added for bug 1316 |
---|
1057 | // prioritize the exu_tlu_va_oor_jl_ret_m trap; if no higher traps are happening initiate the trap |
---|
1058 | // modified for bug 3464 and bug 4873 |
---|
1059 | assign va_oor_data_acc_excp_g = |
---|
1060 | (dmmu_va_oor_g & inst_vld_g) & ~(exu_ttype_vld_g | ifu_ttype_vld_g | |
---|
1061 | lsu_tlu_priv_action_g | misalign_addr_ldst_atm_g | lsu_tlu_wtchpt_trp_g); |
---|
1062 | // |
---|
1063 | // added for timing |
---|
1064 | dffr_s dffr_va_oor_data_acc_excp_w2 ( |
---|
1065 | .din (va_oor_data_acc_excp_g), |
---|
1066 | .q (va_oor_data_acc_excp_w2), |
---|
1067 | .rst (local_rst), |
---|
1068 | .clk (clk), |
---|
1069 | .se (se), |
---|
1070 | .si (), |
---|
1071 | .so () |
---|
1072 | ); |
---|
1073 | // |
---|
1074 | // exu should qualify with priv bit. Assume ttype vld is asserted. |
---|
1075 | dff_s #(1) dff_stgg_sir_g ( |
---|
1076 | .din (ifu_tlu_sir_inst_m), |
---|
1077 | .q (sir_inst_g), |
---|
1078 | .clk (clk), |
---|
1079 | .se (se), |
---|
1080 | .si (), |
---|
1081 | .so () |
---|
1082 | ); |
---|
1083 | |
---|
1084 | assign pstate_rmode[3:0] = tlu_int_redmode[3:0]; |
---|
1085 | |
---|
1086 | wire intrpt_taken; |
---|
1087 | // recoded for bug 2644 |
---|
1088 | // assign intrpt_taken = rstint_taken | hwint_taken | swint_taken; |
---|
1089 | assign intrpt_taken = |
---|
1090 | rstint_taken | hwint_taken | sirint_taken; |
---|
1091 | // |
---|
1092 | // modified for bug 4906 |
---|
1093 | assign trp_lvl_at_maxtlless1 = |
---|
1094 | tpl_maxless1[0] | tpl_maxless1[1] | tpl_maxless1[2] | tpl_maxless1[3]; |
---|
1095 | assign tpl_maxless1[0] = |
---|
1096 | (trp_lvl0_at_maxtlless1 | pstate_rmode[0]) & thrd0_traps; |
---|
1097 | assign tpl_maxless1[1] = |
---|
1098 | (trp_lvl1_at_maxtlless1 | pstate_rmode[1]) & thrd1_traps; |
---|
1099 | assign tpl_maxless1[2] = |
---|
1100 | (trp_lvl2_at_maxtlless1 | pstate_rmode[2]) & thrd2_traps; |
---|
1101 | assign tpl_maxless1[3] = |
---|
1102 | (trp_lvl3_at_maxtlless1 | pstate_rmode[3]) & thrd3_traps; |
---|
1103 | |
---|
1104 | // thread enters redstate |
---|
1105 | // modified for bug 3919 |
---|
1106 | // assign trap_to_redmode = trp_lvl_at_maxtlless1 & ~intrpt_taken; |
---|
1107 | assign trap_to_redmode = trp_lvl_at_maxtlless1 & ~(rstint_taken | sirint_taken); |
---|
1108 | |
---|
1109 | assign tlu_lsu_redmode_rst[0] = |
---|
1110 | ((rstint_taken | sirint_taken) & thread0_rsel_g) | |
---|
1111 | tpl_maxless1[0] | internal_wdr_trap[0] | local_rst ; |
---|
1112 | assign tlu_lsu_redmode_rst[1] = |
---|
1113 | ((rstint_taken | sirint_taken) & thread1_rsel_g) | |
---|
1114 | tpl_maxless1[1] | internal_wdr_trap[1] | local_rst ; |
---|
1115 | assign tlu_lsu_redmode_rst[2] = |
---|
1116 | ((rstint_taken | sirint_taken) & thread2_rsel_g) | |
---|
1117 | tpl_maxless1[2] | internal_wdr_trap[2] | local_rst ; |
---|
1118 | assign tlu_lsu_redmode_rst[3] = |
---|
1119 | ((rstint_taken | sirint_taken) & thread3_rsel_g) | |
---|
1120 | tpl_maxless1[3] | internal_wdr_trap[3] | local_rst ; |
---|
1121 | |
---|
1122 | dff_s #(`TLU_THRD_NUM) dff_tlu_lsu_redmode_rst_d1 ( |
---|
1123 | .din (tlu_lsu_redmode_rst[`TLU_THRD_NUM-1:0]), |
---|
1124 | .q (tlu_lsu_redmode_rst_d1[`TLU_THRD_NUM-1:0]), |
---|
1125 | .clk (clk), |
---|
1126 | .se (se), |
---|
1127 | .si (), |
---|
1128 | .so () |
---|
1129 | ); |
---|
1130 | |
---|
1131 | assign redmode_insertion = |
---|
1132 | local_rst | rstint_taken | trap_to_redmode | internal_wdr | sirint_taken; |
---|
1133 | // sir_inst_g; // sigm inst in priv mode |
---|
1134 | // |
---|
1135 | // added for timing |
---|
1136 | dff_s dff_redmode_insertion_w2 ( |
---|
1137 | .din (redmode_insertion), |
---|
1138 | .q (redmode_insertion_w2), |
---|
1139 | .clk (clk), |
---|
1140 | .se (se), |
---|
1141 | .si (), |
---|
1142 | .so () |
---|
1143 | ); |
---|
1144 | |
---|
1145 | assign tlu_select_redmode = redmode_insertion_w2; |
---|
1146 | |
---|
1147 | // added for bug 2808 |
---|
1148 | assign ibrkpt_trap_m = |
---|
1149 | (ifu_tlu_ttype_m[8:0]== 9'h076) & ifu_tlu_ttype_vld_m; |
---|
1150 | |
---|
1151 | dffr_s dffr_ibrkpt_trap_g ( |
---|
1152 | .din (ibrkpt_trap_m), |
---|
1153 | .q (ibrkpt_trap_g), |
---|
1154 | .rst (local_rst), |
---|
1155 | .clk (clk), |
---|
1156 | .se (se), |
---|
1157 | .si (), |
---|
1158 | .so () |
---|
1159 | ); |
---|
1160 | |
---|
1161 | dffr_s dffr_ibrkpt_trap_w2 ( |
---|
1162 | .din (ibrkpt_trap_g), |
---|
1163 | .q (ibrkpt_trap_w2), |
---|
1164 | .rst (local_rst), |
---|
1165 | .clk (clk), |
---|
1166 | .se (se), |
---|
1167 | .si (), |
---|
1168 | .so () |
---|
1169 | ); |
---|
1170 | |
---|
1171 | // assign tlu_ibrkpt_trap_g = ibrkpt_trap_g; |
---|
1172 | assign tlu_ibrkpt_trap_w2 = ibrkpt_trap_w2; |
---|
1173 | |
---|
1174 | // modified for bug 1575 |
---|
1175 | // assign tlu_pstate_din_sel[2] = ~(tlu_pstate_din_sel[0] | tlu_pstate_din_sel[1]); |
---|
1176 | |
---|
1177 | // the selection pstate by thread |
---|
1178 | // modified for the hypervisory support |
---|
1179 | |
---|
1180 | assign tlu_pstate_din_sel0[0] = dnrtry_inst_w2[0] & ~rst_tri_en; |
---|
1181 | assign tlu_pstate_din_sel0[1] = (pstate_rw_w2 & wsr_inst_w2) & ~rst_tri_en & |
---|
1182 | ~tlu_pstate_din_sel0[0] & thread0_wsel_w2; |
---|
1183 | |
---|
1184 | assign tlu_pstate_din_sel1[0] = dnrtry_inst_w2[1] & ~rst_tri_en; |
---|
1185 | assign tlu_pstate_din_sel1[1] = (pstate_rw_w2 & wsr_inst_w2) & ~rst_tri_en & |
---|
1186 | ~tlu_pstate_din_sel1[0] & thread1_wsel_w2; |
---|
1187 | |
---|
1188 | assign tlu_pstate_din_sel2[0] = dnrtry_inst_w2[2] & ~rst_tri_en; |
---|
1189 | assign tlu_pstate_din_sel2[1] = (pstate_rw_w2 & wsr_inst_w2) & ~rst_tri_en & |
---|
1190 | ~tlu_pstate_din_sel2[0] & thread2_wsel_w2; |
---|
1191 | |
---|
1192 | assign tlu_pstate_din_sel3[0] = dnrtry_inst_w2[3] & ~rst_tri_en; |
---|
1193 | assign tlu_pstate_din_sel3[1] = (pstate_rw_w2 & wsr_inst_w2) & ~rst_tri_en & |
---|
1194 | ~tlu_pstate_din_sel3[0] & thread3_wsel_w2; |
---|
1195 | |
---|
1196 | assign restore_pc_sel_g = (dnrtry_inst_g & cwp_fastcmplt_g) | cwp_cmplt_g; |
---|
1197 | // |
---|
1198 | dffr_s dffr_restore_pc_sel_w1 ( |
---|
1199 | .din (restore_pc_sel_g), |
---|
1200 | .q (restore_pc_sel_w1), |
---|
1201 | .rst (local_rst), |
---|
1202 | .clk (clk), |
---|
1203 | .se (se), |
---|
1204 | .si (), |
---|
1205 | .so () |
---|
1206 | ); |
---|
1207 | |
---|
1208 | assign tlu_restore_pc_sel_w1 = restore_pc_sel_w1; |
---|
1209 | // |
---|
1210 | // modified for the hypervisor support and timing |
---|
1211 | |
---|
1212 | assign update_pstate_w2[0] = |
---|
1213 | thrd0_traps_w2 | dnrtry_inst_w2[0] | |
---|
1214 | ((pstate_rw_w2 & wsr_inst_w2) & thread0_wsel_w2); |
---|
1215 | assign update_pstate_w2[1] = |
---|
1216 | thrd1_traps_w2 | dnrtry_inst_w2[1] | |
---|
1217 | ((pstate_rw_w2 & wsr_inst_w2) & thread1_wsel_w2); |
---|
1218 | assign update_pstate_w2[2] = |
---|
1219 | thrd2_traps_w2 | dnrtry_inst_w2[2] | |
---|
1220 | ((pstate_rw_w2 & wsr_inst_w2) & thread2_wsel_w2); |
---|
1221 | assign update_pstate_w2[3] = |
---|
1222 | thrd3_traps_w2 | dnrtry_inst_w2[3] | |
---|
1223 | ((pstate_rw_w2 & wsr_inst_w2) & thread3_wsel_w2); |
---|
1224 | |
---|
1225 | // recoded for timing |
---|
1226 | // modified for bug 4284 |
---|
1227 | assign tlu_update_pc_l_w[0] = ~(inst_vld_g & thread0_rsel_g); |
---|
1228 | assign tlu_update_pc_l_w[1] = ~(inst_vld_g & thread1_rsel_g); |
---|
1229 | assign tlu_update_pc_l_w[2] = ~(inst_vld_g & thread2_rsel_g); |
---|
1230 | assign tlu_update_pc_l_w[3] = ~(inst_vld_g & thread3_rsel_g); |
---|
1231 | // |
---|
1232 | // modified for timing |
---|
1233 | assign tlu_thrd_wsel_w2[`TLU_THRD_NUM-1:0] = |
---|
1234 | {thread3_wtrp_w2, thread2_wtrp_w2, thread1_wtrp_w2, thread0_wtrp_w2}; |
---|
1235 | |
---|
1236 | //wire pending_thrd_event_taken_w2; |
---|
1237 | assign pending_thrd_event_taken = |
---|
1238 | pending_thrd0_event_taken | pending_thrd1_event_taken | |
---|
1239 | pending_thrd2_event_taken | pending_thrd3_event_taken; |
---|
1240 | // |
---|
1241 | // modified due to timing |
---|
1242 | assign tlu_tl_gt_0_w2 = |
---|
1243 | thrd_rsel_w2[0] ? tl0_gt_0 : |
---|
1244 | (thrd_rsel_w2[1] ? tl1_gt_0 : |
---|
1245 | (thrd_rsel_w2[2] ? tl2_gt_0 : tl3_gt_0)); |
---|
1246 | |
---|
1247 | assign thrd_rsel_g[0] = (thread0_rsel_g & ~pending_thrd_event_taken) | pending_thrd0_event_taken; |
---|
1248 | assign thrd_rsel_g[1] = (thread1_rsel_g & ~pending_thrd_event_taken) | pending_thrd1_event_taken; |
---|
1249 | assign thrd_rsel_g[2] = (thread2_rsel_g & ~pending_thrd_event_taken) | pending_thrd2_event_taken; |
---|
1250 | |
---|
1251 | dff_s #(`TLU_THRD_NUM-1) dff_thrd_rsel_w2 ( |
---|
1252 | .din (thrd_rsel_g[`TLU_THRD_NUM-2:0]), |
---|
1253 | .q (thrd_rsel_w2[`TLU_THRD_NUM-2:0]), |
---|
1254 | .clk (clk), |
---|
1255 | .se (se), |
---|
1256 | .si (), |
---|
1257 | .so () |
---|
1258 | ); |
---|
1259 | // |
---|
1260 | // modified for the tsa_wdata bug (tlu_tdp) |
---|
1261 | // |
---|
1262 | // assign tlu_wr_tsa_inst_g = tsa_wr_tid_sel_g; |
---|
1263 | // |
---|
1264 | // added for timing |
---|
1265 | assign tlu_wr_tsa_inst_w2 = |
---|
1266 | (wsr_inst_w2 & (tstate_rw_w2 | tpc_rw_w2 | tnpc_rw_w2 | |
---|
1267 | ttype_rw_w2 | htstate_rw_w2)) & ~sync_trap_taken_w2; |
---|
1268 | |
---|
1269 | // assign tlu_wsr_inst_g = wsr_inst_g; |
---|
1270 | // |
---|
1271 | // modified for timing |
---|
1272 | /* |
---|
1273 | assign tlu_update_pstate_l_g[0] = ~(update_pstate_g[0] | local_rst); |
---|
1274 | assign tlu_update_pstate_l_g[1] = ~(update_pstate_g[1] | local_rst); |
---|
1275 | assign tlu_update_pstate_l_g[2] = ~(update_pstate_g[2] | local_rst); |
---|
1276 | assign tlu_update_pstate_l_g[3] = ~(update_pstate_g[3] | local_rst); |
---|
1277 | */ |
---|
1278 | assign tlu_update_pstate_l_w2[0] = ~(update_pstate_w2[0] | local_rst); |
---|
1279 | assign tlu_update_pstate_l_w2[1] = ~(update_pstate_w2[1] | local_rst); |
---|
1280 | assign tlu_update_pstate_l_w2[2] = ~(update_pstate_w2[2] | local_rst); |
---|
1281 | assign tlu_update_pstate_l_w2[3] = ~(update_pstate_w2[3] | local_rst); |
---|
1282 | |
---|
1283 | //========================================================================================= |
---|
1284 | // rdpr mux selects - recoded due to timing |
---|
1285 | //========================================================================================= |
---|
1286 | // modified for bug 1352 - added the non-privedged term in the read select |
---|
1287 | // |
---|
1288 | // modified for bug 1859 |
---|
1289 | // assign tlu_rdpr_mx1_sel[0] = tpc_rw_e; |
---|
1290 | // assign tlu_rdpr_mx1_sel[1] = tnpc_rw_e; |
---|
1291 | // assign tlu_rdpr_mx1_sel[2] = tick_rw_e | tick_npriv_r_e; |
---|
1292 | // assign tlu_rdpr_mx1_sel[3] = tickcmp_rw_e; |
---|
1293 | // assign tlu_rdpr_mx2_sel[0] = tstate_rw_e; |
---|
1294 | // assign tlu_rdpr_mx2_sel[1] = tba_rw_e; |
---|
1295 | // assign tlu_rdpr_mx2_sel[2] = sftint_rg_rw_e; |
---|
1296 | // assign tlu_rdpr_mx3_sel[0] = ttype_rw_e; |
---|
1297 | // assign tlu_rdpr_mx3_sel[2] = tl_rw_e; |
---|
1298 | // assign tlu_rdpr_mx3_sel[3] = pil_rw_e; |
---|
1299 | // assign tlu_rdpr_mx4_sel[0] = (|tlu_rdpr_mx2_sel[`RDPR_MX2_SEL_WIDTH-1:0]) | tlu_htba_mx2_sel; |
---|
1300 | // assign tlu_rdpr_mx4_sel[1] = (ttype_rw_e & ttype_written) | pstate_rw_e | tl_rw_e | pil_rw_e; |
---|
1301 | // assign tlu_rdpr_mx4_sel[2] = tlu_rdpr_mx5_active; |
---|
1302 | // assign tlu_rdpr_mx6_sel[0] = (|tlu_rdpr_mx1_sel[3:0]); |
---|
1303 | // assign tlu_rdpr_mx6_sel[1] = stickcmp_rw_e; |
---|
1304 | // assign tlu_rdpr_mx6_sel[2] = tlu_htickcmp_rw_e; |
---|
1305 | // assign tlu_rdpr_mx7_sel[0] = |(tlu_rdpr_mx4_sel[2:0]); |
---|
1306 | // assign tlu_rdpr_mx7_sel[1] = |(tlu_rdpr_mx6_sel[2:0]); |
---|
1307 | // assign tlu_rdpr_mx7_sel[2] = ttype_unwritten_sel; |
---|
1308 | |
---|
1309 | assign local_rdpr_mx1_sel[0] = tick_rw_e | tick_npriv_r_e; |
---|
1310 | assign local_rdpr_mx1_sel[1] = tickcmp_rw_e; |
---|
1311 | assign local_rdpr_mx1_sel[2] = stickcmp_rw_e; |
---|
1312 | assign local_rdpr_mx1_sel[3] = tlu_htickcmp_rw_e; |
---|
1313 | // |
---|
1314 | assign tlu_rdpr_mx1_sel[0] = local_rdpr_mx1_sel[1] & ~rst_tri_en; |
---|
1315 | assign tlu_rdpr_mx1_sel[1] = local_rdpr_mx1_sel[2] & ~rst_tri_en; |
---|
1316 | assign tlu_rdpr_mx1_sel[2] = local_rdpr_mx1_sel[3] & ~rst_tri_en; |
---|
1317 | // |
---|
1318 | assign local_rdpr_mx2_sel[0] = tlu_hyperv_rdpr_sel[0]; |
---|
1319 | assign local_rdpr_mx2_sel[1] = tlu_hyperv_rdpr_sel[1]; |
---|
1320 | assign local_rdpr_mx2_sel[2] = tl_rw_e; |
---|
1321 | assign local_rdpr_mx2_sel[3] = pil_rw_e; |
---|
1322 | // |
---|
1323 | assign tlu_rdpr_mx2_sel[0] = local_rdpr_mx2_sel[1] & ~rst_tri_en; |
---|
1324 | assign tlu_rdpr_mx2_sel[1] = local_rdpr_mx2_sel[2] & ~rst_tri_en; |
---|
1325 | assign tlu_rdpr_mx2_sel[2] = local_rdpr_mx2_sel[3] & ~rst_tri_en; |
---|
1326 | // |
---|
1327 | assign local_rdpr_mx3_sel[0] = sftint_rg_rw_e; |
---|
1328 | assign local_rdpr_mx3_sel[1] = pstate_rw_e; |
---|
1329 | assign local_rdpr_mx3_sel[2] = tlu_hyperv_rdpr_sel[2]; |
---|
1330 | // |
---|
1331 | assign tlu_rdpr_mx3_sel[0] = local_rdpr_mx3_sel[1] & ~rst_tri_en; |
---|
1332 | assign tlu_rdpr_mx3_sel[1] = local_rdpr_mx3_sel[2] & ~rst_tri_en; |
---|
1333 | // |
---|
1334 | assign local_rdpr_mx4_sel[0] = tpc_rw_e; |
---|
1335 | assign local_rdpr_mx4_sel[1] = tnpc_rw_e; |
---|
1336 | assign local_rdpr_mx4_sel[2] = tstate_rw_e; |
---|
1337 | // |
---|
1338 | assign tlu_rdpr_mx4_sel[0] = local_rdpr_mx4_sel[1] & ~rst_tri_en; |
---|
1339 | assign tlu_rdpr_mx4_sel[1] = local_rdpr_mx4_sel[2] & ~rst_tri_en; |
---|
1340 | // |
---|
1341 | // modified for rte failures |
---|
1342 | assign local_rdpr_mx5_sel[0] = tba_rw_e; |
---|
1343 | assign local_rdpr_mx5_sel[1] = tlu_hyperv_rdpr_sel[4] & ~rst_tri_en; |
---|
1344 | assign local_rdpr_mx5_sel[2] = (|local_rdpr_mx1_sel[3:0]) & ~rst_tri_en; |
---|
1345 | assign local_rdpr_mx5_sel[3] = (pcr_rsr_e | pic_rsr_e) & ~rst_tri_en; |
---|
1346 | // |
---|
1347 | assign tlu_rdpr_mx5_sel[0] = local_rdpr_mx5_sel[1]; |
---|
1348 | assign tlu_rdpr_mx5_sel[1] = local_rdpr_mx5_sel[2]; |
---|
1349 | assign tlu_rdpr_mx5_sel[2] = local_rdpr_mx5_sel[3]; |
---|
1350 | // |
---|
1351 | assign tlu_rdpr_mx6_sel[0] = local_rdpr_mx6_sel[1]; |
---|
1352 | assign tlu_rdpr_mx6_sel[1] = local_rdpr_mx6_sel[2]; |
---|
1353 | assign tlu_rdpr_mx6_sel[2] = local_rdpr_mx6_sel[3]; |
---|
1354 | // |
---|
1355 | assign local_rdpr_mx6_sel[0] = ttype_rw_e; |
---|
1356 | assign local_rdpr_mx6_sel[1] = tlu_hyperv_rdpr_sel[3] & ~rst_tri_en; |
---|
1357 | assign local_rdpr_mx6_sel[2] = (|local_rdpr_mx2_sel[3:0]) & ~rst_tri_en; |
---|
1358 | assign local_rdpr_mx6_sel[3] = (|local_rdpr_mx3_sel[2:0]) & ~rst_tri_en; |
---|
1359 | // |
---|
1360 | assign tlu_rdpr_mx7_sel[0] = (|local_rdpr_mx4_sel[2:0]) & ~rst_tri_en; |
---|
1361 | assign tlu_rdpr_mx7_sel[1] = (|local_rdpr_mx5_sel[3:0]) & ~rst_tri_en; |
---|
1362 | assign tlu_rdpr_mx7_sel[2] = (|local_rdpr_mx6_sel[3:0]) & ~rst_tri_en; |
---|
1363 | assign tlu_rdpr_mx7_sel[3] = ~(|tlu_rdpr_mx7_sel[2:0]); |
---|
1364 | |
---|
1365 | //========================================================================================= |
---|
1366 | |
---|
1367 | assign ttype_written = (thread0_rsel_e & ~tt_unwritten[0]) | |
---|
1368 | (thread1_rsel_e & ~tt_unwritten[1]) | |
---|
1369 | (thread2_rsel_e & ~tt_unwritten[2]) | |
---|
1370 | (thread3_rsel_e & ~tt_unwritten[3]); |
---|
1371 | |
---|
1372 | assign ttype_unwritten_sel = ttype_rw_e & ~ttype_written; |
---|
1373 | |
---|
1374 | // |
---|
1375 | // constructing the mux select for rdpr 7 in tdp |
---|
1376 | // |
---|
1377 | |
---|
1378 | //========================================================================================= |
---|
1379 | |
---|
1380 | dff_s #(2) dff_stgdntry_m ( |
---|
1381 | .din ({done_inst_e,retry_inst_e}), |
---|
1382 | .q ({done_inst_m_tmp,retry_inst_m_tmp}), |
---|
1383 | .clk (clk), |
---|
1384 | .se (se), |
---|
1385 | .si (), |
---|
1386 | .so () |
---|
1387 | ); |
---|
1388 | |
---|
1389 | wire trap_on_dnrtry_m; |
---|
1390 | // priv opcode, illegal inst trap on done/retry. |
---|
1391 | assign trap_on_dnrtry_m = ifu_ttype_vld_m ; |
---|
1392 | |
---|
1393 | // qualification done with previous instruction's flush pipe |
---|
1394 | // the inst_vld may have to be sent earlier to avoid the critical path. |
---|
1395 | // modified for bug 4074 and 4561 |
---|
1396 | assign done_inst_m = |
---|
1397 | done_inst_m_tmp & ~(((thrid_g[1:0] == tlu_exu_tid_m[1:0]) & |
---|
1398 | tlu_ifu_flush_pipe_w) | trap_on_dnrtry_m); |
---|
1399 | /* |
---|
1400 | done_inst_m_tmp & ~(((thrid_g[1:0] == tlu_exu_tid_m[1:0]) & |
---|
1401 | tlu_ifu_flush_pipe_w) | ((thrid_w2[1:0] == tlu_exu_tid_m[1:0]) & |
---|
1402 | lsu_defr_trap_g) | trap_on_dnrtry_m); |
---|
1403 | */ |
---|
1404 | assign retry_inst_m = |
---|
1405 | retry_inst_m_tmp & ~(((thrid_g[1:0] == tlu_exu_tid_m[1:0]) & |
---|
1406 | tlu_ifu_flush_pipe_w) | trap_on_dnrtry_m); |
---|
1407 | /* |
---|
1408 | retry_inst_m_tmp & ~(((thrid_g[1:0] == tlu_exu_tid_m[1:0]) & |
---|
1409 | tlu_ifu_flush_pipe_w) | ((thrid_w2[1:0] == tlu_exu_tid_m[1:0]) & |
---|
1410 | lsu_defr_trap_g) | trap_on_dnrtry_m); |
---|
1411 | */ |
---|
1412 | /* |
---|
1413 | // logic moved to tlu_misctl |
---|
1414 | // modified/added for timing violations |
---|
1415 | // moved the logic from exu to tlu due to timing violations |
---|
1416 | |
---|
1417 | mux4ds #(3) mux_trap_old_cwp_m( |
---|
1418 | .in0(exu_tlu_cwp0[2:0]), |
---|
1419 | .in1(exu_tlu_cwp1[2:0]), |
---|
1420 | .in2(exu_tlu_cwp2[2:0]), |
---|
1421 | .in3(exu_tlu_cwp3[2:0]), |
---|
1422 | .sel0(thread0_rsel_m), |
---|
1423 | .sel1(thread1_rsel_m), |
---|
1424 | .sel2(thread2_rsel_m), |
---|
1425 | .sel3(thread3_rsel_m), |
---|
1426 | .dout(trap_old_cwp_m[2:0]) |
---|
1427 | ); |
---|
1428 | |
---|
1429 | assign cwp_xor_m[2:0] = trap_old_cwp_m[2:0] ^ tlu_exu_cwp_m[2:0]; |
---|
1430 | |
---|
1431 | assign cwp_no_change_m = ~|(cwp_xor_m[2:0]); |
---|
1432 | */ |
---|
1433 | assign cwp_fastcmplt_m = |
---|
1434 | tlu_exu_cwpccr_update_m & tlu_cwp_no_change_m; |
---|
1435 | |
---|
1436 | dffr_s dffr_cwp_fastcmplt_uq_g ( |
---|
1437 | .din (cwp_fastcmplt_m), |
---|
1438 | .q (cwp_fastcmplt_uq_g), |
---|
1439 | .clk (clk), |
---|
1440 | .rst (local_rst), |
---|
1441 | .se (se), |
---|
1442 | .si (), |
---|
1443 | .so () |
---|
1444 | ); |
---|
1445 | |
---|
1446 | // assign tlu_exu_cwpccr_update_m = done_inst_m | retry_inst_m; |
---|
1447 | assign tlu_exu_cwpccr_update_m = exu_done_inst_m | exu_retry_inst_m; |
---|
1448 | |
---|
1449 | assign exu_done_inst_m = |
---|
1450 | done_inst_m_tmp; // & ~(ifu_tlu_ttype_vld_m & ifu_tlu_inst_vld_m); |
---|
1451 | assign exu_retry_inst_m = |
---|
1452 | retry_inst_m_tmp;// & ~(ifu_tlu_ttype_vld_m & ifu_tlu_inst_vld_m); |
---|
1453 | |
---|
1454 | // |
---|
1455 | // modified due timing problems |
---|
1456 | // assign tlu_exu_cwp_retry_m = retry_inst_m; |
---|
1457 | assign tlu_exu_cwp_retry_m = exu_retry_inst_m; |
---|
1458 | |
---|
1459 | // qualify with flush ? |
---|
1460 | // modified for timing and bug4658 |
---|
1461 | // modified for timing and added the omitted tlz trap qualification |
---|
1462 | |
---|
1463 | assign true_pc_sel_m[0] = |
---|
1464 | retry_inst_m_tmp & ~ifu_tlu_trap_m & ifu_tlu_inst_vld_m & |
---|
1465 | ~(pib_wrap_trap_m | (|tlz_trap_m[`TLU_THRD_NUM-1:0])); |
---|
1466 | assign true_pc_sel_m[1] = |
---|
1467 | done_inst_m_tmp & ~ifu_tlu_trap_m & ifu_tlu_inst_vld_m & |
---|
1468 | ~(pib_wrap_trap_m | (|tlz_trap_m[`TLU_THRD_NUM-1:0])) ; |
---|
1469 | |
---|
1470 | assign true_pc_sel_m[2] = ~(|true_pc_sel_m[1:0]); |
---|
1471 | |
---|
1472 | dffr_s #(3) dff_true_pc_sel_w ( |
---|
1473 | .din (true_pc_sel_m[2:0]), |
---|
1474 | .q (true_pc_sel_w[2:0]), |
---|
1475 | .clk (clk), |
---|
1476 | .rst (local_rst), |
---|
1477 | .se (se), |
---|
1478 | .si (), |
---|
1479 | .so () |
---|
1480 | ); |
---|
1481 | |
---|
1482 | dff_s #(49) dff_ifu_npc_w ( |
---|
1483 | .din (ifu_tlu_npc_m[48:0]), |
---|
1484 | .q (ifu_npc_w[48:0]), |
---|
1485 | .clk (clk), |
---|
1486 | .se (se), |
---|
1487 | .si (), |
---|
1488 | .so () |
---|
1489 | ); |
---|
1490 | |
---|
1491 | assign tlu_true_pc_sel_w[2:0] = true_pc_sel_w[2:0]; |
---|
1492 | |
---|
1493 | dff_s #(2) dff_stgdntry_g ( |
---|
1494 | .din ({done_inst_m,retry_inst_m}), |
---|
1495 | .q ({done_inst_g_tmp,retry_inst_g_tmp}), |
---|
1496 | .clk (clk), |
---|
1497 | .se (se), |
---|
1498 | .si (), |
---|
1499 | .so () |
---|
1500 | ); |
---|
1501 | |
---|
1502 | assign done_inst_g = done_inst_g_tmp & inst_vld_g; |
---|
1503 | assign retry_inst_g = retry_inst_g_tmp & inst_vld_g; |
---|
1504 | |
---|
1505 | //assign tlu_retry_inst_g = retry_inst_g; |
---|
1506 | //assign tlu_done_inst_g = done_inst_g; |
---|
1507 | // |
---|
1508 | // threaded dnrtry_inst_g signal |
---|
1509 | // modified for timing |
---|
1510 | // |
---|
1511 | assign dnrtry0_inst_g = (done_inst_g | retry_inst_g) & |
---|
1512 | ~(inst_ifu_flush2_w | local_early_flush_pipe_w) & |
---|
1513 | thread0_rsel_g; |
---|
1514 | |
---|
1515 | assign dnrtry1_inst_g = (done_inst_g | retry_inst_g) & |
---|
1516 | ~(inst_ifu_flush2_w | local_early_flush_pipe_w) & |
---|
1517 | thread1_rsel_g; |
---|
1518 | |
---|
1519 | assign dnrtry2_inst_g = (done_inst_g | retry_inst_g) & |
---|
1520 | ~(inst_ifu_flush2_w | local_early_flush_pipe_w) & |
---|
1521 | thread2_rsel_g; |
---|
1522 | |
---|
1523 | assign dnrtry3_inst_g = (done_inst_g | retry_inst_g) & |
---|
1524 | ~(inst_ifu_flush2_w | local_early_flush_pipe_w) & |
---|
1525 | thread3_rsel_g; |
---|
1526 | // |
---|
1527 | // added for timing |
---|
1528 | dffr_s #(`TLU_THRD_NUM) dffr_dnrtry_inst_w2 ( |
---|
1529 | .din ({dnrtry3_inst_g,dnrtry2_inst_g,dnrtry1_inst_g,dnrtry0_inst_g}), |
---|
1530 | .q (dnrtry_inst_w2[`TLU_THRD_NUM-1:0]), |
---|
1531 | .rst (local_rst), |
---|
1532 | .clk (clk), |
---|
1533 | .se (se), |
---|
1534 | .si (), |
---|
1535 | .so () |
---|
1536 | ); |
---|
1537 | |
---|
1538 | assign tlu_dnrtry0_inst_g = dnrtry0_inst_g; |
---|
1539 | assign tlu_dnrtry1_inst_g = dnrtry1_inst_g; |
---|
1540 | assign tlu_dnrtry2_inst_g = dnrtry2_inst_g; |
---|
1541 | assign tlu_dnrtry3_inst_g = dnrtry3_inst_g; |
---|
1542 | |
---|
1543 | // flush needed for done/retry with tl=0 |
---|
1544 | // modified for timing |
---|
1545 | // assign dnrtry_inst_g = (done_inst_g | retry_inst_g) & ~tlu_flush_pipe_w; |
---|
1546 | // |
---|
1547 | assign dnrtry_inst_g = (done_inst_g | retry_inst_g) & |
---|
1548 | ~(inst_ifu_flush_w | local_early_flush_pipe_w); |
---|
1549 | dff_s #(2) dff_stgdntry_e ( |
---|
1550 | .din ({ifu_tlu_done_inst_d,ifu_tlu_retry_inst_d}), |
---|
1551 | .q ({done_inst_e,retry_inst_e}), |
---|
1552 | .clk (clk), |
---|
1553 | .se (se), |
---|
1554 | .si (), |
---|
1555 | .so () |
---|
1556 | ); |
---|
1557 | |
---|
1558 | assign thrid_d[1:0] = ifu_tlu_thrid_d[1:0]; |
---|
1559 | |
---|
1560 | assign thread0_rsel_d = ~thrid_d[1] & ~thrid_d[0]; |
---|
1561 | assign thread1_rsel_d = ~thrid_d[1] & thrid_d[0]; |
---|
1562 | assign thread2_rsel_d = thrid_d[1] & ~thrid_d[0]; |
---|
1563 | assign thread3_rsel_d = thrid_d[1] & thrid_d[0]; |
---|
1564 | |
---|
1565 | // |
---|
1566 | // modified due to rte failure |
---|
1567 | dff_s #(2) dff_thrid_e ( |
---|
1568 | .din (thrid_d[1:0]), |
---|
1569 | .q (thrid_e[1:0]), |
---|
1570 | .clk (clk), |
---|
1571 | .se (se), |
---|
1572 | .si (), |
---|
1573 | .so () |
---|
1574 | ); |
---|
1575 | |
---|
1576 | dff_s #(2) dff_thrid_m ( |
---|
1577 | .din (thrid_e[1:0]), |
---|
1578 | .q (thrid_m[1:0]), |
---|
1579 | .clk (clk), |
---|
1580 | .se (se), |
---|
1581 | .si (), |
---|
1582 | .so () |
---|
1583 | ); |
---|
1584 | |
---|
1585 | dff_s #(2) dff_thrid_g ( |
---|
1586 | .din (thrid_m[1:0]), |
---|
1587 | .q (thrid_g[1:0]), |
---|
1588 | .clk (clk), |
---|
1589 | .se (se), |
---|
1590 | .si (), |
---|
1591 | .so () |
---|
1592 | ); |
---|
1593 | |
---|
1594 | assign thread0_rsel_e = ~(|thrid_e[1:0]); |
---|
1595 | assign thread1_rsel_e = ~thrid_e[1] & thrid_e[0]; |
---|
1596 | assign thread2_rsel_e = thrid_e[1] & ~thrid_e[0]; |
---|
1597 | assign thread3_rsel_e = (&thrid_e[1:0]); |
---|
1598 | |
---|
1599 | assign tlu_thrd_rsel_e[0] = thread0_rsel_e; |
---|
1600 | assign tlu_thrd_rsel_e[1] = thread1_rsel_e; |
---|
1601 | assign tlu_thrd_rsel_e[2] = thread2_rsel_e; |
---|
1602 | assign tlu_thrd_rsel_e[3] = thread3_rsel_e; |
---|
1603 | // |
---|
1604 | // added for timing |
---|
1605 | dff_s #(`TLU_THRD_NUM) dff_thread_stg_m ( |
---|
1606 | .din ({thread3_rsel_e, thread2_rsel_e, thread1_rsel_e, thread0_rsel_e}), |
---|
1607 | .q ({thread3_stg_m, thread2_stg_m, thread1_stg_m, thread0_stg_m}), |
---|
1608 | .clk (clk), |
---|
1609 | .se (se), |
---|
1610 | .si (), |
---|
1611 | .so () |
---|
1612 | ); |
---|
1613 | |
---|
1614 | assign thread0_stg_m_buf = thread0_stg_m; |
---|
1615 | assign thread1_stg_m_buf = thread1_stg_m; |
---|
1616 | assign thread2_stg_m_buf = thread2_stg_m; |
---|
1617 | assign thread3_stg_m_buf = thread3_stg_m; |
---|
1618 | |
---|
1619 | assign thread0_rsel_m = ~(|thrid_m[1:0]); |
---|
1620 | assign thread1_rsel_m = ~thrid_m[1] & thrid_m[0]; |
---|
1621 | assign thread2_rsel_m = thrid_m[1] & ~thrid_m[0]; |
---|
1622 | assign thread3_rsel_m = (&thrid_m[1:0]); |
---|
1623 | |
---|
1624 | assign thread0_rsel_dec_g = ~(|thrid_g[1:0]); |
---|
1625 | assign thread1_rsel_dec_g = ~thrid_g[1] & thrid_g[0]; |
---|
1626 | assign thread2_rsel_dec_g = thrid_g[1] & ~thrid_g[0]; |
---|
1627 | assign thread3_rsel_dec_g = (&thrid_g[1:0]); |
---|
1628 | |
---|
1629 | dff_s #(`TLU_THRD_NUM) dff_thread_rsel_g ( |
---|
1630 | .din ({thread3_rsel_m, thread2_rsel_m, thread1_rsel_m, thread0_rsel_m}), |
---|
1631 | .q ({thread3_rsel_g, thread2_rsel_g, thread1_rsel_g, thread0_rsel_g}), |
---|
1632 | .clk (clk), |
---|
1633 | .se (se), |
---|
1634 | .si (), |
---|
1635 | .so () |
---|
1636 | ); |
---|
1637 | |
---|
1638 | dff_s #(`TLU_THRD_NUM) dff_thread_wsel_g ( |
---|
1639 | .din ({thread3_rsel_m, thread2_rsel_m, thread1_rsel_m, thread0_rsel_m}), |
---|
1640 | .q ({thread3_wsel_g, thread2_wsel_g, thread1_wsel_g, thread0_wsel_g}), |
---|
1641 | .clk (clk), |
---|
1642 | .se (se), |
---|
1643 | .si (), |
---|
1644 | .so () |
---|
1645 | ); |
---|
1646 | // timing -fix: load redistribution |
---|
1647 | /* |
---|
1648 | assign thread0_rsel_g = thread0_rsel_dec_g; |
---|
1649 | assign thread1_rsel_g = thread1_rsel_dec_g; |
---|
1650 | assign thread2_rsel_g = thread2_rsel_dec_g; |
---|
1651 | assign thread3_rsel_g = thread3_rsel_dec_g; |
---|
1652 | */ |
---|
1653 | // |
---|
1654 | |
---|
1655 | dff_s #(2) dff_stgdntry_w2 ( |
---|
1656 | .din ({done_inst_g,retry_inst_g}), |
---|
1657 | .q ({done_inst_w2,retry_inst_w2}), |
---|
1658 | .clk (clk), |
---|
1659 | .se (se), |
---|
1660 | .si (), |
---|
1661 | .so () |
---|
1662 | ); |
---|
1663 | // |
---|
1664 | // modified for bug 4561 |
---|
1665 | assign inst_vld_m = |
---|
1666 | ifu_tlu_inst_vld_m & ~((thrid_g[1:0] == tlu_exu_tid_m[1:0]) & |
---|
1667 | (tlu_flush_pipe_w | inst_ifu_flush_w)); |
---|
1668 | /* |
---|
1669 | assign inst_vld_m = |
---|
1670 | ifu_tlu_inst_vld_m & ~((thrid_g[1:0] == tlu_exu_tid_m[1:0]) & |
---|
1671 | (tlu_flush_pipe_w | inst_ifu_flush_w)) & ~((thrid_w2[1:0] == tlu_exu_tid_m[1:0]) & |
---|
1672 | lsu_defr_trap_g); |
---|
1673 | */ |
---|
1674 | // |
---|
1675 | |
---|
1676 | assign tlu_inst_vld_nq_m = |
---|
1677 | ifu_tlu_inst_vld_m & ~((thrid_g[1:0] == tlu_exu_tid_m[1:0]) & |
---|
1678 | tlu_flush_all_w); |
---|
1679 | |
---|
1680 | dff_s dff_stgivld_g ( |
---|
1681 | .din (inst_vld_m), |
---|
1682 | .q (inst_vld_nf_g), |
---|
1683 | .clk (clk), |
---|
1684 | .se (se), |
---|
1685 | .si (), |
---|
1686 | .so () |
---|
1687 | ); |
---|
1688 | // |
---|
1689 | // modified for timing |
---|
1690 | /* |
---|
1691 | dffr_s dffr_inst_ifu_flush_w ( |
---|
1692 | .din (ifu_tlu_flush_m), |
---|
1693 | .q (inst_ifu_flush_w), |
---|
1694 | .clk (clk), |
---|
1695 | .rst (local_rst), |
---|
1696 | .se (se), |
---|
1697 | .si (), |
---|
1698 | .so () |
---|
1699 | ); |
---|
1700 | */ |
---|
1701 | assign inst_ifu_flush_w = ifu_tlu_flush_fd_w; |
---|
1702 | assign inst_ifu_flush2_w = ifu_tlu_flush_fd_w; |
---|
1703 | |
---|
1704 | // added for bug 2133 |
---|
1705 | assign inst_vld_g = |
---|
1706 | inst_vld_nf_g & ~(inst_ifu_flush_w | lsu_tlu_defr_trp_taken_g); |
---|
1707 | // modified for bug 4561 |
---|
1708 | // inst_vld_nf_g & ~(inst_ifu_flush_w | lsu_tlu_defr_trp_taken_g | |
---|
1709 | // ((thrid_w2[1:0] == thrid_g[1:0]) & lsu_defr_trap_g)); |
---|
1710 | |
---|
1711 | dff_s dff_stgivld_w2 ( |
---|
1712 | .din (inst_vld_g), |
---|
1713 | .q (inst_vld_w2), |
---|
1714 | .clk (clk), |
---|
1715 | .se (se), |
---|
1716 | .si (), |
---|
1717 | .so () |
---|
1718 | ); |
---|
1719 | // |
---|
1720 | // modified due to timing |
---|
1721 | // assign cwp_fastcmplt_g = cwp_fastcmplt_w & inst_vld_g; |
---|
1722 | assign cwp_fastcmplt_g = cwp_fastcmplt_uq_g & inst_vld_g; |
---|
1723 | |
---|
1724 | dff_s dff_stgfcmplt_w2 ( |
---|
1725 | .din (cwp_fastcmplt_g), |
---|
1726 | .q (cwp_fastcmplt_w2), |
---|
1727 | .clk (clk), |
---|
1728 | .se (se), |
---|
1729 | .si (), |
---|
1730 | .so () |
---|
1731 | ); |
---|
1732 | |
---|
1733 | // The stage name assignment may have to be changed !! |
---|
1734 | // done/retry qualified with inst_vld as it could be flushed. |
---|
1735 | assign tlu_ifu_trappc_vld_w1 = ((retry_inst_w2 | done_inst_w2) & inst_vld_w2 & cwp_fastcmplt_w2) | |
---|
1736 | thrd0_traps_w2 | thrd1_traps_w2 | |
---|
1737 | thrd2_traps_w2 | thrd3_traps_w2 | cwp_cmplt_w2; |
---|
1738 | //thrd2_traps_w2 | thrd3_traps_w2) & inst_vld_w2 | cwp_cmplt_w2; |
---|
1739 | assign tlu_ifu_trapnpc_vld_w1 = (retry_inst_w2 & inst_vld_w2 & cwp_fastcmplt_w2) | |
---|
1740 | thrd0_traps_w2 | thrd1_traps_w2 | |
---|
1741 | thrd2_traps_w2 | thrd3_traps_w2 | cwp_cmplt_rtry_w2; |
---|
1742 | //) & inst_vld_w2 | cwp_cmplt_w2; |
---|
1743 | // |
---|
1744 | // modified for hypervisor support |
---|
1745 | // assign tlu_ifu_trap_tid_w1[1:0]= cwp_cmplt_w2 ? cwp_cmplt_tid_w2[1:0] : trap_tid_w2[1:0]; |
---|
1746 | // |
---|
1747 | // recoded for timing |
---|
1748 | // assign true_trap_tid_g[1:0] = cwp_cmplt_g ? cwp_cmplt_tid_g[1:0] : trap_tid_g[1:0]; |
---|
1749 | // modified for bug 4091 and 4491 |
---|
1750 | /* |
---|
1751 | assign early_trap_tid_g[1:0] = |
---|
1752 | (((hwint_g | pib_wrap_trap_g| local_early_flush_pipe_w) & |
---|
1753 | ~(ifu_tlu_flush_fd_w | local_lsu_defr_trp_taken_g)) | |
---|
1754 | (dnrtry_inst_g & cwp_fastcmplt_g) | rstint_g) ? thrid_g[1:0] : pend_trap_tid_g[1:0]; |
---|
1755 | */ |
---|
1756 | assign early_trap_tid_g[1:0] = |
---|
1757 | (((hwint_g | pib_wrap_trap_g| local_early_flush_pipe_w) & ~ifu_tlu_flush_fd_w) | |
---|
1758 | (dnrtry_inst_g & cwp_fastcmplt_g) | rstint_g) ? thrid_g[1:0] : pend_trap_tid_g[1:0]; |
---|
1759 | // |
---|
1760 | // modified for bug 4561 |
---|
1761 | assign true_trap_tid_g[1:0] = |
---|
1762 | // (lsu_defr_trap_g) ? thrid_w2[1:0] : |
---|
1763 | (dside_sync_trap_g | lsu_defr_trap_g) ? thrid_g[1:0] : |
---|
1764 | early_trap_tid_g[1:0]; |
---|
1765 | |
---|
1766 | dff_s #(2) dff_true_trap_tid_w2 ( |
---|
1767 | .din (true_trap_tid_g[1:0]), |
---|
1768 | .q (true_trap_tid_w2[1:0]), |
---|
1769 | .clk (clk), |
---|
1770 | .se (se), |
---|
1771 | .si (), |
---|
1772 | .so () |
---|
1773 | ); |
---|
1774 | assign tlu_ifu_trap_tid_w1[1:0] = true_trap_tid_w2[1:0]; |
---|
1775 | |
---|
1776 | // determine the mode of operation for the trapped thread |
---|
1777 | // modified for timing |
---|
1778 | /* |
---|
1779 | assign tlu_trap_hpstate_enb = |
---|
1780 | (~(|true_trap_tid_g[1:0]))? tlu_hpstate_enb[0]: |
---|
1781 | ((~true_trap_tid_g[1] & true_trap_tid_g[0])? tlu_hpstate_enb[1]: |
---|
1782 | ((true_trap_tid_g[1] & ~true_trap_tid_g[0])? tlu_hpstate_enb[2]: |
---|
1783 | tlu_hpstate_enb[3])); |
---|
1784 | */ |
---|
1785 | assign tlu_trap_hpstate_enb = |
---|
1786 | (~(|true_trap_tid_w2[1:0]))? tlu_hpstate_enb[0]: |
---|
1787 | ((~true_trap_tid_w2[1] & true_trap_tid_w2[0])? tlu_hpstate_enb[1]: |
---|
1788 | ((true_trap_tid_w2[1] & ~true_trap_tid_w2[0])? tlu_hpstate_enb[2]: |
---|
1789 | tlu_hpstate_enb[3])); |
---|
1790 | |
---|
1791 | //========================================================================================= |
---|
1792 | // Local Exceptions within TLU/MMU |
---|
1793 | //========================================================================================= |
---|
1794 | |
---|
1795 | // These are to be merged with lsu reported exceptions. |
---|
1796 | // |
---|
1797 | // modified due to early_flush timing fix |
---|
1798 | // assign local_sync_trap_g = tlu_mmu_sync_data_excp_g; |
---|
1799 | // |
---|
1800 | // modified for hypervisor support |
---|
1801 | // modified for timing |
---|
1802 | assign local_sync_trap_m = |
---|
1803 | (true_hscpd_dacc_excpt_m | true_qtail_dacc_excpt_m) & inst_vld_m; |
---|
1804 | // |
---|
1805 | // added for dsfsr bug |
---|
1806 | assign tlu_lsu_priv_trap_m = |
---|
1807 | (true_hscpd_dacc_excpt_m | true_qtail_dacc_excpt_m); |
---|
1808 | // |
---|
1809 | /* |
---|
1810 | // added for timing |
---|
1811 | dffr_s dffr_tlu_lsu_priv_trap_w ( |
---|
1812 | .din (tlu_lsu_priv_trap_m), |
---|
1813 | .q (tlu_lsu_priv_trap_w), |
---|
1814 | .rst (local_rst), |
---|
1815 | .clk (clk), |
---|
1816 | .se (se), |
---|
1817 | .si (), |
---|
1818 | .so () |
---|
1819 | ); |
---|
1820 | // |
---|
1821 | */ |
---|
1822 | // added for timing |
---|
1823 | // modified for bug 3618 |
---|
1824 | assign true_hscpd_dacc_excpt_m = |
---|
1825 | tlu_hscpd_dacc_excpt_m & |
---|
1826 | ((thread0_stg_m_buf & ~tlu_hyper_lite[0]) | |
---|
1827 | (thread1_stg_m_buf & ~tlu_hyper_lite[1]) | |
---|
1828 | (thread2_stg_m_buf & ~tlu_hyper_lite[2]) | |
---|
1829 | (thread3_stg_m_buf & ~tlu_hyper_lite[3])); |
---|
1830 | |
---|
1831 | assign true_qtail_dacc_excpt_m = |
---|
1832 | ((thread0_stg_m_buf & tlu_hpstate_enb[0] & ~tlu_hpstate_priv[0] & |
---|
1833 | tlu_pstate_priv_buf[0]) | |
---|
1834 | (thread1_stg_m_buf & tlu_hpstate_enb[1] & ~tlu_hpstate_priv[1] & |
---|
1835 | tlu_pstate_priv_buf[1]) | |
---|
1836 | (thread2_stg_m_buf & tlu_hpstate_enb[2] & ~tlu_hpstate_priv[2] & |
---|
1837 | tlu_pstate_priv_buf[2]) | |
---|
1838 | (thread3_stg_m_buf & tlu_hpstate_enb[3] & ~tlu_hpstate_priv[3] & |
---|
1839 | tlu_pstate_priv_buf[3])) & tlu_qtail_dacc_excpt_m; |
---|
1840 | |
---|
1841 | dffr_s dffr_local_sync_trap_g ( |
---|
1842 | .din (local_sync_trap_m), |
---|
1843 | .q (local_sync_trap_g), |
---|
1844 | .rst (local_rst), |
---|
1845 | .clk (clk), |
---|
1846 | .se (se), |
---|
1847 | .si (), |
---|
1848 | .so () |
---|
1849 | ); |
---|
1850 | |
---|
1851 | //========================================================================================= |
---|
1852 | // Queuing traps |
---|
1853 | //========================================================================================= |
---|
1854 | |
---|
1855 | // For current instr, prioritize traps across pipe. There are 3 synchronous sources : |
---|
1856 | // ifu,exu,lsu. Assume ifu traps have highest priority so compare has to be done |
---|
1857 | // only between exu and lsu traps. |
---|
1858 | |
---|
1859 | // added for timing; moved qualification from IFU to TLU |
---|
1860 | assign ifu_rstint_m = |
---|
1861 | ifu_tlu_rstint_m & ~((thrid_g[1:0] == tlu_exu_tid_m[1:0]) & |
---|
1862 | tlu_flush_all_w) & inst_vld_m; |
---|
1863 | assign ifu_hwint_m = |
---|
1864 | ifu_tlu_hwint_m & ~((thrid_g[1:0] == tlu_exu_tid_m[1:0]) & |
---|
1865 | tlu_flush_all_w) & inst_vld_m; |
---|
1866 | assign ifu_swint_m = |
---|
1867 | ifu_tlu_swint_m & ~((thrid_g[1:0] == tlu_exu_tid_m[1:0]) & |
---|
1868 | tlu_flush_all_w) & inst_vld_m; |
---|
1869 | |
---|
1870 | // generate the thread specific ifu flush signal - added for bug 2133 |
---|
1871 | assign ifu_thrd_flush_w[0] = inst_ifu_flush2_w & thread0_rsel_dec_g; |
---|
1872 | assign ifu_thrd_flush_w[1] = inst_ifu_flush2_w & thread1_rsel_dec_g; |
---|
1873 | assign ifu_thrd_flush_w[2] = inst_ifu_flush2_w & thread2_rsel_dec_g; |
---|
1874 | assign ifu_thrd_flush_w[3] = inst_ifu_flush2_w & thread3_rsel_dec_g; |
---|
1875 | |
---|
1876 | |
---|
1877 | // INTERRUPT |
---|
1878 | dff_s #(9) dff_stgint_g ( |
---|
1879 | .din ({ifu_rstint_m,ifu_hwint_m,ifu_swint_m,int_tlu_rstid_m[5:0]}), |
---|
1880 | .q ({rstint_g,hwint_g,swint_g,rstid_g[5:0]}), |
---|
1881 | .clk (clk), |
---|
1882 | .se (se), |
---|
1883 | .si (), |
---|
1884 | .so () |
---|
1885 | ); |
---|
1886 | |
---|
1887 | // Determine type of reset. Type of reset determines what state gets updated. |
---|
1888 | // This is the same as wrm reset !!! Can we then turn off writes to TNPC, TPC ??? |
---|
1889 | assign por_rstint_g = ((rstid_g[5:0] == 6'h01) & rstint_g); |
---|
1890 | assign por_rstint0_g = por_rstint_g & thread0_rsel_g; |
---|
1891 | assign por_rstint1_g = por_rstint_g & thread1_rsel_g; |
---|
1892 | assign por_rstint2_g = por_rstint_g & thread2_rsel_g; |
---|
1893 | assign por_rstint3_g = por_rstint_g & thread3_rsel_g; |
---|
1894 | // |
---|
1895 | // added for bug 4749 |
---|
1896 | assign xir_rstint_g = ((rstid_g[5:0] == 6'h03) & rstint_g); |
---|
1897 | |
---|
1898 | dff_s dff_por_rstint_w2 ( |
---|
1899 | .din (por_rstint_g), |
---|
1900 | .q (por_rstint_w2), |
---|
1901 | .clk (clk), |
---|
1902 | .se (se), |
---|
1903 | .si (), |
---|
1904 | .so () |
---|
1905 | ); |
---|
1906 | |
---|
1907 | assign por_rstint0_w2 = por_rstint_w2 & thread0_wsel_w2; |
---|
1908 | assign por_rstint1_w2 = por_rstint_w2 & thread1_wsel_w2; |
---|
1909 | assign por_rstint2_w2 = por_rstint_w2 & thread2_wsel_w2; |
---|
1910 | assign por_rstint3_w2 = por_rstint_w2 & thread3_wsel_w2; |
---|
1911 | |
---|
1912 | assign tlu_por_rstint_g[0] = por_rstint0_g; |
---|
1913 | assign tlu_por_rstint_g[1] = por_rstint1_g; |
---|
1914 | assign tlu_por_rstint_g[2] = por_rstint2_g; |
---|
1915 | assign tlu_por_rstint_g[3] = por_rstint3_g; |
---|
1916 | |
---|
1917 | assign rstint_taken = rstint_g & inst_vld_g; |
---|
1918 | |
---|
1919 | // hwint needs to be requalified with pstate.ie. IFU will replay hwint in |
---|
1920 | // case dropped. IFU needs to source thread id in the form of ifu_tlu_thrid_d. |
---|
1921 | assign hwint_taken = hwint_g & inst_vld_g; |
---|
1922 | // |
---|
1923 | // modified for bug 5127 |
---|
1924 | // assign sirint_taken = sir_inst_g & inst_vld_g; |
---|
1925 | assign sirint_taken = |
---|
1926 | sir_inst_g & inst_vld_g & ~(pib_wrap_trap_nq_g | |
---|
1927 | lsu_tlu_defr_trp_taken_g | (|tlz_trap_g[`TLU_THRD_NUM-1:0])); |
---|
1928 | |
---|
1929 | assign swint_taken = swint_g & inst_vld_g; |
---|
1930 | |
---|
1931 | /* |
---|
1932 | assign swint_thrd0_taken = swint_taken & thread0_rsel_g & tlu_int_pstate_ie[0]; |
---|
1933 | assign swint_thrd1_taken = swint_taken & thread1_rsel_g & tlu_int_pstate_ie[1]; |
---|
1934 | assign swint_thrd2_taken = swint_taken & thread2_rsel_g & tlu_int_pstate_ie[2]; |
---|
1935 | assign swint_thrd3_taken = swint_taken & thread3_rsel_g & tlu_int_pstate_ie[3]; |
---|
1936 | // |
---|
1937 | //modified for hypervisor support |
---|
1938 | assign swint_id[3:0] = |
---|
1939 | swint_thrd0_taken ? sftint0_id[3:0] : |
---|
1940 | swint_thrd1_taken ? sftint1_id[3:0] : |
---|
1941 | swint_thrd2_taken ? sftint2_id[3:0] : |
---|
1942 | swint_thrd3_taken ? sftint3_id[3:0] : |
---|
1943 | 4'bxxxx; |
---|
1944 | */ |
---|
1945 | // |
---|
1946 | //added for timing |
---|
1947 | dffr_s #(`TLU_THRD_NUM) dffr_tlu_cpu_mondo_trap ( |
---|
1948 | .din (tlu_cpu_mondo_cmp[`TLU_THRD_NUM-1:0]), |
---|
1949 | .q (tlu_cpu_mondo_trap[`TLU_THRD_NUM-1:0]), |
---|
1950 | .rst (local_rst), |
---|
1951 | .clk (clk), |
---|
1952 | .se (se), |
---|
1953 | .si (), |
---|
1954 | .so () |
---|
1955 | ); |
---|
1956 | // |
---|
1957 | dffr_s #(`TLU_THRD_NUM) dffr_tlu_dev_mondo_trap ( |
---|
1958 | .din (tlu_dev_mondo_cmp[`TLU_THRD_NUM-1:0]), |
---|
1959 | .q (tlu_dev_mondo_trap[`TLU_THRD_NUM-1:0]), |
---|
1960 | .rst (local_rst), |
---|
1961 | .clk (clk), |
---|
1962 | .se (se), |
---|
1963 | .si (), |
---|
1964 | .so () |
---|
1965 | ); |
---|
1966 | |
---|
1967 | dffr_s #(`TLU_THRD_NUM) dffr_tlu_resum_err_trap ( |
---|
1968 | .din (tlu_resum_err_cmp[`TLU_THRD_NUM-1:0]), |
---|
1969 | .q (tlu_resum_err_trap[`TLU_THRD_NUM-1:0]), |
---|
1970 | .rst (local_rst), |
---|
1971 | .clk (clk), |
---|
1972 | .se (se), |
---|
1973 | .si (), |
---|
1974 | .so () |
---|
1975 | ); |
---|
1976 | // |
---|
1977 | assign cpu_mondo_trap_g = |
---|
1978 | (thread0_wsel_g)? tlu_cpu_mondo_trap[0]: |
---|
1979 | (thread1_wsel_g)? tlu_cpu_mondo_trap[1]: |
---|
1980 | (thread2_wsel_g)? tlu_cpu_mondo_trap[2]: |
---|
1981 | tlu_cpu_mondo_trap[3]; |
---|
1982 | |
---|
1983 | assign dev_mondo_trap_g = |
---|
1984 | (thread0_wsel_g)? tlu_dev_mondo_trap[0]: |
---|
1985 | (thread1_wsel_g)? tlu_dev_mondo_trap[1]: |
---|
1986 | (thread2_wsel_g)? tlu_dev_mondo_trap[2]: |
---|
1987 | tlu_dev_mondo_trap[3]; |
---|
1988 | |
---|
1989 | assign sftint_id_w2[3:0] = |
---|
1990 | (thread0_wsel_w2)? sftint0_id[3:0]: |
---|
1991 | (thread1_wsel_w2)? sftint1_id[3:0]: |
---|
1992 | (thread2_wsel_w2)? sftint2_id[3:0]: |
---|
1993 | sftint3_id[3:0]; |
---|
1994 | |
---|
1995 | dffr_s dffr_cpu_mondo_trap_w2 ( |
---|
1996 | .din (cpu_mondo_trap_g), |
---|
1997 | .q (cpu_mondo_trap_w2), |
---|
1998 | .rst (local_rst), |
---|
1999 | .clk (clk), |
---|
2000 | .se (se), |
---|
2001 | .si (), |
---|
2002 | .so () |
---|
2003 | ); |
---|
2004 | |
---|
2005 | dffr_s dffr_dev_mondo_trap_w2 ( |
---|
2006 | .din (dev_mondo_trap_g), |
---|
2007 | .q (dev_mondo_trap_w2), |
---|
2008 | .rst (local_rst), |
---|
2009 | .clk (clk), |
---|
2010 | .se (se), |
---|
2011 | .si (), |
---|
2012 | .so () |
---|
2013 | ); |
---|
2014 | |
---|
2015 | assign final_swint_id_w2[6:0] = |
---|
2016 | (cpu_mondo_trap_w2)? `CPU_MONDO_TRAP : |
---|
2017 | (dev_mondo_trap_w2)? `DEV_MONDO_TRAP : |
---|
2018 | {3'b100, sftint_id_w2[3:0]}; |
---|
2019 | |
---|
2020 | // recoded for timing for bug 5117 |
---|
2021 | /* |
---|
2022 | assign final_swint0_id[6:0] = |
---|
2023 | tlu_cpu_mondo_trap[0] ? `CPU_MONDO_TRAP : |
---|
2024 | ((tlu_dev_mondo_trap[0] & ~tlu_cpu_mondo_trap[0]) ? `DEV_MONDO_TRAP : |
---|
2025 | {3'b100, sftint0_id[3:0]}); |
---|
2026 | |
---|
2027 | assign final_swint1_id[6:0] = |
---|
2028 | tlu_cpu_mondo_trap[1] ? `CPU_MONDO_TRAP : |
---|
2029 | ((tlu_dev_mondo_trap[1] & ~tlu_cpu_mondo_trap[1]) ? `DEV_MONDO_TRAP : |
---|
2030 | {3'b100, sftint1_id[3:0]}); |
---|
2031 | |
---|
2032 | assign final_swint2_id[6:0] = |
---|
2033 | tlu_cpu_mondo_trap[2] ? `CPU_MONDO_TRAP : |
---|
2034 | ((tlu_dev_mondo_trap[2] & ~tlu_cpu_mondo_trap[2]) ? `DEV_MONDO_TRAP : |
---|
2035 | {3'b100, sftint2_id[3:0]}); |
---|
2036 | |
---|
2037 | assign final_swint3_id[6:0] = |
---|
2038 | tlu_cpu_mondo_trap[3] ? `CPU_MONDO_TRAP : |
---|
2039 | ((tlu_dev_mondo_trap[3] & ~tlu_cpu_mondo_trap[3]) ? `DEV_MONDO_TRAP : |
---|
2040 | {3'b100, sftint3_id[3:0]}); |
---|
2041 | |
---|
2042 | assign final_swint_id[6:0] = |
---|
2043 | swint_thrd0_taken ? final_swint0_id[6:0] : |
---|
2044 | swint_thrd1_taken ? final_swint1_id[6:0] : |
---|
2045 | swint_thrd2_taken ? final_swint2_id[6:0] : |
---|
2046 | swint_thrd3_taken ? final_swint3_id[6:0] : |
---|
2047 | 7'bxxxxxxx; |
---|
2048 | */ |
---|
2049 | |
---|
2050 | // Assume rstid(interrupt/reset vector) is the same as trap type. |
---|
2051 | // Need to confirm !!!! |
---|
2052 | // sftware sir is generated by ifu decode. |
---|
2053 | // ttype for internal wdr is tt of trap itself. |
---|
2054 | |
---|
2055 | // sir inst at maxtl can result entry to error state and thus wdr |
---|
2056 | // modified for bug 4749 and 4906 |
---|
2057 | assign internal_wdr_trap[0] = |
---|
2058 | (thrd0_traps & trp_lvl0_at_maxtl) & |
---|
2059 | ~((por_rstint_g | xir_rstint_g) & thread0_rsel_g); |
---|
2060 | assign internal_wdr_trap[1] = |
---|
2061 | (thrd1_traps & trp_lvl1_at_maxtl) & |
---|
2062 | ~((por_rstint_g | xir_rstint_g) & thread1_rsel_g); |
---|
2063 | assign internal_wdr_trap[2] = |
---|
2064 | (thrd2_traps & trp_lvl2_at_maxtl) & |
---|
2065 | ~((por_rstint_g | xir_rstint_g) & thread2_rsel_g); |
---|
2066 | assign internal_wdr_trap[3] = |
---|
2067 | (thrd3_traps & trp_lvl3_at_maxtl) & |
---|
2068 | ~((por_rstint_g | xir_rstint_g) & thread3_rsel_g); |
---|
2069 | |
---|
2070 | assign internal_wdr = |
---|
2071 | internal_wdr_trap[0] | internal_wdr_trap[1] | |
---|
2072 | internal_wdr_trap[2] | internal_wdr_trap[3]; |
---|
2073 | /* |
---|
2074 | assign internal_wdr = |
---|
2075 | ((thrd0_traps & trp_lvl0_at_maxtl) | |
---|
2076 | (thrd1_traps & trp_lvl1_at_maxtl) | |
---|
2077 | (thrd2_traps & trp_lvl2_at_maxtl) | |
---|
2078 | (thrd3_traps & trp_lvl3_at_maxtl)) & |
---|
2079 | ~(por_rstint_g | xir_rstint_g); |
---|
2080 | */ |
---|
2081 | // |
---|
2082 | // modified for bug 4640 and bug5127 |
---|
2083 | assign tlu_self_boot_rst_g = |
---|
2084 | rstint_g | internal_wdr | (sir_inst_g & |
---|
2085 | ~(lsu_defr_trap_g | pib_wrap_trap_g | |
---|
2086 | (|tlz_trap_g[`TLU_THRD_NUM-1:0]))) | trap_to_redmode; |
---|
2087 | // (rstint_g | internal_wdr | (sir_inst_g & ~lsu_defr_trap_g) | |
---|
2088 | |
---|
2089 | // |
---|
2090 | // added for timing; moved qualification from IFU to TLU |
---|
2091 | // modified for bug 4561 |
---|
2092 | assign ifu_ttype_vld_m = |
---|
2093 | ifu_tlu_ttype_vld_m & |
---|
2094 | ~((thrid_g[1:0] == tlu_exu_tid_m[1:0]) & tlu_flush_pipe_w); |
---|
2095 | /* |
---|
2096 | assign ifu_ttype_vld_m = |
---|
2097 | ifu_tlu_ttype_vld_m & |
---|
2098 | ~((thrid_g[1:0] == tlu_exu_tid_m[1:0]) & tlu_flush_pipe_w) & |
---|
2099 | ~((thrid_w2[1:0] == tlu_exu_tid_m[1:0]) & lsu_defr_trap_g); |
---|
2100 | */ |
---|
2101 | |
---|
2102 | // REGULAR TRAP |
---|
2103 | dff_s #(20) dff_stgeftt_g ( |
---|
2104 | .din ({exu_tlu_ttype_m[8:0],exu_tlu_ttype_vld_m,ifu_tlu_ttype_m[8:0],ifu_ttype_vld_m}), |
---|
2105 | .q ({exu_ttype_g[8:0],exu_ttype_vld_g,ifu_ttype_tmp_g[8:0],ifu_ttype_vld_tmp_g}), |
---|
2106 | .clk (clk), |
---|
2107 | .se (se), |
---|
2108 | .si (), |
---|
2109 | .so () |
---|
2110 | ); |
---|
2111 | |
---|
2112 | // added for bug 1293 |
---|
2113 | // added spu_tlu_rsrv_illgl_m2 to account for the new illeg_instr from spu |
---|
2114 | // |
---|
2115 | // modified for the hypervisor support - wsr_illeg_globals_g is no longer necessary |
---|
2116 | // modified for pib support and timing fixes |
---|
2117 | /* |
---|
2118 | assign ifu_ttype_g[8:0] = //((wsr_illeg_globals_g | spu_tlu_rsrv_illgl_m2) & |
---|
2119 | (spu_tlu_rsrv_illgl_m2 & |
---|
2120 | ~(ifu_ttype_tmp_g & (ifu_ttype_tmp_g < 9'h012)) & |
---|
2121 | ~immu_miss_g) ? |
---|
2122 | 9'h010 : |
---|
2123 | ((tlu_tick_npt_priv_act) ? 9'h037 : |
---|
2124 | ifu_ttype_tmp_g); |
---|
2125 | */ |
---|
2126 | // |
---|
2127 | // determine whether the processor is in user mode |
---|
2128 | assign tlu_none_priv[0] = ~(tlu_hpstate_priv[0] | tlu_pstate_priv_buf[0]); |
---|
2129 | assign tlu_none_priv[1] = ~(tlu_hpstate_priv[1] | tlu_pstate_priv_buf[1]); |
---|
2130 | assign tlu_none_priv[2] = ~(tlu_hpstate_priv[2] | tlu_pstate_priv_buf[2]); |
---|
2131 | assign tlu_none_priv[3] = ~(tlu_hpstate_priv[3] | tlu_pstate_priv_buf[3]); |
---|
2132 | |
---|
2133 | assign tlu_hyper_lite[0] = |
---|
2134 | tlu_hpstate_priv[0]| (~tlu_hpstate_enb[0] & tlu_pstate_priv_buf[0]); |
---|
2135 | assign tlu_hyper_lite[1] = |
---|
2136 | tlu_hpstate_priv[1]| (~tlu_hpstate_enb[1] & tlu_pstate_priv_buf[1]); |
---|
2137 | assign tlu_hyper_lite[2] = |
---|
2138 | tlu_hpstate_priv[2]| (~tlu_hpstate_enb[2] & tlu_pstate_priv_buf[2]); |
---|
2139 | assign tlu_hyper_lite[3] = |
---|
2140 | tlu_hpstate_priv[3]| (~tlu_hpstate_enb[3] & tlu_pstate_priv_buf[3]); |
---|
2141 | // |
---|
2142 | // htrap instruction illegal instruction trap |
---|
2143 | // this trap is taken only in hypervisor mode and not in hyper-lite |
---|
2144 | // mode |
---|
2145 | assign tlu_none_priv_m = |
---|
2146 | (tlu_none_priv[0] & tlu_hpstate_enb[0] & thread0_rsel_m) | |
---|
2147 | (tlu_none_priv[1] & tlu_hpstate_enb[1] & thread1_rsel_m) | |
---|
2148 | (tlu_none_priv[2] & tlu_hpstate_enb[2] & thread2_rsel_m) | |
---|
2149 | (tlu_none_priv[3] & tlu_hpstate_enb[3] & thread3_rsel_m); |
---|
2150 | |
---|
2151 | assign htrap_ill_inst_m = |
---|
2152 | (exu_tlu_ttype_vld_m & exu_tlu_ttype_m[8] & |
---|
2153 | exu_tlu_ttype_m[7]) & tlu_none_priv_m; |
---|
2154 | |
---|
2155 | dffr_s dffr_htrap_ill_inst_uf_g ( |
---|
2156 | .din (htrap_ill_inst_m), |
---|
2157 | .q (htrap_ill_inst_uf_g), |
---|
2158 | .rst (local_rst), |
---|
2159 | .clk (clk), |
---|
2160 | .se (se), |
---|
2161 | .si (), |
---|
2162 | .so () |
---|
2163 | ); |
---|
2164 | |
---|
2165 | assign htrap_ill_inst_g = htrap_ill_inst_uf_g & ~inst_ifu_flush_w; |
---|
2166 | // |
---|
2167 | // added for timing fix |
---|
2168 | assign spu_ill_inst_m = spu_tlu_rsrv_illgl_m & inst_vld_m; |
---|
2169 | |
---|
2170 | dffr_s dffr_spu_ill_inst_uf_g ( |
---|
2171 | .din (spu_ill_inst_m), |
---|
2172 | // modified for bug 2133 |
---|
2173 | // .q (spu_ill_inst_g), |
---|
2174 | .q (spu_ill_inst_uf_g), |
---|
2175 | .rst (local_rst), |
---|
2176 | .clk (clk), |
---|
2177 | .se (se), |
---|
2178 | .si (), |
---|
2179 | .so () |
---|
2180 | ); |
---|
2181 | |
---|
2182 | |
---|
2183 | // |
---|
2184 | // added for bug 2133 |
---|
2185 | // modified at Farnad's request for bug 3599 |
---|
2186 | // modified back to the old behavior (pre bug 3599) due to bug 4698 |
---|
2187 | assign spu_ill_inst_g = |
---|
2188 | // spu_ill_inst_uf_g & ~(inst_ifu_flush_w); |
---|
2189 | // fix for bug 5863. Only a stxa to asi=40 with opcode-rsvd should cause an illgl_va |
---|
2190 | spu_ill_inst_uf_g & ~(inst_ifu_flush_w | lsu_tlu_early_flush_w); |
---|
2191 | |
---|
2192 | assign ffu_higher_pri_g = |
---|
2193 | ffu_ill_inst_g & (ifu_ttype_vld_tmp_g & (ifu_ttype_tmp_g == 9'h020)); |
---|
2194 | |
---|
2195 | // |
---|
2196 | assign ifu_ttype_g[8:0] = (((spu_ill_inst_g | ffu_ill_inst_g | htrap_ill_inst_g) & |
---|
2197 | ~(ifu_ttype_vld_tmp_g & (ifu_ttype_tmp_g < 9'h012)) & |
---|
2198 | ~immu_miss_g) | ffu_higher_pri_g) ? |
---|
2199 | 9'h010 : |
---|
2200 | ((tick_npt_priv_act_g | |
---|
2201 | (pib_priv_act_trap_g & ~ifu_ttype_vld_tmp_g)) ? 9'h037 : |
---|
2202 | ifu_ttype_tmp_g); |
---|
2203 | // |
---|
2204 | // added for timing fix |
---|
2205 | assign pib_priv_act_early_trap_m = |
---|
2206 | ((pib_priv_act_trap_m[0] & inst_vld_m & thread0_rsel_m) & |
---|
2207 | ~(tlu_pstate_priv_buf[0] | tlu_hpstate_priv[0])) | |
---|
2208 | ((pib_priv_act_trap_m[1] & inst_vld_m & thread1_rsel_m) & |
---|
2209 | ~(tlu_pstate_priv_buf[1] | tlu_hpstate_priv[1])) | |
---|
2210 | ((pib_priv_act_trap_m[2] & inst_vld_m & thread2_rsel_m) & |
---|
2211 | ~(tlu_pstate_priv_buf[2] | tlu_hpstate_priv[2])) | |
---|
2212 | ((pib_priv_act_trap_m[3] & inst_vld_m & thread3_rsel_m) & |
---|
2213 | ~(tlu_pstate_priv_buf[3] | tlu_hpstate_priv[3])); |
---|
2214 | // |
---|
2215 | |
---|
2216 | |
---|
2217 | // recoded the following for timing: |
---|
2218 | /* |
---|
2219 | assign exu_pib_priv_act_trap_m = |
---|
2220 | ((pib_priv_act_trap_m[0] & thread0_rsel_m) & |
---|
2221 | ~(tlu_pstate_priv[0] | tlu_hpstate_priv[0])) | |
---|
2222 | ((pib_priv_act_trap_m[1] & thread1_rsel_m) & |
---|
2223 | ~(tlu_pstate_priv[1] | tlu_hpstate_priv[1])) | |
---|
2224 | ((pib_priv_act_trap_m[2] & thread2_rsel_m) & |
---|
2225 | ~(tlu_pstate_priv[2] | tlu_hpstate_priv[2])) | |
---|
2226 | ((pib_priv_act_trap_m[3] & thread3_rsel_m) & |
---|
2227 | ~(tlu_pstate_priv[3] | tlu_hpstate_priv[3])); |
---|
2228 | */ |
---|
2229 | |
---|
2230 | wire [3:0] pib_priv_act_trap_thrd_qual_m; |
---|
2231 | wire [3:0] pib_priv_act_trap_thrd_hpstatepriv_qual_m; |
---|
2232 | wire [3:0] pib_priv_act_trap_thrd_hpstatepriv_pstatepriv_m; |
---|
2233 | |
---|
2234 | assign pib_priv_act_trap_thrd_qual_m[0] = pib_priv_act_trap_m[0] & thread0_rsel_m ; |
---|
2235 | assign pib_priv_act_trap_thrd_qual_m[1] = pib_priv_act_trap_m[1] & thread1_rsel_m ; |
---|
2236 | assign pib_priv_act_trap_thrd_qual_m[2] = pib_priv_act_trap_m[2] & thread2_rsel_m ; |
---|
2237 | assign pib_priv_act_trap_thrd_qual_m[3] = pib_priv_act_trap_m[3] & thread3_rsel_m ; |
---|
2238 | |
---|
2239 | assign pib_priv_act_trap_thrd_hpstatepriv_qual_m[0] = pib_priv_act_trap_thrd_qual_m[0] & ~tlu_hpstate_priv[0]; |
---|
2240 | assign pib_priv_act_trap_thrd_hpstatepriv_qual_m[1] = pib_priv_act_trap_thrd_qual_m[1] & ~tlu_hpstate_priv[1]; |
---|
2241 | assign pib_priv_act_trap_thrd_hpstatepriv_qual_m[2] = pib_priv_act_trap_thrd_qual_m[2] & ~tlu_hpstate_priv[2]; |
---|
2242 | assign pib_priv_act_trap_thrd_hpstatepriv_qual_m[3] = pib_priv_act_trap_thrd_qual_m[3] & ~tlu_hpstate_priv[3]; |
---|
2243 | |
---|
2244 | assign pib_priv_act_trap_thrd_hpstatepriv_pstatepriv_m[0] = pib_priv_act_trap_thrd_hpstatepriv_qual_m[0] & |
---|
2245 | ~tlu_pstate_priv[0]; |
---|
2246 | assign pib_priv_act_trap_thrd_hpstatepriv_pstatepriv_m[1] = pib_priv_act_trap_thrd_hpstatepriv_qual_m[1] & |
---|
2247 | ~tlu_pstate_priv[1]; |
---|
2248 | assign pib_priv_act_trap_thrd_hpstatepriv_pstatepriv_m[2] = pib_priv_act_trap_thrd_hpstatepriv_qual_m[2] & |
---|
2249 | ~tlu_pstate_priv[2]; |
---|
2250 | assign pib_priv_act_trap_thrd_hpstatepriv_pstatepriv_m[3] = pib_priv_act_trap_thrd_hpstatepriv_qual_m[3] & |
---|
2251 | ~tlu_pstate_priv[3]; |
---|
2252 | |
---|
2253 | assign exu_pib_priv_act_trap_m = (|pib_priv_act_trap_thrd_hpstatepriv_pstatepriv_m[3:0]); |
---|
2254 | |
---|
2255 | |
---|
2256 | // |
---|
2257 | // added for make pib overflow trap precise |
---|
2258 | assign pib_trap_en[0] = tlu_int_pstate_ie[0] & (true_pil0[3:0] < 4'hf); |
---|
2259 | assign pib_trap_en[1] = tlu_int_pstate_ie[1] & (true_pil1[3:0] < 4'hf); |
---|
2260 | assign pib_trap_en[2] = tlu_int_pstate_ie[2] & (true_pil2[3:0] < 4'hf); |
---|
2261 | assign pib_trap_en[3] = tlu_int_pstate_ie[3] & (true_pil3[3:0] < 4'hf); |
---|
2262 | // |
---|
2263 | // added for bug 5017 |
---|
2264 | dffr_s dffr_picl_wrap_pend_0 ( |
---|
2265 | .din (pib_picl_wrap[0]), |
---|
2266 | .q (picl_wrap_pend[0]), |
---|
2267 | .rst (local_rst | (thread_inst_vld_w2[0] & ~pib_picl_wrap[0] & ~tlu_full_flush_pipe_w2)), |
---|
2268 | .clk (clk), |
---|
2269 | .se (se), |
---|
2270 | .si (), |
---|
2271 | .so () |
---|
2272 | ); |
---|
2273 | dffr_s dffr_picl_wrap_pend_1 ( |
---|
2274 | .din (pib_picl_wrap[1]), |
---|
2275 | .q (picl_wrap_pend[1]), |
---|
2276 | .rst (local_rst | (thread_inst_vld_w2[1] & ~pib_picl_wrap[1] & ~tlu_full_flush_pipe_w2)), |
---|
2277 | .clk (clk), |
---|
2278 | .se (se), |
---|
2279 | .si (), |
---|
2280 | .so () |
---|
2281 | ); |
---|
2282 | dffr_s dffr_picl_wrap_pend_2 ( |
---|
2283 | .din (pib_picl_wrap[2]), |
---|
2284 | .q (picl_wrap_pend[2]), |
---|
2285 | .rst (local_rst | (thread_inst_vld_w2[2] & ~pib_picl_wrap[2] & ~tlu_full_flush_pipe_w2)), |
---|
2286 | .clk (clk), |
---|
2287 | .se (se), |
---|
2288 | .si (), |
---|
2289 | .so () |
---|
2290 | ); |
---|
2291 | dffr_s dffr_picl_wrap_pend_3 ( |
---|
2292 | .din (pib_picl_wrap[3]), |
---|
2293 | .q (picl_wrap_pend[3]), |
---|
2294 | .rst (local_rst | (thread_inst_vld_w2[3] & ~pib_picl_wrap[3] & ~tlu_full_flush_pipe_w2)), |
---|
2295 | .clk (clk), |
---|
2296 | .se (se), |
---|
2297 | .si (), |
---|
2298 | .so () |
---|
2299 | ); |
---|
2300 | |
---|
2301 | assign tlu_picl_wrap_flg_m = |
---|
2302 | (picl_wrap_pend[0] & thread0_stg_m_buf) | |
---|
2303 | (picl_wrap_pend[1] & thread1_stg_m_buf) | |
---|
2304 | (picl_wrap_pend[2] & thread2_stg_m_buf) | |
---|
2305 | (picl_wrap_pend[3] & thread3_stg_m_buf); |
---|
2306 | |
---|
2307 | // modified for bug 4086, 4206, 4246 and 4314 |
---|
2308 | // modified for bug 5033, 5083 and 5017 |
---|
2309 | // modified for bug 5436 - Niagara 2.0 |
---|
2310 | |
---|
2311 | // changed pend_pich_cnt_hld to pend_pich_cnt_hld_noqual as per bug5436(reopened 9/17/04). |
---|
2312 | assign pib_wrap_m[0] = |
---|
2313 | // (pib_picl_wrap[0] | |
---|
2314 | ((picl_wrap_pend[0] & thread0_rsel_m) | |
---|
2315 | (pich_wrap_flg[0] & inst_vld_m & thread0_rsel_m) | |
---|
2316 | (pich_onebelow_flg[0] & (inst_vld_m & thread0_rsel_m) & |
---|
2317 | ((inst_vld_g & thread0_rsel_g) | (inst_vld_w2 & thread0_wsel_w2))) | |
---|
2318 | (pich_twobelow_flg[0] & (inst_vld_m & thread0_rsel_m) & |
---|
2319 | (inst_vld_g & thread0_rsel_g) & (inst_vld_w2 & thread0_wsel_w2))) & |
---|
2320 | pib_trap_en[0] & ~(tlu_flush_pipe_w & thread0_rsel_g) & ~pend_pich_cnt_hld_noqual[0]; |
---|
2321 | assign pib_wrap_m[1] = |
---|
2322 | // (pib_picl_wrap[1] | |
---|
2323 | ((picl_wrap_pend[1] & thread1_rsel_m) | |
---|
2324 | (pich_wrap_flg[1] & inst_vld_m & thread1_rsel_m) | |
---|
2325 | (pich_onebelow_flg[1] & (inst_vld_m & thread1_rsel_m) & |
---|
2326 | ((inst_vld_g & thread1_rsel_g) | (inst_vld_w2 & thread1_wsel_w2))) | |
---|
2327 | (pich_twobelow_flg[1] & (inst_vld_m & thread1_rsel_m) & |
---|
2328 | (inst_vld_g & thread1_rsel_g) & (inst_vld_w2 & thread1_wsel_w2))) & |
---|
2329 | pib_trap_en[1] & ~(tlu_flush_pipe_w & thread1_rsel_g) & ~pend_pich_cnt_hld_noqual[1]; |
---|
2330 | assign pib_wrap_m[2] = |
---|
2331 | // (pib_picl_wrap[2] | |
---|
2332 | ((picl_wrap_pend[2] & thread2_rsel_m) | |
---|
2333 | (pich_wrap_flg[2] & inst_vld_m & thread2_rsel_m) | |
---|
2334 | (pich_onebelow_flg[2] & (inst_vld_m & thread2_rsel_m) & |
---|
2335 | ((inst_vld_g & thread2_rsel_g) | (inst_vld_w2 & thread2_wsel_w2))) | |
---|
2336 | (pich_twobelow_flg[2] & (inst_vld_m & thread2_rsel_m) & |
---|
2337 | (inst_vld_g & thread2_rsel_g) & (inst_vld_w2 & thread2_wsel_w2))) & |
---|
2338 | pib_trap_en[2] & ~(tlu_flush_pipe_w & thread2_rsel_g) & ~pend_pich_cnt_hld_noqual[2]; |
---|
2339 | assign pib_wrap_m[3] = |
---|
2340 | // (pib_picl_wrap[3] | |
---|
2341 | ((picl_wrap_pend[3] & thread3_rsel_m) | |
---|
2342 | (pich_wrap_flg[3] & inst_vld_m & thread3_rsel_m) | |
---|
2343 | (pich_onebelow_flg[3] & (inst_vld_m & thread3_rsel_m) & |
---|
2344 | ((inst_vld_g & thread3_rsel_g) | (inst_vld_w2 & thread3_wsel_w2))) | |
---|
2345 | (pich_twobelow_flg[3] & (inst_vld_m & thread3_rsel_m) & |
---|
2346 | (inst_vld_g & thread3_rsel_g) & (inst_vld_w2 & thread3_wsel_w2))) & |
---|
2347 | pib_trap_en[3] & ~(tlu_flush_pipe_w & thread3_rsel_g) & ~pend_pich_cnt_hld_noqual[3]; |
---|
2348 | |
---|
2349 | // modified for timing and bug 4314 and 5017 |
---|
2350 | // added for bug 5436 - Niagara 2.0 |
---|
2351 | |
---|
2352 | // removed qualification with ~pend_pich_cnt_hld from the following logics and pushed |
---|
2353 | // the qulaification to G stage only for software interupt bit15 setting. The above |
---|
2354 | // logic stay the same and no precise trap will be taken in the case of b2b valid |
---|
2355 | // instruction as indicated in bug5436(reopened 9/16/04) |
---|
2356 | assign pib_pich_wrap_m[0] = |
---|
2357 | // (pib_picl_wrap[0] | |
---|
2358 | ((picl_wrap_pend[0] & thread0_rsel_m) | |
---|
2359 | (pich_wrap_flg[0] & inst_vld_m & thread0_rsel_m) | |
---|
2360 | (pich_onebelow_flg[0] & (inst_vld_m & thread0_rsel_m) & |
---|
2361 | ((inst_vld_g & thread0_rsel_g) | (inst_vld_w2 & thread0_wsel_w2))) | |
---|
2362 | (pich_twobelow_flg[0] & (inst_vld_m & thread0_rsel_m) & |
---|
2363 | (inst_vld_g & thread0_rsel_g) & (inst_vld_w2 & thread0_wsel_w2))) & |
---|
2364 | ~(tlu_flush_pipe_w & thread0_rsel_g) ; |
---|
2365 | assign pib_pich_wrap_m[1] = |
---|
2366 | // (pib_picl_wrap[1] | |
---|
2367 | ((picl_wrap_pend[1] & thread1_rsel_m) | |
---|
2368 | (pich_wrap_flg[1] & inst_vld_m & thread1_rsel_m) | |
---|
2369 | (pich_onebelow_flg[1] & (inst_vld_m & thread1_rsel_m) & |
---|
2370 | ((inst_vld_g & thread1_rsel_g) | (inst_vld_w2 & thread1_wsel_w2))) | |
---|
2371 | (pich_twobelow_flg[1] & (inst_vld_m & thread1_rsel_m) & |
---|
2372 | (inst_vld_g & thread1_rsel_g) & (inst_vld_w2 & thread1_wsel_w2))) & |
---|
2373 | ~(tlu_flush_pipe_w & thread1_rsel_g) ; |
---|
2374 | assign pib_pich_wrap_m[2] = |
---|
2375 | // (pib_picl_wrap[2] | |
---|
2376 | ((picl_wrap_pend[2] & thread2_rsel_m) | |
---|
2377 | (pich_wrap_flg[2] & inst_vld_m & thread2_rsel_m) | |
---|
2378 | (pich_onebelow_flg[2] & (inst_vld_m & thread2_rsel_m) & |
---|
2379 | ((inst_vld_g & thread2_rsel_g) | (inst_vld_w2 & thread2_wsel_w2))) | |
---|
2380 | (pich_twobelow_flg[2] & (inst_vld_m & thread2_rsel_m) & |
---|
2381 | (inst_vld_g & thread2_rsel_g) & (inst_vld_w2 & thread2_wsel_w2))) & |
---|
2382 | ~(tlu_flush_pipe_w & thread2_rsel_g) ; |
---|
2383 | assign pib_pich_wrap_m[3] = |
---|
2384 | // (pib_picl_wrap[3] | |
---|
2385 | ((picl_wrap_pend[3] & thread3_rsel_m) | |
---|
2386 | (pich_wrap_flg[3] & inst_vld_m & thread3_rsel_m) | |
---|
2387 | (pich_onebelow_flg[3] & (inst_vld_m & thread3_rsel_m) & |
---|
2388 | ((inst_vld_g & thread3_rsel_g) | (inst_vld_w2 & thread3_wsel_w2))) | |
---|
2389 | (pich_twobelow_flg[3] & (inst_vld_m & thread3_rsel_m) & |
---|
2390 | (inst_vld_g & thread3_rsel_g) & (inst_vld_w2 & thread3_wsel_w2))) & |
---|
2391 | ~(tlu_flush_pipe_w & thread3_rsel_g) ; |
---|
2392 | /* |
---|
2393 | assign pib_wrap_m[0] = |
---|
2394 | (pib_picl_wrap[0] | |
---|
2395 | (pich_wrap_flg[0] & inst_vld_m & thread0_rsel_m) | |
---|
2396 | (pich_onebelow_flg[0] & inst_vld_m & (inst_vld_g | inst_vld_w2) & |
---|
2397 | thread0_rsel_m & (thread0_wsel_w2 | thread0_rsel_g)) | |
---|
2398 | (pich_twobelow_flg[0] & inst_vld_m & inst_vld_g & inst_vld_w2 & |
---|
2399 | thread0_rsel_g & thread0_rsel_m & thread0_wsel_w2)) & pib_trap_en[0] & |
---|
2400 | ~(tlu_flush_pipe_w & thread0_rsel_g); |
---|
2401 | assign pib_wrap_m[1] = |
---|
2402 | (pib_picl_wrap[1] | |
---|
2403 | (pich_wrap_flg[1] & inst_vld_m & thread1_rsel_m) | |
---|
2404 | (pich_onebelow_flg[1] & inst_vld_m & (inst_vld_g | inst_vld_w2) & |
---|
2405 | thread1_rsel_m & (thread1_wsel_w2 | thread1_rsel_g)) | |
---|
2406 | (pich_twobelow_flg[1] & inst_vld_m & inst_vld_g & inst_vld_w2 & |
---|
2407 | thread1_rsel_g & thread1_rsel_m & thread1_wsel_w2)) & pib_trap_en[1] & |
---|
2408 | ~(tlu_flush_pipe_w & thread1_rsel_g); |
---|
2409 | assign pib_wrap_m[2] = |
---|
2410 | (pib_picl_wrap[2] | |
---|
2411 | (pich_wrap_flg[2] & inst_vld_m & thread2_rsel_m) | |
---|
2412 | (pich_onebelow_flg[2] & inst_vld_m & (inst_vld_g | inst_vld_w2) & |
---|
2413 | thread2_rsel_m & (thread2_wsel_w2 | thread2_rsel_g)) | |
---|
2414 | (pich_twobelow_flg[2] & inst_vld_m & inst_vld_g & inst_vld_w2 & |
---|
2415 | thread2_rsel_g & thread2_rsel_m & thread2_wsel_w2)) & pib_trap_en[2] & |
---|
2416 | ~(tlu_flush_pipe_w & thread2_rsel_g); |
---|
2417 | assign pib_wrap_m[3] = |
---|
2418 | (pib_picl_wrap[3] | |
---|
2419 | (pich_wrap_flg[3] & inst_vld_m & thread3_rsel_m) | |
---|
2420 | (pich_onebelow_flg[3] & inst_vld_m & (inst_vld_g | inst_vld_w2) & |
---|
2421 | thread3_rsel_m & (thread3_wsel_w2 | thread3_rsel_g)) | |
---|
2422 | (pich_twobelow_flg[3] & inst_vld_m & inst_vld_g & inst_vld_w2 & |
---|
2423 | thread3_rsel_g & thread3_rsel_m & thread3_wsel_w2)) & pib_trap_en[3] & |
---|
2424 | ~(tlu_flush_pipe_w & thread3_rsel_g); |
---|
2425 | |
---|
2426 | // modified for timing and bug 4314 |
---|
2427 | assign pib_pich_wrap_m[0] = |
---|
2428 | (pib_picl_wrap[0] | |
---|
2429 | (pich_wrap_flg[0] & inst_vld_m & thread0_rsel_m) | |
---|
2430 | (pich_onebelow_flg[0] & inst_vld_m & (inst_vld_g | inst_vld_w2) & |
---|
2431 | thread0_rsel_m & (thread0_wsel_w2 | thread0_rsel_g)) | |
---|
2432 | (pich_twobelow_flg[0] & inst_vld_m & inst_vld_g & inst_vld_w2 & |
---|
2433 | thread0_rsel_g & thread0_rsel_m & thread0_wsel_w2)) & |
---|
2434 | ~(tlu_flush_pipe_w & thread0_rsel_g); |
---|
2435 | assign pib_pich_wrap_m[1] = |
---|
2436 | (pib_picl_wrap[1] | |
---|
2437 | (pich_wrap_flg[1] & inst_vld_m & thread1_rsel_m) | |
---|
2438 | (pich_onebelow_flg[1] & inst_vld_m & (inst_vld_g | inst_vld_w2) & |
---|
2439 | thread1_rsel_m & (thread1_wsel_w2 | thread1_rsel_g)) | |
---|
2440 | (pich_twobelow_flg[1] & inst_vld_m & inst_vld_g & inst_vld_w2 & |
---|
2441 | thread1_rsel_g & thread1_rsel_m & thread1_wsel_w2)) & |
---|
2442 | ~(tlu_flush_pipe_w & thread1_rsel_g); |
---|
2443 | assign pib_pich_wrap_m[2] = |
---|
2444 | (pib_picl_wrap[2] | |
---|
2445 | (pich_wrap_flg[2] & inst_vld_m & thread2_rsel_m) | |
---|
2446 | (pich_onebelow_flg[2] & inst_vld_m & (inst_vld_g | inst_vld_w2) & |
---|
2447 | thread2_rsel_m & (thread2_wsel_w2 | thread2_rsel_g)) | |
---|
2448 | (pich_twobelow_flg[2] & inst_vld_m & inst_vld_g & inst_vld_w2 & |
---|
2449 | thread2_rsel_g & thread2_rsel_m & thread2_wsel_w2)) & |
---|
2450 | ~(tlu_flush_pipe_w & thread2_rsel_g); |
---|
2451 | assign pib_pich_wrap_m[3] = |
---|
2452 | (pib_picl_wrap[3] | |
---|
2453 | (pich_wrap_flg[3] & inst_vld_m & thread3_rsel_m) | |
---|
2454 | (pich_onebelow_flg[3] & inst_vld_m & (inst_vld_g | inst_vld_w2) & |
---|
2455 | thread3_rsel_m & (thread3_wsel_w2 | thread3_rsel_g)) | |
---|
2456 | (pich_twobelow_flg[3] & inst_vld_m & inst_vld_g & inst_vld_w2 & |
---|
2457 | thread3_rsel_g & thread3_rsel_m & thread3_wsel_w2)) & |
---|
2458 | ~(tlu_flush_pipe_w & thread3_rsel_g); |
---|
2459 | // |
---|
2460 | */ |
---|
2461 | |
---|
2462 | |
---|
2463 | wire [3:0] pib_pich_wrap_q; |
---|
2464 | |
---|
2465 | dffr_s #(`TLU_THRD_NUM) dffr_pib_pich_wrap ( |
---|
2466 | .din (pib_pich_wrap_m[`TLU_THRD_NUM-1:0]), |
---|
2467 | .q (pib_pich_wrap_q[`TLU_THRD_NUM-1:0]), |
---|
2468 | .rst (local_rst), |
---|
2469 | .clk (clk), |
---|
2470 | .se (se), |
---|
2471 | .si (), |
---|
2472 | .so () |
---|
2473 | ); |
---|
2474 | |
---|
2475 | // added for the bug 5436 reopened on 9/16/2004 by Samy. The following pushes |
---|
2476 | // the qualification by hold signal to G stage.So sofint bit15 is set for signaling |
---|
2477 | // software a overflow has occurred. But the preciese trap will not be taken. |
---|
2478 | assign pib_pich_wrap[3:0] = pib_pich_wrap_q[3:0] & {4{~pend_pich_cnt_hld}}; |
---|
2479 | |
---|
2480 | |
---|
2481 | // |
---|
2482 | // experiment |
---|
2483 | /* |
---|
2484 | assign pich_exu_wrap_e[0] = |
---|
2485 | tlu_thread_inst_vld_w2[0]? pich_onebelow_flg[0]: pich_wrap_flg[0]; |
---|
2486 | assign pich_exu_wrap_e[1] = |
---|
2487 | tlu_thread_inst_vld_w2[1]? pich_onebelow_flg[1]: pich_wrap_flg[1]; |
---|
2488 | assign pich_exu_wrap_e[2] = |
---|
2489 | tlu_thread_inst_vld_w2[2]? pich_onebelow_flg[2]: pich_wrap_flg[2]; |
---|
2490 | assign pich_exu_wrap_e[3] = |
---|
2491 | tlu_thread_inst_vld_w2[3]? pich_onebelow_flg[3]: pich_wrap_flg[3]; |
---|
2492 | |
---|
2493 | assign pich_wrap_flg_e = |
---|
2494 | (tlu_thrd_rsel_e[0]) ? pich_exu_wrap_e[0]: |
---|
2495 | (tlu_thrd_rsel_e[1]) ? pich_exu_wrap_e[1]: |
---|
2496 | (tlu_thrd_rsel_e[2]) ? pich_exu_wrap_e[2]: |
---|
2497 | pich_exu_wrap_e[3]; |
---|
2498 | */ |
---|
2499 | |
---|
2500 | dffr_s dffr_pich_wrap_flg_m ( |
---|
2501 | .din (tlu_pic_wrap_e), |
---|
2502 | .q (pich_wrap_flg_m), |
---|
2503 | .rst (local_rst), |
---|
2504 | .clk (clk), |
---|
2505 | .se (se), |
---|
2506 | .si (), |
---|
2507 | .so () |
---|
2508 | ); |
---|
2509 | // |
---|
2510 | // modified for bug 5436 - Niagara 2.0 |
---|
2511 | assign tlu_pich_wrap_flg_m = |
---|
2512 | pich_wrap_flg_m & tlu_pic_cnt_en_m; |
---|
2513 | /* |
---|
2514 | assign pic_hpstate_priv_e = |
---|
2515 | (tlu_thrd_rsel_e[0]) ? tlu_hpstate_priv[0]: |
---|
2516 | (tlu_thrd_rsel_e[1]) ? tlu_hpstate_priv[1]: |
---|
2517 | (tlu_thrd_rsel_e[2]) ? tlu_hpstate_priv[2]: |
---|
2518 | tlu_hpstate_priv[3]; |
---|
2519 | |
---|
2520 | assign pic_pstate_priv_e = |
---|
2521 | (tlu_thrd_rsel_e[0]) ? tlu_pstate_priv_buf[0]: |
---|
2522 | (tlu_thrd_rsel_e[1]) ? tlu_pstate_priv_buf[1]: |
---|
2523 | (tlu_thrd_rsel_e[2]) ? tlu_pstate_priv_buf[2]: |
---|
2524 | tlu_pstate_priv_buf[3]; |
---|
2525 | |
---|
2526 | assign pic_hpstate_enb_e = |
---|
2527 | (tlu_thrd_rsel_e[0]) ? tlu_hpstate_enb[0]: |
---|
2528 | (tlu_thrd_rsel_e[1]) ? tlu_hpstate_enb[1]: |
---|
2529 | (tlu_thrd_rsel_e[2]) ? tlu_hpstate_enb[2]: |
---|
2530 | tlu_hpstate_enb[3]; |
---|
2531 | |
---|
2532 | assign pic_trap_en_e = |
---|
2533 | (tlu_thrd_rsel_e[0]) ? pib_trap_en[0]: |
---|
2534 | (tlu_thrd_rsel_e[1]) ? pib_trap_en[1]: |
---|
2535 | (tlu_thrd_rsel_e[2]) ? pib_trap_en[2]: |
---|
2536 | pib_trap_en[3]; |
---|
2537 | */ |
---|
2538 | |
---|
2539 | // modified for bug 5436 - Niagara 2.0 |
---|
2540 | |
---|
2541 | assign pic_cnt_en[0] = |
---|
2542 | ((~tlu_hpstate_priv[0] & ~tlu_pstate_priv_buf[0] & tlu_pcr_ut[0]) | |
---|
2543 | (~tlu_hpstate_enb[0] & tlu_hpstate_priv[0] & tlu_pcr_st[0]) | |
---|
2544 | (tlu_hpstate_enb[0] & tlu_pstate_priv_buf[0] & ~tlu_hpstate_priv[0] & |
---|
2545 | //tlu_pcr_st[0])) & pib_trap_en[0]; |
---|
2546 | tlu_pcr_st[0])) ; |
---|
2547 | assign pic_cnt_en[1] = |
---|
2548 | ((~tlu_hpstate_priv[1] & ~tlu_pstate_priv_buf[1] & tlu_pcr_ut[1]) | |
---|
2549 | (~tlu_hpstate_enb[1] & tlu_hpstate_priv[1] & tlu_pcr_st[1]) | |
---|
2550 | (tlu_hpstate_enb[1] & tlu_pstate_priv_buf[1] & ~tlu_hpstate_priv[1] & |
---|
2551 | //tlu_pcr_st[1])) & pib_trap_en[1]; |
---|
2552 | tlu_pcr_st[1])) ; |
---|
2553 | assign pic_cnt_en[2] = |
---|
2554 | ((~tlu_hpstate_priv[2] & ~tlu_pstate_priv_buf[2] & tlu_pcr_ut[2]) | |
---|
2555 | (~tlu_hpstate_enb[2] & tlu_hpstate_priv[2] & tlu_pcr_st[2]) | |
---|
2556 | (tlu_hpstate_enb[2] & tlu_pstate_priv_buf[2] & ~tlu_hpstate_priv[2] & |
---|
2557 | //tlu_pcr_st[2])) & pib_trap_en[2]; |
---|
2558 | tlu_pcr_st[2])) ; |
---|
2559 | assign pic_cnt_en[3] = |
---|
2560 | ((~tlu_hpstate_priv[3] & ~tlu_pstate_priv_buf[3] & tlu_pcr_ut[3]) | |
---|
2561 | (~tlu_hpstate_enb[3] & tlu_hpstate_priv[3] & tlu_pcr_st[3]) | |
---|
2562 | (tlu_hpstate_enb[3] & tlu_pstate_priv_buf[3] & ~tlu_hpstate_priv[3] & |
---|
2563 | //tlu_pcr_st[3])) & pib_trap_en[3]; |
---|
2564 | tlu_pcr_st[3])) ; |
---|
2565 | |
---|
2566 | assign pic_cnt_en_e = |
---|
2567 | (tlu_thrd_rsel_e[0]) ? pic_cnt_en[0]: |
---|
2568 | (tlu_thrd_rsel_e[1]) ? pic_cnt_en[1]: |
---|
2569 | (tlu_thrd_rsel_e[2]) ? pic_cnt_en[2]: |
---|
2570 | pic_cnt_en[3]; |
---|
2571 | |
---|
2572 | |
---|
2573 | /* |
---|
2574 | assign pic_cnt_en_e = |
---|
2575 | ((~pic_hpstate_priv_e & ~pic_pstate_priv_e & pcr_ut_e) | |
---|
2576 | (~pic_hpstate_enb_e & pic_hpstate_priv_e & pcr_st_e) | |
---|
2577 | (pic_hpstate_enb_e & pic_pstate_priv_e & ~pic_hpstate_priv_e & |
---|
2578 | pcr_st_e)) & pic_trap_en_e; |
---|
2579 | */ |
---|
2580 | |
---|
2581 | dffr_s dffr_tlu_pic_cnt_en_m ( |
---|
2582 | .din (pic_cnt_en_e), |
---|
2583 | .q (pic_cnt_en_m), |
---|
2584 | .rst (local_rst), |
---|
2585 | .clk (clk), |
---|
2586 | .se (se), |
---|
2587 | .si (), |
---|
2588 | .so () |
---|
2589 | ); |
---|
2590 | |
---|
2591 | /**** replaced the following with and-or for better synthesis interms of timing |
---|
2592 | assign tlu_pich_cnt_hld = |
---|
2593 | (thread0_rsel_m) ? pend_pich_cnt_hld[0]: |
---|
2594 | (thread1_rsel_m) ? pend_pich_cnt_hld[1]: |
---|
2595 | (thread2_rsel_m) ? pend_pich_cnt_hld[2]: |
---|
2596 | pend_pich_cnt_hld[3]; |
---|
2597 | ************/ |
---|
2598 | |
---|
2599 | |
---|
2600 | assign tlu_pich_cnt_hld = (thread0_stg_m & pend_pich_cnt_hld_early[0]) | |
---|
2601 | (thread1_stg_m & pend_pich_cnt_hld_early[1]) | |
---|
2602 | (thread2_stg_m & pend_pich_cnt_hld_early[2]) | |
---|
2603 | (thread3_stg_m & pend_pich_cnt_hld_early[3]) ; |
---|
2604 | |
---|
2605 | |
---|
2606 | // added the follwoing since we still want to qualify with pib_trap_en for the trap signal going |
---|
2607 | // to exu, i.e. tlu_pic_cnt_en_m is used to generate tlu_exu_pic_onebelow_m in tlu_misctl.v |
---|
2608 | wire pic_trap_en_e = |
---|
2609 | (tlu_thrd_rsel_e[0]) ? pib_trap_en[0]: |
---|
2610 | (tlu_thrd_rsel_e[1]) ? pib_trap_en[1]: |
---|
2611 | (tlu_thrd_rsel_e[2]) ? pib_trap_en[2]: |
---|
2612 | pib_trap_en[3]; |
---|
2613 | |
---|
2614 | wire pic_trap_en_m; |
---|
2615 | |
---|
2616 | dffr_s dffr_pic_trap_en_m ( |
---|
2617 | .din (pic_trap_en_e), |
---|
2618 | .q (pic_trap_en_m), |
---|
2619 | .rst (local_rst), .clk (clk), .se (se), .si (), .so ()); |
---|
2620 | |
---|
2621 | wire tlu_pic_cnt_en_m_prequal = pic_cnt_en_m & pic_trap_en_m; |
---|
2622 | |
---|
2623 | assign tlu_pic_cnt_en_m = tlu_pic_cnt_en_m_prequal & ~tlu_pich_cnt_hld; |
---|
2624 | |
---|
2625 | // |
---|
2626 | // added for bug 5436 - Niagara 2.0 |
---|
2627 | dffr_s dffr_pic_cnt_en_w ( |
---|
2628 | .din (pic_cnt_en_m), |
---|
2629 | .q (pic_cnt_en_w), |
---|
2630 | .rst (local_rst), |
---|
2631 | .clk (clk), |
---|
2632 | .se (se), |
---|
2633 | .si (), |
---|
2634 | .so () |
---|
2635 | ); |
---|
2636 | |
---|
2637 | dffr_s dffr_pic_cnt_en_w2 ( |
---|
2638 | .din (pic_cnt_en_w), |
---|
2639 | .q (pic_cnt_en_w2), |
---|
2640 | .rst (local_rst), |
---|
2641 | .clk (clk), |
---|
2642 | .se (se), |
---|
2643 | .si (), |
---|
2644 | .so () |
---|
2645 | ); |
---|
2646 | |
---|
2647 | /* |
---|
2648 | // added for bug 4785 |
---|
2649 | assign tlu_pic_onebelow_e = |
---|
2650 | (thread0_rsel_e) ? pich_onebelow_flg[0] : |
---|
2651 | (thread1_rsel_e) ? pich_onebelow_flg[1] : |
---|
2652 | (thread2_rsel_e) ? pich_onebelow_flg[2] : |
---|
2653 | pich_onebelow_flg[3]; |
---|
2654 | |
---|
2655 | dffr_s dffr_tlu_exu_pic_onebelow_m ( |
---|
2656 | .din (tlu_pic_onebelow_e), |
---|
2657 | .q (tlu_exu_pic_onebelow_m), |
---|
2658 | .rst (local_rst), |
---|
2659 | .clk (clk), |
---|
2660 | .se (se), |
---|
2661 | .si (), |
---|
2662 | .so () |
---|
2663 | ); |
---|
2664 | |
---|
2665 | assign tlu_pic_twobelow_e = |
---|
2666 | (thread0_rsel_e) ? pich_twobelow_flg[0] : |
---|
2667 | (thread1_rsel_e) ? pich_twobelow_flg[1] : |
---|
2668 | (thread2_rsel_e) ? pich_twobelow_flg[2] : |
---|
2669 | pich_twobelow_flg[3]; |
---|
2670 | |
---|
2671 | dffr_s dffr_tlu_exu_pic_twobelow_m ( |
---|
2672 | .din (tlu_pic_twobelow_e), |
---|
2673 | .q (tlu_exu_pic_twobelow_m), |
---|
2674 | .rst (local_rst), |
---|
2675 | .clk (clk), |
---|
2676 | .se (se), |
---|
2677 | .si (), |
---|
2678 | .so () |
---|
2679 | ); |
---|
2680 | */ |
---|
2681 | // |
---|
2682 | // added for bug 4395 |
---|
2683 | dffr_s dffr_tlu_tcc_inst_w ( |
---|
2684 | .din (exu_tlu_ttype_m[8]), |
---|
2685 | .q (tlu_tcc_inst_w), |
---|
2686 | .clk (clk), |
---|
2687 | .rst (local_rst), |
---|
2688 | .se (se), |
---|
2689 | .si (), |
---|
2690 | .so () |
---|
2691 | ); |
---|
2692 | // |
---|
2693 | assign pib_wrap_trap_m = (|pib_wrap_m[`TLU_THRD_NUM-1:0]); |
---|
2694 | // |
---|
2695 | // modified for bug 4342 |
---|
2696 | // pib wrap precise trap |
---|
2697 | dffr_s dffr_pib_wrap_trap_nq_g ( |
---|
2698 | .din (pib_wrap_trap_m), |
---|
2699 | .q (pib_wrap_trap_nq_g), |
---|
2700 | .rst (local_rst), |
---|
2701 | .clk (clk), |
---|
2702 | .se (se), |
---|
2703 | .si (), |
---|
2704 | .so () |
---|
2705 | ); |
---|
2706 | |
---|
2707 | // modified for bug 4916 |
---|
2708 | assign pib_wrap_trap_g = |
---|
2709 | pib_wrap_trap_nq_g & ~lsu_tlu_defr_trp_taken_g; |
---|
2710 | // |
---|
2711 | // modified for bug 2955 |
---|
2712 | assign tlu_exu_priv_trap_m = |
---|
2713 | exu_pib_priv_act_trap_m | exu_tick_npt_priv_act_m | |
---|
2714 | (|tlz_exu_trap_m[`TLU_THRD_NUM-1:0]) | tlu_pich_wrap_flg_m | |
---|
2715 | tlu_picl_wrap_flg_m; |
---|
2716 | // |
---|
2717 | // illegal instruction from ffu |
---|
2718 | dffr_s dffr_ffu_ill_inst_uf_g ( |
---|
2719 | .din (ffu_tlu_ill_inst_m), |
---|
2720 | .q (ffu_ill_inst_uf_g), |
---|
2721 | .rst (local_rst), |
---|
2722 | .clk (clk), |
---|
2723 | .se (se), |
---|
2724 | .si (), |
---|
2725 | .so () |
---|
2726 | ); |
---|
2727 | |
---|
2728 | assign ffu_ill_inst_g = ffu_ill_inst_uf_g & ~inst_ifu_flush_w; |
---|
2729 | /* |
---|
2730 | dffr_s dffr_lsu_ill_inst_uf_g ( |
---|
2731 | .din (lsu_tlu_ill_inst_m), |
---|
2732 | .q (lsu_ill_inst_uf_g), |
---|
2733 | .rst (local_rst), |
---|
2734 | .clk (clk), |
---|
2735 | .se (se), |
---|
2736 | .si (), |
---|
2737 | .so () |
---|
2738 | ); |
---|
2739 | |
---|
2740 | assign lsu_ill_inst_g = lsu_ill_inst_uf_g & ~inst_ifu_flush_w; |
---|
2741 | // |
---|
2742 | */ |
---|
2743 | // added for bug 4074 and modified for bug 4715 |
---|
2744 | /* |
---|
2745 | dffr_s dffr_lsu_tlu_defr_trp_taken_w2 ( |
---|
2746 | .din (lsu_tlu_defr_trp_taken_g), |
---|
2747 | .q (lsu_tlu_defr_trp_taken_w2), |
---|
2748 | .rst (local_rst), |
---|
2749 | .clk (clk), |
---|
2750 | .se (se), |
---|
2751 | .si (), |
---|
2752 | .so () |
---|
2753 | ); |
---|
2754 | */ |
---|
2755 | |
---|
2756 | assign lsu_defr_trp_taken_w2[0] = lsu_defr_trap_w2 & thread0_wsel_w2; |
---|
2757 | assign lsu_defr_trp_taken_w2[1] = lsu_defr_trap_w2 & thread1_wsel_w2; |
---|
2758 | assign lsu_defr_trp_taken_w2[2] = lsu_defr_trap_w2 & thread2_wsel_w2; |
---|
2759 | assign lsu_defr_trp_taken_w2[3] = lsu_defr_trap_w2 & thread3_wsel_w2; |
---|
2760 | |
---|
2761 | |
---|
2762 | // added for the lsu deferred trap - bug 3060 |
---|
2763 | // modified for bug 4074, 4561 and 4916 |
---|
2764 | assign lsu_defr_trap_g = lsu_tlu_defr_trp_taken_g & ~ifu_tlu_flush_fd_w; |
---|
2765 | // assign lsu_defr_trap_g = lsu_tlu_defr_trp_taken_g; |
---|
2766 | |
---|
2767 | assign local_lsu_async_ttype_vld_w = lsu_tlu_async_ttype_vld_g; |
---|
2768 | // |
---|
2769 | // modified for bug 4443 and 4561 |
---|
2770 | // added for timing |
---|
2771 | dffr_s dffr_lsu_defr_trap_w2 ( |
---|
2772 | .din (lsu_defr_trap_g), |
---|
2773 | .q (lsu_defr_trap_w2), |
---|
2774 | .rst (local_rst), |
---|
2775 | .clk (clk), |
---|
2776 | .se (se), |
---|
2777 | .si (), |
---|
2778 | .so () |
---|
2779 | ); |
---|
2780 | // |
---|
2781 | // privilege action trap of the PIB registers |
---|
2782 | dffr_s dffr_pib_priv_act_trap_g ( |
---|
2783 | .din (pib_priv_act_early_trap_m), |
---|
2784 | .q (pib_priv_act_trap_uf_g), |
---|
2785 | .rst (local_rst), |
---|
2786 | .clk (clk), |
---|
2787 | .se (se), |
---|
2788 | .si (), |
---|
2789 | .so () |
---|
2790 | ); |
---|
2791 | // |
---|
2792 | // added for bug 2133 |
---|
2793 | assign pib_priv_act_trap_g = pib_priv_act_trap_uf_g & ~inst_ifu_flush_w; |
---|
2794 | // |
---|
2795 | assign ifu_ttype_vld_g = ifu_ttype_vld_tmp_g | spu_ill_inst_g | immu_miss_g | |
---|
2796 | tick_npt_priv_act_g | ffu_ill_inst_g | pib_priv_act_trap_g | |
---|
2797 | htrap_ill_inst_g; |
---|
2798 | // |
---|
2799 | // added and modified for timing fix |
---|
2800 | assign ifu_ttype_early_vld_m = |
---|
2801 | (ifu_ttype_vld_m | pib_priv_act_early_trap_m | |
---|
2802 | spu_ill_inst_m | tick_npt_priv_act_m | ffu_tlu_ill_inst_m | |
---|
2803 | htrap_ill_inst_m); |
---|
2804 | |
---|
2805 | assign early_dside_trap_g = |
---|
2806 | (local_sync_trap_g & ~inst_ifu_flush2_w) | |
---|
2807 | va_oor_inst_acc_excp_g | va_oor_data_acc_excp_g; |
---|
2808 | // |
---|
2809 | assign dside_sync_trap_g = |
---|
2810 | lsu_ttype_vld_w | early_dside_trap_g; |
---|
2811 | // |
---|
2812 | // The sync ttype is being recoded for timing |
---|
2813 | // Merge with lsu traps. |
---|
2814 | // |
---|
2815 | mux2ds #(`TSA_TTYPE_WIDTH) mx_local_sync_ttype ( |
---|
2816 | .in0 (`INST_ACC_EXC), |
---|
2817 | .in1 (`DATA_ACC_EXC), |
---|
2818 | .sel0 (va_oor_inst_acc_excp_g), |
---|
2819 | .sel1 (~va_oor_inst_acc_excp_g), |
---|
2820 | .dout (local_sync_ttype_g[`TSA_TTYPE_WIDTH-1:0]) |
---|
2821 | ); |
---|
2822 | |
---|
2823 | // Need 9b comparator. |
---|
2824 | // assign dside_higher_priority = (dside_sync_ttype_g[8:0] > exu_ttype_g[8:0]); |
---|
2825 | assign local_higher_ttype_flg = |
---|
2826 | (local_sync_ttype_g[`TSA_TTYPE_WIDTH-1:0] > |
---|
2827 | exu_ttype_g[`TSA_TTYPE_WIDTH-1:0]); |
---|
2828 | |
---|
2829 | // added for bug 3977 |
---|
2830 | dffr_s dffr_exu_ue_trap_g ( |
---|
2831 | .din (exu_tlu_ue_trap_m), |
---|
2832 | .q (exu_ue_trap_g), |
---|
2833 | .rst (local_rst), |
---|
2834 | .clk (clk), |
---|
2835 | .se (se), |
---|
2836 | .si (), |
---|
2837 | .so () |
---|
2838 | ); |
---|
2839 | assign exu_higher_pri_g = |
---|
2840 | exu_ue_trap_g & exu_ttype_vld_g & ~immu_miss_g; |
---|
2841 | |
---|
2842 | // Is the prioritization needed or is this handled among the units themselves ? |
---|
2843 | // modified for bug 3977 |
---|
2844 | assign priority_trap_sel0 = |
---|
2845 | ifu_ttype_vld_g & ~((|tlz_trap_g[`TLU_THRD_NUM-1:0]) | |
---|
2846 | lsu_defr_trap_g | exu_higher_pri_g); |
---|
2847 | // |
---|
2848 | // modified for support to lsu deferred traps |
---|
2849 | // modified for bug 3977 |
---|
2850 | assign priority_trap_sel1 = |
---|
2851 | ~((|tlz_trap_g[`TLU_THRD_NUM-1:0]) | lsu_defr_trap_g) & |
---|
2852 | ~(ifu_ttype_vld_g & ~exu_higher_pri_g) & |
---|
2853 | ((exu_ttype_vld_g & ~early_dside_trap_g) | |
---|
2854 | ((exu_ttype_vld_g & early_dside_trap_g) & ~local_higher_ttype_flg)); |
---|
2855 | // |
---|
2856 | // modified for bug 3634 |
---|
2857 | assign priority_trap_sel2 = ~(priority_trap_sel0 | priority_trap_sel1); |
---|
2858 | // |
---|
2859 | // recoded for timing |
---|
2860 | // Prioritized ttype for thread available. |
---|
2861 | /* |
---|
2862 | mux4ds #(9) finaltt_sel ( |
---|
2863 | .in0 ({2'b00,`TLZ_TRAP}), |
---|
2864 | .in1 (ifu_ttype_g[8:0]), |
---|
2865 | .in2 (exu_ttype_g[8:0]), |
---|
2866 | .in3 (dside_sync_ttype_g[8:0]), |
---|
2867 | .sel0 (|tlz_trap_g[`TLU_THRD_NUM-1:0]), |
---|
2868 | .sel1 (priority_trap_sel0), |
---|
2869 | .sel2 (priority_trap_sel1), |
---|
2870 | .sel3 (priority_trap_sel2), |
---|
2871 | .dout (sync_ttype_g[8:0]) |
---|
2872 | ); |
---|
2873 | */ |
---|
2874 | // |
---|
2875 | // modified for bug 3634 |
---|
2876 | // modified for bug 3977 |
---|
2877 | mux3ds #(`TSA_TTYPE_WIDTH) mx_early_sync_ttype ( |
---|
2878 | // .in0 ({2'b00,`TLZ_TRAP}), |
---|
2879 | .in0 (ifu_ttype_g[8:0]), |
---|
2880 | .in1 (exu_ttype_g[8:0]), |
---|
2881 | .in2 (local_sync_ttype_g[8:0]), |
---|
2882 | .sel0 (priority_trap_sel0), |
---|
2883 | .sel1 (priority_trap_sel1), |
---|
2884 | .sel2 (priority_trap_sel2), |
---|
2885 | .dout (early_sync_ttype_g[`TSA_TTYPE_WIDTH-1:0]) |
---|
2886 | ); |
---|
2887 | // |
---|
2888 | // added for timing |
---|
2889 | dff_s #(`TSA_TTYPE_WIDTH) dff_early_sync_ttype_w2 ( |
---|
2890 | .din (early_sync_ttype_g[`TSA_TTYPE_WIDTH-1:0]), |
---|
2891 | .q (early_sync_ttype_w2[`TSA_TTYPE_WIDTH-1:0]), |
---|
2892 | .clk (clk), |
---|
2893 | .se (se), |
---|
2894 | .si (), |
---|
2895 | .so () |
---|
2896 | ); |
---|
2897 | // |
---|
2898 | // Now pend Div and Spill/Fill traps if necessary. These traps are always pended |
---|
2899 | // even if there is no concurrent synchronous trap. They are pended by thread. |
---|
2900 | // Include fp traps |
---|
2901 | // modified for bug 4857 |
---|
2902 | assign sync_trap_taken_g = |
---|
2903 | ((ifu_ttype_vld_g | exu_ttype_vld_g | lsu_tlu_ttype_vld_m2 | early_dside_trap_g | |
---|
2904 | (|tlz_trap_g[`TLU_THRD_NUM-1:0]) | pib_wrap_trap_g) & inst_vld_g) | |
---|
2905 | intrpt_taken | swint_taken | lsu_defr_trap_g; |
---|
2906 | // (|tlz_trap_g[`TLU_THRD_NUM-1:0])) & inst_vld_g) | intrpt_taken | swint_taken | |
---|
2907 | // lsu_defr_trap_g | pib_wrap_trap_g; |
---|
2908 | // |
---|
2909 | // added for timing |
---|
2910 | dff_s dff_sync_trap_taken_w2 ( |
---|
2911 | .din (sync_trap_taken_g), |
---|
2912 | .q (sync_trap_taken_w2), |
---|
2913 | .clk (clk), |
---|
2914 | .se (se), |
---|
2915 | .si (), |
---|
2916 | .so () |
---|
2917 | ); |
---|
2918 | // |
---|
2919 | // added for timing fix |
---|
2920 | // modified for bug 3653, bug 4758 and bug 5169 |
---|
2921 | assign sync_trap_taken_m = |
---|
2922 | (exu_tlu_va_oor_jl_ret_m | exu_tlu_ttype_vld_m | |
---|
2923 | ifu_ttype_early_vld_m | (|tlz_trap_m[`TLU_THRD_NUM-1:0]) | true_hscpd_dacc_excpt_m | |
---|
2924 | true_qtail_dacc_excpt_m | dmmu_va_oor_m | exu_tlu_va_oor_jl_ret_m | |
---|
2925 | pib_wrap_trap_m | ifu_swint_m | ifu_hwint_m | ifu_rstint_m) & inst_vld_m; |
---|
2926 | /* |
---|
2927 | assign sync_trap_taken_m = |
---|
2928 | ((exu_tlu_va_oor_jl_ret_m | exu_tlu_ttype_vld_m | |
---|
2929 | ifu_ttype_early_vld_m | (|tlz_trap_m[`TLU_THRD_NUM-1:0]) | true_hscpd_dacc_excpt_m | |
---|
2930 | true_qtail_dacc_excpt_m | dmmu_va_oor_m | exu_tlu_va_oor_jl_ret_m) & |
---|
2931 | inst_vld_m) | pib_wrap_trap_m | ifu_swint_m | ifu_hwint_m | ifu_rstint_m; |
---|
2932 | */ |
---|
2933 | |
---|
2934 | assign fp_trap_thrd0 = ~ffu_ifu_tid_w2[1] & ~ffu_ifu_tid_w2[0]; |
---|
2935 | assign fp_trap_thrd1 = ~ffu_ifu_tid_w2[1] & ffu_ifu_tid_w2[0]; |
---|
2936 | assign fp_trap_thrd2 = ffu_ifu_tid_w2[1] & ~ffu_ifu_tid_w2[0]; |
---|
2937 | assign fp_trap_thrd3 = ffu_ifu_tid_w2[1] & ffu_ifu_tid_w2[0]; |
---|
2938 | |
---|
2939 | // assign div_zero_thrd0 = ~exu_tlu_div_tid[1] & ~exu_tlu_div_tid[0]; |
---|
2940 | // assign div_zero_thrd1 = ~exu_tlu_div_tid[1] & exu_tlu_div_tid[0]; |
---|
2941 | // assign div_zero_thrd2 = exu_tlu_div_tid[1] & ~exu_tlu_div_tid[0]; |
---|
2942 | // assign div_zero_thrd3 = exu_tlu_div_tid[1] & exu_tlu_div_tid[0]; |
---|
2943 | |
---|
2944 | assign spill_thrd0 = ~exu_tlu_spill_tid[1] & ~exu_tlu_spill_tid[0]; |
---|
2945 | assign spill_thrd1 = ~exu_tlu_spill_tid[1] & exu_tlu_spill_tid[0]; |
---|
2946 | assign spill_thrd2 = exu_tlu_spill_tid[1] & ~exu_tlu_spill_tid[0]; |
---|
2947 | assign spill_thrd3 = exu_tlu_spill_tid[1] & exu_tlu_spill_tid[0]; |
---|
2948 | // |
---|
2949 | // added for bug 3499 |
---|
2950 | dff_s #(`TLU_THRD_NUM) dff_cwp_en_thrd_reset ( |
---|
2951 | .din ({pend_to_thrd3_reset, pend_to_thrd2_reset, |
---|
2952 | pend_to_thrd1_reset, pend_to_thrd0_reset}), |
---|
2953 | .q (cwp_en_thrd_reset[`TLU_THRD_NUM-1:0]), |
---|
2954 | .clk (clk), |
---|
2955 | .se (se), |
---|
2956 | .si (), |
---|
2957 | .so () |
---|
2958 | ); |
---|
2959 | |
---|
2960 | dffre_s dffre_trap_cwp0_enb ( |
---|
2961 | .din (spill_thrd0), |
---|
2962 | .q (trap_cwp_enb[0]), |
---|
2963 | .rst (cwp_en_thrd_reset[0]), |
---|
2964 | .en (exu_tlu_spill & spill_thrd0), |
---|
2965 | .clk (clk), |
---|
2966 | .se (se), |
---|
2967 | .si (), |
---|
2968 | .so () |
---|
2969 | ); |
---|
2970 | |
---|
2971 | dffre_s dffre_trap_cwp1_enb ( |
---|
2972 | .din (spill_thrd1), |
---|
2973 | .q (trap_cwp_enb[1]), |
---|
2974 | .rst (cwp_en_thrd_reset[1]), |
---|
2975 | .en (exu_tlu_spill & spill_thrd1), |
---|
2976 | .clk (clk), |
---|
2977 | .se (se), |
---|
2978 | .si (), |
---|
2979 | .so () |
---|
2980 | ); |
---|
2981 | |
---|
2982 | dffre_s dffre_trap_cwp2_enb ( |
---|
2983 | .din (spill_thrd2), |
---|
2984 | .q (trap_cwp_enb[2]), |
---|
2985 | .rst (cwp_en_thrd_reset[2]), |
---|
2986 | .en (exu_tlu_spill & spill_thrd2), |
---|
2987 | .clk (clk), |
---|
2988 | .se (se), |
---|
2989 | .si (), |
---|
2990 | .so () |
---|
2991 | ); |
---|
2992 | |
---|
2993 | dffre_s dffre_trap_cwp3_enb ( |
---|
2994 | .din (spill_thrd3), |
---|
2995 | .q (trap_cwp_enb[3]), |
---|
2996 | .rst (cwp_en_thrd_reset[3]), |
---|
2997 | .en (exu_tlu_spill & spill_thrd3), |
---|
2998 | .clk (clk), |
---|
2999 | .se (se), |
---|
3000 | .si (), |
---|
3001 | .so () |
---|
3002 | ); |
---|
3003 | |
---|
3004 | assign tlu_trap_cwp_en[`TLU_THRD_NUM-1:0] = ~(trap_cwp_enb[`TLU_THRD_NUM-1:0]); |
---|
3005 | |
---|
3006 | // |
---|
3007 | // added for asynchronize dmmu traps (correctable parity error) |
---|
3008 | assign dmmu_async_thrd0 = ~lsu_tlu_async_tid_g[1] & ~lsu_tlu_async_tid_g[0]; |
---|
3009 | assign dmmu_async_thrd1 = ~lsu_tlu_async_tid_g[1] & lsu_tlu_async_tid_g[0]; |
---|
3010 | assign dmmu_async_thrd2 = lsu_tlu_async_tid_g[1] & ~lsu_tlu_async_tid_g[0]; |
---|
3011 | assign dmmu_async_thrd3 = lsu_tlu_async_tid_g[1] & lsu_tlu_async_tid_g[0]; |
---|
3012 | // |
---|
3013 | // modified for bug 4074 |
---|
3014 | assign lsu_async_vld_en_g[0] = |
---|
3015 | // local_lsu_async_ttype_vld_w & dmmu_async_thrd0 & ~lsu_tlu_defr_trp_taken_g; |
---|
3016 | local_lsu_async_ttype_vld_w & dmmu_async_thrd0 & ~lsu_defr_trp_taken_w2[0]; |
---|
3017 | assign lsu_async_vld_en_g[1] = |
---|
3018 | // local_lsu_async_ttype_vld_w & dmmu_async_thrd1 & ~lsu_tlu_defr_trp_taken_g; |
---|
3019 | local_lsu_async_ttype_vld_w & dmmu_async_thrd1 & ~lsu_defr_trp_taken_w2[1]; |
---|
3020 | assign lsu_async_vld_en_g[2] = |
---|
3021 | // local_lsu_async_ttype_vld_w & dmmu_async_thrd2 & ~lsu_tlu_defr_trp_taken_g; |
---|
3022 | local_lsu_async_ttype_vld_w & dmmu_async_thrd2 & ~lsu_defr_trp_taken_w2[2]; |
---|
3023 | assign lsu_async_vld_en_g[3] = |
---|
3024 | // local_lsu_async_ttype_vld_w & dmmu_async_thrd3 & ~lsu_tlu_defr_trp_taken_g; |
---|
3025 | local_lsu_async_ttype_vld_w & dmmu_async_thrd3 & ~lsu_defr_trp_taken_w2[3]; |
---|
3026 | // |
---|
3027 | dffre_s dffre_lsu_async_vld_en_w2_0 ( |
---|
3028 | .din (lsu_async_vld_en_g[0]), |
---|
3029 | .q (lsu_async_vld_en_w2[0]), |
---|
3030 | .rst (pend_to_thrd0_reset), |
---|
3031 | .en (lsu_async_vld_en_g[0]), |
---|
3032 | .clk (clk), |
---|
3033 | .se (se), |
---|
3034 | .si (), |
---|
3035 | .so () |
---|
3036 | ); |
---|
3037 | dffre_s dffre_lsu_async_vld_en_w2_1 ( |
---|
3038 | .din (lsu_async_vld_en_g[1]), |
---|
3039 | .q (lsu_async_vld_en_w2[1]), |
---|
3040 | .rst (pend_to_thrd1_reset), |
---|
3041 | .en (lsu_async_vld_en_g[1]), |
---|
3042 | .clk (clk), |
---|
3043 | .se (se), |
---|
3044 | .si (), |
---|
3045 | .so () |
---|
3046 | ); |
---|
3047 | dffre_s dffre_lsu_async_vld_en_w2_2 ( |
---|
3048 | .din (lsu_async_vld_en_g[2]), |
---|
3049 | .q (lsu_async_vld_en_w2[2]), |
---|
3050 | .rst (pend_to_thrd2_reset), |
---|
3051 | .en (lsu_async_vld_en_g[2]), |
---|
3052 | .clk (clk), |
---|
3053 | .se (se), |
---|
3054 | .si (), |
---|
3055 | .so () |
---|
3056 | ); |
---|
3057 | dffre_s dffre_lsu_async_vld_en_w2_3 ( |
---|
3058 | .din (lsu_async_vld_en_g[3]), |
---|
3059 | .q (lsu_async_vld_en_w2[3]), |
---|
3060 | .rst (pend_to_thrd3_reset), |
---|
3061 | .en (lsu_async_vld_en_g[3]), |
---|
3062 | .clk (clk), |
---|
3063 | .se (se), |
---|
3064 | .si (), |
---|
3065 | .so () |
---|
3066 | ); |
---|
3067 | // |
---|
3068 | // assign trap type base on information send |
---|
3069 | assign dmmu_async_ttype[`TSA_TTYPE_WIDTH-1:0] = |
---|
3070 | {2'b0, lsu_tlu_async_ttype_g[6:0]}; |
---|
3071 | // |
---|
3072 | // derived the spill ttype |
---|
3073 | assign exu_spill_ttype[`TSA_TTYPE_WIDTH-1:0] = |
---|
3074 | {3'b010,exu_tlu_spill_other,exu_tlu_spill_wtype[2:0], 2'b00}; |
---|
3075 | // |
---|
3076 | // derived ffu_asynchronous ttype |
---|
3077 | // modified for bug 4084 - new ffu asynchronous trap type: 0x29 |
---|
3078 | assign ffu_async_ttype[`TSA_TTYPE_WIDTH-1:0] = |
---|
3079 | (ffu_tlu_trap_ue) ? 9'h029: |
---|
3080 | ({7'b0001000, ffu_tlu_trap_other, ffu_tlu_trap_ieee754}); |
---|
3081 | // |
---|
3082 | // |
---|
3083 | // modified for bug 4084 - new ffu_tlu_trap_ue |
---|
3084 | assign pend_ttype0[`TSA_TTYPE_WIDTH-1:0] = |
---|
3085 | (exu_tlu_spill & spill_thrd0) ? |
---|
3086 | exu_spill_ttype[`TSA_TTYPE_WIDTH-1:0] : |
---|
3087 | (((ffu_tlu_trap_other | ffu_tlu_trap_ieee754 | ffu_tlu_trap_ue) & fp_trap_thrd0) ? |
---|
3088 | ffu_async_ttype[`TSA_TTYPE_WIDTH-1:0] : |
---|
3089 | dmmu_async_ttype[`TSA_TTYPE_WIDTH-1:0]); |
---|
3090 | |
---|
3091 | // always flop if selected for thread. |
---|
3092 | // THREAD0 |
---|
3093 | // added support for dmmu_async_traps |
---|
3094 | // modified for bug 4084 - new ffu_tlu_trap_ue |
---|
3095 | assign pend_to_thrd0_en = |
---|
3096 | (exu_tlu_spill & spill_thrd0) | |
---|
3097 | ((ffu_tlu_trap_ieee754 | ffu_tlu_trap_other | ffu_tlu_trap_ue) & fp_trap_thrd0) | |
---|
3098 | (lsu_async_vld_en_g[0] & ~lsu_async_vld_en_w2[0]) | |
---|
3099 | cwp_cmplt0; // cwp completion always pended. |
---|
3100 | // |
---|
3101 | // added for bug 5436 - Niagara 2.0 |
---|
3102 | assign pend_pich_cnt_adj[0] = |
---|
3103 | ((exu_tlu_spill & spill_thrd0) | |
---|
3104 | ((ffu_tlu_trap_ieee754 | ffu_tlu_trap_other | ffu_tlu_trap_ue) & fp_trap_thrd0) | |
---|
3105 | (lsu_async_vld_en_g[0] & ~lsu_async_vld_en_w2[0])) & pic_cnt_en[0]; |
---|
3106 | |
---|
3107 | // If there is no sync trap in a cycle, then the pending trap is taken. |
---|
3108 | assign pend_to_thrd0_reset = |
---|
3109 | local_rst | pending_thrd0_event_taken; |
---|
3110 | |
---|
3111 | // Choose pending traps in round-robin order. |
---|
3112 | tlu_rrobin_picker ptrap_rrobin ( |
---|
3113 | .events ({pending_trap3,pending_trap2,pending_trap1,pending_trap0}), |
---|
3114 | .pick_one_hot (pending_trap_sel[3:0]), |
---|
3115 | // |
---|
3116 | // this siganl was modified to abide to the Niagara reset methodology |
---|
3117 | .tlu_rst_l (tlu_rst_l), |
---|
3118 | .clk (clk) |
---|
3119 | ); |
---|
3120 | |
---|
3121 | // modified to arbitrate between wsr instruction and asynchronous events |
---|
3122 | // due to there is only one write port to tsa |
---|
3123 | // also modified for bug 1672 |
---|
3124 | // modified for bug 3827 |
---|
3125 | assign pending_thrd0_event_taken = |
---|
3126 | pending_trap_sel[0] & ~(sync_trap_taken_g | dnrtry_inst_g | |
---|
3127 | tsa_wr_tid_sel_g | ifu_thrd_flush_w[0] | (tlu_gl_rw_g & wsr_inst_g)); |
---|
3128 | |
---|
3129 | dffre_s #(12) dffre_pendthrd0 ( |
---|
3130 | .din ({pend_to_thrd0_en,pend_ttype0[8:0],cwp_cmplt0,exu_tlu_cwp_retry}), |
---|
3131 | .q ({pending_trap0,pending_ttype0[8:0],cwp_cmplt0_pending,cwp_retry0}), |
---|
3132 | .rst (pend_to_thrd0_reset), |
---|
3133 | .en (pend_to_thrd0_en), |
---|
3134 | .clk (clk), |
---|
3135 | .se (se), |
---|
3136 | .si (), |
---|
3137 | .so () |
---|
3138 | ); |
---|
3139 | // THREAD1 |
---|
3140 | // added support for dmmu_async_traps |
---|
3141 | // modified for bug 4084 - new ffu_tlu_trap_ue |
---|
3142 | assign pend_to_thrd1_en = |
---|
3143 | (exu_tlu_spill & spill_thrd1) | |
---|
3144 | ((ffu_tlu_trap_ieee754 | ffu_tlu_trap_other | ffu_tlu_trap_ue) & fp_trap_thrd1) | |
---|
3145 | (lsu_async_vld_en_g[1] & ~lsu_async_vld_en_w2[1]) | |
---|
3146 | cwp_cmplt1; // cwp completion always pended. |
---|
3147 | // |
---|
3148 | // added for bug 5436 - Niagara 2.0 |
---|
3149 | assign pend_pich_cnt_adj[1] = |
---|
3150 | ((exu_tlu_spill & spill_thrd1) | |
---|
3151 | ((ffu_tlu_trap_ieee754 | ffu_tlu_trap_other | ffu_tlu_trap_ue) & fp_trap_thrd1) | |
---|
3152 | (lsu_async_vld_en_g[1] & ~lsu_async_vld_en_w2[1])) & pic_cnt_en[1]; |
---|
3153 | |
---|
3154 | assign pend_to_thrd1_reset = |
---|
3155 | local_rst | pending_thrd1_event_taken; |
---|
3156 | |
---|
3157 | // modified to arbitrate between wsr instruction and asynchronous events |
---|
3158 | // due to there is only one write port to tsa |
---|
3159 | // |
---|
3160 | // modified for bug 3827 |
---|
3161 | assign pending_thrd1_event_taken = |
---|
3162 | pending_trap_sel[1] & ~(sync_trap_taken_g | dnrtry_inst_g | |
---|
3163 | tsa_wr_tid_sel_g | ifu_thrd_flush_w[1] | (tlu_gl_rw_g & wsr_inst_g)); |
---|
3164 | |
---|
3165 | // |
---|
3166 | // modified for bug 4084 - new ffu_tlu_trap_ue |
---|
3167 | assign pend_ttype1[`TSA_TTYPE_WIDTH-1:0] = |
---|
3168 | (exu_tlu_spill & spill_thrd1) ? |
---|
3169 | exu_spill_ttype[`TSA_TTYPE_WIDTH-1:0] : |
---|
3170 | (((ffu_tlu_trap_other | ffu_tlu_trap_ieee754 | ffu_tlu_trap_ue) & fp_trap_thrd1) ? |
---|
3171 | ffu_async_ttype[`TSA_TTYPE_WIDTH-1:0] : |
---|
3172 | dmmu_async_ttype[`TSA_TTYPE_WIDTH-1:0]); |
---|
3173 | |
---|
3174 | dffre_s #(12) dffre_pendthrd1 ( |
---|
3175 | .din ({pend_to_thrd1_en,pend_ttype1[8:0],cwp_cmplt1,exu_tlu_cwp_retry}), |
---|
3176 | .q ({pending_trap1,pending_ttype1[8:0],cwp_cmplt1_pending,cwp_retry1}), |
---|
3177 | .rst (pend_to_thrd1_reset), |
---|
3178 | .en (pend_to_thrd1_en), |
---|
3179 | .clk (clk), |
---|
3180 | .se (se), |
---|
3181 | .si (), |
---|
3182 | .so () |
---|
3183 | ); |
---|
3184 | |
---|
3185 | // THREAD2 |
---|
3186 | // added support for dmmu_async_traps |
---|
3187 | // modified for bug 4084 - new ffu_tlu_trap_ue |
---|
3188 | assign pend_to_thrd2_en = |
---|
3189 | (exu_tlu_spill & spill_thrd2) | |
---|
3190 | ((ffu_tlu_trap_ieee754 | ffu_tlu_trap_other | ffu_tlu_trap_ue) & fp_trap_thrd2) | |
---|
3191 | (lsu_async_vld_en_g[2] & ~lsu_async_vld_en_w2[2]) | |
---|
3192 | cwp_cmplt2; // cwp completion always pended. |
---|
3193 | // |
---|
3194 | // added for bug 5436 - Niagara 2.0 |
---|
3195 | assign pend_pich_cnt_adj[2] = |
---|
3196 | ((exu_tlu_spill & spill_thrd2) | |
---|
3197 | ((ffu_tlu_trap_ieee754 | ffu_tlu_trap_other | ffu_tlu_trap_ue) & fp_trap_thrd2) | |
---|
3198 | (lsu_async_vld_en_g[2] & ~lsu_async_vld_en_w2[2])) & pic_cnt_en[2]; |
---|
3199 | |
---|
3200 | assign pend_to_thrd2_reset = |
---|
3201 | local_rst | pending_thrd2_event_taken; |
---|
3202 | |
---|
3203 | // modified to arbitrate between wsr instruction and asynchronous events |
---|
3204 | // due to there is only one write port to tsa |
---|
3205 | // |
---|
3206 | // modified for bug 3827 |
---|
3207 | assign pending_thrd2_event_taken = |
---|
3208 | pending_trap_sel[2] & ~(sync_trap_taken_g | dnrtry_inst_g | |
---|
3209 | tsa_wr_tid_sel_g | ifu_thrd_flush_w[2] | (tlu_gl_rw_g & wsr_inst_g)); |
---|
3210 | |
---|
3211 | // |
---|
3212 | // modified for bug 4084 - new ffu_tlu_trap_ue |
---|
3213 | assign pend_ttype2[`TSA_TTYPE_WIDTH-1:0] = |
---|
3214 | (exu_tlu_spill & spill_thrd2) ? |
---|
3215 | exu_spill_ttype[`TSA_TTYPE_WIDTH-1:0] : |
---|
3216 | (((ffu_tlu_trap_other | ffu_tlu_trap_ieee754 | ffu_tlu_trap_ue) & fp_trap_thrd2) ? |
---|
3217 | ffu_async_ttype[`TSA_TTYPE_WIDTH-1:0] : |
---|
3218 | dmmu_async_ttype[`TSA_TTYPE_WIDTH-1:0]); |
---|
3219 | |
---|
3220 | dffre_s #(12) dffre_pendthrd2 ( |
---|
3221 | .din ({pend_to_thrd2_en,pend_ttype2[8:0],cwp_cmplt2,exu_tlu_cwp_retry}), |
---|
3222 | .q ({pending_trap2,pending_ttype2[8:0],cwp_cmplt2_pending,cwp_retry2}), |
---|
3223 | .rst (pend_to_thrd2_reset), |
---|
3224 | .en (pend_to_thrd2_en), |
---|
3225 | .clk (clk), |
---|
3226 | .se (se), |
---|
3227 | .si (), |
---|
3228 | .so () |
---|
3229 | ); |
---|
3230 | |
---|
3231 | // THREAD3 |
---|
3232 | // added support for dmmu_async_traps |
---|
3233 | // modified for bug 4084 - new ffu_tlu_trap_ue |
---|
3234 | assign pend_to_thrd3_en = |
---|
3235 | (exu_tlu_spill & spill_thrd3) | |
---|
3236 | ((ffu_tlu_trap_ieee754 | ffu_tlu_trap_other | ffu_tlu_trap_ue) & fp_trap_thrd3) | |
---|
3237 | (lsu_async_vld_en_g[3] & ~lsu_async_vld_en_w2[3]) | |
---|
3238 | cwp_cmplt3; // cwp completion always pended. |
---|
3239 | // |
---|
3240 | // added for bug 5436 - Niagara 2.0 |
---|
3241 | assign pend_pich_cnt_adj[3] = |
---|
3242 | ((exu_tlu_spill & spill_thrd3) | |
---|
3243 | ((ffu_tlu_trap_ieee754 | ffu_tlu_trap_other | ffu_tlu_trap_ue) & fp_trap_thrd3) | |
---|
3244 | (lsu_async_vld_en_g[3] & ~lsu_async_vld_en_w2[3])) & pic_cnt_en[3]; |
---|
3245 | |
---|
3246 | assign pend_to_thrd3_reset = |
---|
3247 | local_rst | pending_thrd3_event_taken; |
---|
3248 | |
---|
3249 | // modified to arbitrate between wsr instruction and asynchronous events |
---|
3250 | // due to there is only one write port to tsa |
---|
3251 | // modified for bug 3827 |
---|
3252 | assign pending_thrd3_event_taken = |
---|
3253 | pending_trap_sel[3] & ~(sync_trap_taken_g | dnrtry_inst_g | |
---|
3254 | tsa_wr_tid_sel_g | ifu_thrd_flush_w[3] | (tlu_gl_rw_g & wsr_inst_g)); |
---|
3255 | |
---|
3256 | // |
---|
3257 | assign pend_ttype3[`TSA_TTYPE_WIDTH-1:0] = |
---|
3258 | (exu_tlu_spill & spill_thrd3) ? |
---|
3259 | exu_spill_ttype[`TSA_TTYPE_WIDTH-1:0] : |
---|
3260 | (((ffu_tlu_trap_other | ffu_tlu_trap_ieee754 | ffu_tlu_trap_ue) & fp_trap_thrd3) ? |
---|
3261 | ffu_async_ttype[`TSA_TTYPE_WIDTH-1:0] : |
---|
3262 | dmmu_async_ttype[`TSA_TTYPE_WIDTH-1:0]); |
---|
3263 | // |
---|
3264 | dffre_s #(12) dffre_pendthrd3 ( |
---|
3265 | .din ({pend_to_thrd3_en,pend_ttype3[8:0],cwp_cmplt3,exu_tlu_cwp_retry}), |
---|
3266 | .q ({pending_trap3,pending_ttype3[8:0],cwp_cmplt3_pending,cwp_retry3}), |
---|
3267 | .rst (pend_to_thrd3_reset), |
---|
3268 | .en (pend_to_thrd3_en), |
---|
3269 | .clk (clk), |
---|
3270 | .se (se), |
---|
3271 | .si (), |
---|
3272 | .so () |
---|
3273 | ); |
---|
3274 | // |
---|
3275 | // added for bug 5436 - Niagara 2.0 |
---|
3276 | //assign pich_cnt_hld_rst[`TLU_THRD_NUM-1:0] = |
---|
3277 | // (thread_inst_vld_w2[`TLU_THRD_NUM-1:0] & {4{pic_cnt_en_w2}} | |
---|
3278 | // {4{local_rst}}); |
---|
3279 | |
---|
3280 | // fix for 5436 for reopend bugs(9/8/2004) related to flushed inst reseting the hold |
---|
3281 | // and b2b valid instruction; the 1st one reseting the hold, but the 2nd not incrementing |
---|
3282 | // since the hold was not reset early to allow the 2nd inst to incr_pich. |
---|
3283 | |
---|
3284 | assign pich_cnt_hld_rst_g[3:0] = |
---|
3285 | (thread_inst_vld_g[3:0] & {4{pic_cnt_en_w}}) & |
---|
3286 | {4{~(lsu_ttype_vld_w | tlu_flush_all_w)}}; |
---|
3287 | |
---|
3288 | |
---|
3289 | dff_s #(4) dff_pich_cnt_hld_rst_g ( |
---|
3290 | .din (pich_cnt_hld_rst_g[3:0]), |
---|
3291 | .q (pich_cnt_hld_rst_w2[3:0]), |
---|
3292 | .clk (clk), |
---|
3293 | .se (se), |
---|
3294 | .si (), |
---|
3295 | .so () |
---|
3296 | ); |
---|
3297 | |
---|
3298 | |
---|
3299 | assign pend_pich_cnt_hld_early[3:0] = pend_pich_cnt_hld_q[3:0] & ~pich_cnt_hld_rst_w2[3:0]; |
---|
3300 | |
---|
3301 | assign pend_pich_cnt_hld[3:0] = pend_pich_cnt_hld_early[3:0]; |
---|
3302 | |
---|
3303 | // following is used in pib_wrap_m logic as per bug5436(reopened 9/17/04). |
---|
3304 | assign pend_pich_cnt_hld_noqual[3:0] = pend_pich_cnt_hld_q[3:0]; |
---|
3305 | |
---|
3306 | dffre_s dffre_pend_pich_cnt_adj_0 ( |
---|
3307 | .din (pend_pich_cnt_adj[0]), |
---|
3308 | .q (pend_pich_cnt_hld_q[0]), |
---|
3309 | .rst (local_rst | pich_cnt_hld_rst_w2[0]), |
---|
3310 | .en (pend_pich_cnt_adj[0]), |
---|
3311 | .clk (clk), |
---|
3312 | .se (se), |
---|
3313 | .si (), |
---|
3314 | .so () |
---|
3315 | ); |
---|
3316 | |
---|
3317 | dffre_s dffre_pend_pich_cnt_adj_1 ( |
---|
3318 | .din (pend_pich_cnt_adj[1]), |
---|
3319 | .q (pend_pich_cnt_hld_q[1]), |
---|
3320 | .rst (local_rst | pich_cnt_hld_rst_w2[1]), |
---|
3321 | .en (pend_pich_cnt_adj[1]), |
---|
3322 | .clk (clk), |
---|
3323 | .se (se), |
---|
3324 | .si (), |
---|
3325 | .so () |
---|
3326 | ); |
---|
3327 | |
---|
3328 | dffre_s dffre_pend_pich_cnt_adj_2 ( |
---|
3329 | .din (pend_pich_cnt_adj[2]), |
---|
3330 | .q (pend_pich_cnt_hld_q[2]), |
---|
3331 | .rst (local_rst | pich_cnt_hld_rst_w2[2]), |
---|
3332 | .en (pend_pich_cnt_adj[2]), |
---|
3333 | .clk (clk), |
---|
3334 | .se (se), |
---|
3335 | .si (), |
---|
3336 | .so () |
---|
3337 | ); |
---|
3338 | |
---|
3339 | dffre_s dffre_pend_pich_cnt_adj_3 ( |
---|
3340 | .din (pend_pich_cnt_adj[3]), |
---|
3341 | .q (pend_pich_cnt_hld_q[3]), |
---|
3342 | .rst (local_rst | pich_cnt_hld_rst_w2[3]), |
---|
3343 | .en (pend_pich_cnt_adj[3]), |
---|
3344 | .clk (clk), |
---|
3345 | .se (se), |
---|
3346 | .si (), |
---|
3347 | .so () |
---|
3348 | ); |
---|
3349 | |
---|
3350 | |
---|
3351 | assign trap_taken_g = thrd0_traps | thrd1_traps | thrd2_traps | thrd3_traps; |
---|
3352 | // |
---|
3353 | // added for timing |
---|
3354 | dff_s dff_trap_taken_w2 ( |
---|
3355 | .din (trap_taken_g), |
---|
3356 | .q (trap_taken_w2), |
---|
3357 | .clk (clk), |
---|
3358 | .se (se), |
---|
3359 | .si (), |
---|
3360 | .so () |
---|
3361 | ); |
---|
3362 | // Selection of traps should be round-robin. |
---|
3363 | assign trap_tid_g[1:0] = |
---|
3364 | // lsu_defr_trap_g ? thrid_w2[1:0] : |
---|
3365 | ((sync_trap_taken_g) | (dnrtry_inst_g & cwp_fastcmplt_g)) ? thrid_g[1:0] : |
---|
3366 | (pending_trap_sel[0] ? 2'b00 : |
---|
3367 | (pending_trap_sel[1] ? 2'b01 : |
---|
3368 | (pending_trap_sel[2] ? 2'b10 : 2'b11))); |
---|
3369 | |
---|
3370 | assign pend_trap_tid_g[1:0] = |
---|
3371 | pending_trap_sel[0] ? 2'b00 : |
---|
3372 | (pending_trap_sel[1] ? 2'b01 : |
---|
3373 | (pending_trap_sel[2] ? 2'b10 : |
---|
3374 | 2'b11)); |
---|
3375 | |
---|
3376 | dff_s #(2) dff_pend_trap_tid_w2 ( |
---|
3377 | .din (pend_trap_tid_g[1:0]), |
---|
3378 | .q (pend_trap_tid_w2[1:0]), |
---|
3379 | .clk (clk), |
---|
3380 | .se (se), |
---|
3381 | .si (), |
---|
3382 | .so () |
---|
3383 | ); |
---|
3384 | |
---|
3385 | |
---|
3386 | // Assume fixed priority for now. Should change to round-robin selection !!! |
---|
3387 | |
---|
3388 | // modified for bug 1806 |
---|
3389 | // modified to support lsu deferred traps - modified for timing |
---|
3390 | // modified for bug 4640 and 5127 |
---|
3391 | // |
---|
3392 | assign reset_sel_g = |
---|
3393 | rstint_g | (sir_inst_g & ~(lsu_defr_trap_g | pib_wrap_trap_g | |
---|
3394 | (|tlz_trap_g[`TLU_THRD_NUM-1:0]))) | rst_tri_en; |
---|
3395 | // rstint_g | (sir_inst_g & ~lsu_defr_trap_g) | rst_tri_en; |
---|
3396 | // |
---|
3397 | // added for timing |
---|
3398 | dffr_s dffr_reset_sel_w2 ( |
---|
3399 | .din (reset_sel_g), |
---|
3400 | .q (reset_sel_w2), |
---|
3401 | .rst (local_rst), |
---|
3402 | .clk (clk), |
---|
3403 | .se (se), |
---|
3404 | .si (), |
---|
3405 | .so () |
---|
3406 | ); |
---|
3407 | // |
---|
3408 | // modified for timing |
---|
3409 | // assign reset_defr_id_g[6:0] = |
---|
3410 | assign reset_id_g[2:0] = |
---|
3411 | local_rst ? 3'b001 : |
---|
3412 | rstint_g ? rstid_g[2:0] : |
---|
3413 | sir_inst_g ? 3'b100 : |
---|
3414 | 3'bxxx; |
---|
3415 | |
---|
3416 | // recoded for timing |
---|
3417 | // |
---|
3418 | // construct the tba_ttype to determine the tba |
---|
3419 | // the trap is hypervisor or supervisor traps |
---|
3420 | // modified for bug 3634 and timing |
---|
3421 | |
---|
3422 | assign tba_ttype_sel_w2 = |
---|
3423 | final_ttype_sel_w2[0] | (hyper_wdr_trap_w2 & ~lsu_defr_trap_w2); |
---|
3424 | |
---|
3425 | mux2ds #(`TSA_TTYPE_WIDTH) mx_tba_ttype_w2 ( |
---|
3426 | .sel0 (tba_ttype_sel_w2), |
---|
3427 | .sel1 (~tba_ttype_sel_w2), |
---|
3428 | .in0 ({2'b0,rst_hwdr_ttype_w2[`TSA_TTYPE_WIDTH-3:0]}), |
---|
3429 | .in1 (final_ttype_w2[`TSA_TTYPE_WIDTH-1:0]), |
---|
3430 | .dout (tba_ttype_w1[`TSA_TTYPE_WIDTH-1:0]) |
---|
3431 | ); |
---|
3432 | /* |
---|
3433 | assign tba_ttype_sel_g[0] = |
---|
3434 | (rstint_g | rst_tri_en | ((hwint_g | swint_g | hyper_wdr_trap | |
---|
3435 | (|tlz_trap_g[`TLU_THRD_NUM-1:0] | sir_inst_g) | pib_wrap_trap_g) & |
---|
3436 | inst_vld_g & ~lsu_defr_trap_g); |
---|
3437 | assign tba_ttype_sel_g[1] = |
---|
3438 | (((ifu_ttype_vld_g | exu_ttype_vld_g | va_oor_inst_acc_excp_g) | |
---|
3439 | (local_sync_trap_g & ~(lsu_tlu_priv_action_g | misalign_addr_ldst_atm_g))) & |
---|
3440 | ~(reset_sel_g | hwint_g | swint_g | hyper_wdr_trap | (|tlz_trap_g[`TLU_THRD_NUM-1:0])) & |
---|
3441 | inst_vld_g) & ~lsu_defr_trap_g & ~pib_wrap_trap_g; |
---|
3442 | assign tba_ttype_sel_g[2] = |
---|
3443 | (((lsu_tlu_ttype_vld_m2 & inst_vld_g) | va_oor_data_acc_excp_g) & |
---|
3444 | ~(|tba_ttype_sel_g[1:0])) | (lsu_defr_trap_g & ~(rstint_g | rst_tri_en)); |
---|
3445 | assign tba_ttype_sel_g[3] = |
---|
3446 | ~(|tba_ttype_sel_g[2:0]); |
---|
3447 | |
---|
3448 | // added for timing |
---|
3449 | dffr_s #(4) dffr_tba_ttype_sel_w2 ( |
---|
3450 | .din (tba_ttype_sel_g[3:0]), |
---|
3451 | .q (tba_ttype_sel_w2[3:0]), |
---|
3452 | .rst (local_rst), |
---|
3453 | .clk (clk), |
---|
3454 | .se (se), |
---|
3455 | .si (), |
---|
3456 | .so () |
---|
3457 | ); |
---|
3458 | // |
---|
3459 | mux4ds #(`TSA_TTYPE_WIDTH) mx_tba_ttype_w2 ( |
---|
3460 | .sel0 (tba_ttype_sel_w2[0]), |
---|
3461 | .sel1 (tba_ttype_sel_w2[1]), |
---|
3462 | .sel2 (tba_ttype_sel_w2[2]), |
---|
3463 | .sel3 (tba_ttype_sel_w2[3]), |
---|
3464 | .in0 ({2'b0,rst_hwdr_ttype_w2[`TSA_TTYPE_WIDTH-3:0]}), |
---|
3465 | .in1 (early_sync_ttype_w2[`TSA_TTYPE_WIDTH-1:0]), |
---|
3466 | .in2 (adj_lsu_ttype_w2[`TSA_TTYPE_WIDTH-1:0]), |
---|
3467 | .in3 (pending_ttype_w2[`TSA_TTYPE_WIDTH-1:0]), |
---|
3468 | .dout (tba_ttype_w1[`TSA_TTYPE_WIDTH-1:0]) |
---|
3469 | ); |
---|
3470 | |
---|
3471 | dff_s #(`TSA_TTYPE_WIDTH) dff_tba_ttype_w1 ( |
---|
3472 | .din (tba_ttype_g[`TSA_TTYPE_WIDTH-1:0]), |
---|
3473 | .q (tba_ttype_w1[`TSA_TTYPE_WIDTH-1:0]), |
---|
3474 | .clk (clk), |
---|
3475 | .se (se), |
---|
3476 | .si (), |
---|
3477 | .so () |
---|
3478 | ); |
---|
3479 | */ |
---|
3480 | // |
---|
3481 | // construct the final_ttype to be written into the trap stack |
---|
3482 | // modified for bug 3634, 4640 and timing |
---|
3483 | assign final_ttype_sel_g[0] = |
---|
3484 | (rstint_g | rst_tri_en) | ((hwint_g | swint_g | sir_inst_g | |
---|
3485 | (|tlz_trap_g[`TLU_THRD_NUM-1:0]) | pib_wrap_trap_g) & inst_vld_g & |
---|
3486 | ~lsu_defr_trap_g); |
---|
3487 | // reset_sel_g | ((hwint_g | swint_g | |
---|
3488 | // (|tlz_trap_g[`TLU_THRD_NUM-1:0]) | pib_wrap_trap_g) & inst_vld_g & |
---|
3489 | // ~lsu_defr_trap_g); |
---|
3490 | |
---|
3491 | assign final_ttype_sel_g[1] = |
---|
3492 | (((ifu_ttype_vld_g | exu_ttype_vld_g | va_oor_inst_acc_excp_g) | |
---|
3493 | (local_sync_trap_g & ~(lsu_tlu_priv_action_g | misalign_addr_ldst_atm_g))) & |
---|
3494 | ~(rstint_g | sir_inst_g | hwint_g | swint_g | rst_tri_en | (|tlz_trap_g[`TLU_THRD_NUM-1:0])) & |
---|
3495 | inst_vld_g) & ~lsu_defr_trap_g & ~pib_wrap_trap_g; |
---|
3496 | assign final_ttype_sel_g[2] = |
---|
3497 | ((lsu_tlu_ttype_vld_m2 & inst_vld_g) | va_oor_data_acc_excp_g) & |
---|
3498 | ~(|final_ttype_sel_g[1:0]) | (lsu_defr_trap_g & ~(rst_tri_en | rstint_g)); |
---|
3499 | assign final_ttype_sel_g[3] = |
---|
3500 | ~(|final_ttype_sel_g[2:0]); |
---|
3501 | // |
---|
3502 | // added for timing |
---|
3503 | dffr_s #(4) dffr_final_ttype_sel_w2 ( |
---|
3504 | .din (final_ttype_sel_g[3:0]), |
---|
3505 | .q (final_ttype_sel_w2[3:0]), |
---|
3506 | .rst (local_rst), |
---|
3507 | .clk (clk), |
---|
3508 | .se (se), |
---|
3509 | .si (), |
---|
3510 | .so () |
---|
3511 | ); |
---|
3512 | // |
---|
3513 | // modified for timing |
---|
3514 | /* |
---|
3515 | mux3ds #(`TSA_TTYPE_WIDTH) mx_adj_lsu_ttype_m2 ( |
---|
3516 | .sel0 (lsu_defr_trap_g), |
---|
3517 | .sel1 (va_oor_data_acc_excp_g & ~lsu_defr_trap_g), |
---|
3518 | .sel2 (~(va_oor_data_acc_excp_g | lsu_defr_trap_g)), |
---|
3519 | .in0 ({2'b0, lsu_tlu_async_ttype_g[6:0]}), |
---|
3520 | .in1 (9'h030), |
---|
3521 | .in2 (lsu_tlu_ttype_m2), |
---|
3522 | .dout (adj_lsu_ttype_m2[`TSA_TTYPE_WIDTH-1:0]) |
---|
3523 | ); |
---|
3524 | */ |
---|
3525 | // added for timing |
---|
3526 | dff_s #(`TSA_TTYPE_WIDTH) dff_lsu_tlu_ttype_w2 ( |
---|
3527 | .din (lsu_tlu_ttype_m2[`TSA_TTYPE_WIDTH-1:0]), |
---|
3528 | .q (lsu_tlu_ttype_w2[`TSA_TTYPE_WIDTH-1:0]), |
---|
3529 | .clk (clk), |
---|
3530 | .se (se), |
---|
3531 | .si (), |
---|
3532 | .so () |
---|
3533 | ); |
---|
3534 | // |
---|
3535 | /* |
---|
3536 | dff_s #(`TSA_TTYPE_WIDTH-2) dff_lsu_tlu_async_ttype_w2 ( |
---|
3537 | .din (lsu_tlu_async_ttype_g[`TSA_TTYPE_WIDTH-3:0]), |
---|
3538 | .q (lsu_tlu_async_ttype_w2[`TSA_TTYPE_WIDTH-3:0]), |
---|
3539 | .clk (clk), |
---|
3540 | .se (se), |
---|
3541 | .si (), |
---|
3542 | .so () |
---|
3543 | ); |
---|
3544 | */ |
---|
3545 | mux3ds #(`TSA_TTYPE_WIDTH) mx_adj_lsu_ttype_w2 ( |
---|
3546 | .sel0 (lsu_defr_trap_w2), |
---|
3547 | .sel1 (va_oor_data_acc_excp_w2 & ~lsu_defr_trap_w2), |
---|
3548 | .sel2 (~(va_oor_data_acc_excp_w2 | lsu_defr_trap_w2)), |
---|
3549 | // modified for bug 4561 |
---|
3550 | // .in0 ({2'b0, lsu_tlu_async_ttype_w2[6:0]}), |
---|
3551 | .in0 (9'h032), |
---|
3552 | .in1 (9'h030), |
---|
3553 | .in2 (lsu_tlu_ttype_w2[`TSA_TTYPE_WIDTH-1:0]), |
---|
3554 | .dout (adj_lsu_ttype_w2[`TSA_TTYPE_WIDTH-1:0]) |
---|
3555 | ); |
---|
3556 | // |
---|
3557 | // modified for timing |
---|
3558 | mux4ds #(`TSA_TTYPE_WIDTH) mx_final_ttype_w2 ( |
---|
3559 | .sel0 (final_ttype_sel_w2[0]), |
---|
3560 | .sel1 (final_ttype_sel_w2[1]), |
---|
3561 | .sel2 (final_ttype_sel_w2[2]), |
---|
3562 | .sel3 (final_ttype_sel_w2[3]), |
---|
3563 | .in0 ({2'b0,rst_ttype_w2[`TSA_TTYPE_WIDTH-3:0]}), |
---|
3564 | .in1 (early_sync_ttype_w2[`TSA_TTYPE_WIDTH-1:0]), |
---|
3565 | .in2 (adj_lsu_ttype_w2[`TSA_TTYPE_WIDTH-1:0]), |
---|
3566 | .in3 (pending_ttype_w2[`TSA_TTYPE_WIDTH-1:0]), |
---|
3567 | .dout (final_ttype_w2[`TSA_TTYPE_WIDTH-1:0]) |
---|
3568 | ); |
---|
3569 | // |
---|
3570 | // modified for timing |
---|
3571 | /* |
---|
3572 | dff_s #(`TSA_TTYPE_WIDTH) dff_tlu_final_ttype_w2 ( |
---|
3573 | .din (final_ttype_g[`TSA_TTYPE_WIDTH-1:0]), |
---|
3574 | .q (final_ttype_w2[`TSA_TTYPE_WIDTH-1:0]), |
---|
3575 | .clk (clk), |
---|
3576 | .se (se), |
---|
3577 | .si (), |
---|
3578 | .so () |
---|
3579 | ); |
---|
3580 | */ |
---|
3581 | |
---|
3582 | assign tlu_final_ttype_w2[`TSA_TTYPE_WIDTH-1:0] = |
---|
3583 | final_ttype_w2[`TSA_TTYPE_WIDTH-1:0]; |
---|
3584 | // |
---|
3585 | // added for timing |
---|
3586 | // pending trap type |
---|
3587 | assign onehot_pending_ttype_sel = ~(|pending_trap_sel[2:0]); |
---|
3588 | // |
---|
3589 | mux4ds #(`TSA_TTYPE_WIDTH) mx_pending_ttype ( |
---|
3590 | .sel0 (pending_trap_sel[0]), |
---|
3591 | .sel1 (pending_trap_sel[1]), |
---|
3592 | .sel2 (pending_trap_sel[2]), |
---|
3593 | .sel3 (onehot_pending_ttype_sel), |
---|
3594 | .in0 (pending_ttype0[`TSA_TTYPE_WIDTH-1:0]), |
---|
3595 | .in1 (pending_ttype1[`TSA_TTYPE_WIDTH-1:0]), |
---|
3596 | .in2 (pending_ttype2[`TSA_TTYPE_WIDTH-1:0]), |
---|
3597 | .in3 (pending_ttype3[`TSA_TTYPE_WIDTH-1:0]), |
---|
3598 | .dout (pending_ttype[`TSA_TTYPE_WIDTH-1:0]) |
---|
3599 | ); |
---|
3600 | // |
---|
3601 | // added for timing |
---|
3602 | dff_s #(`TSA_TTYPE_WIDTH) dff_pending_ttype_w2 ( |
---|
3603 | .din (pending_ttype[`TSA_TTYPE_WIDTH-1:0]), |
---|
3604 | .q (pending_ttype_w2[`TSA_TTYPE_WIDTH-1:0]), |
---|
3605 | .clk (clk), |
---|
3606 | .se (se), |
---|
3607 | .si (), |
---|
3608 | .so () |
---|
3609 | ); |
---|
3610 | // |
---|
3611 | // modified for timing and bug 5117 |
---|
3612 | assign rst_ttype_sel[0] = reset_sel_g; |
---|
3613 | // modified for bug 5127 |
---|
3614 | assign rst_ttype_sel[1] = |
---|
3615 | ((|tlz_trap_g[`TLU_THRD_NUM-1:0]) | pib_wrap_trap_g); |
---|
3616 | // ~(rstint_g | rst_tri_en); |
---|
3617 | // ((|tlz_trap_g[`TLU_THRD_NUM-1:0]) | pib_wrap_trap_g) & ~reset_sel_g; |
---|
3618 | // assign rst_ttype_sel[2] = ~(|rst_ttype_sel[1:0]); |
---|
3619 | |
---|
3620 | // reset ttype |
---|
3621 | // modified for bug 3634 and bug 3705 |
---|
3622 | // modified for timing and bug 5117 |
---|
3623 | assign rst_hwint_ttype_g[`TSA_TTYPE_WIDTH-3:0] = |
---|
3624 | (rst_ttype_sel[0])? {4'b00,reset_id_g[2:0]}: |
---|
3625 | ((rst_ttype_sel[1])? wrap_tlz_ttype[6:0]: |
---|
3626 | `HWINT_INT); |
---|
3627 | |
---|
3628 | dff_s #(`TSA_TTYPE_WIDTH-2) dff_rst_hwint_ttype_w2 ( |
---|
3629 | .din (rst_hwint_ttype_g[`TSA_TTYPE_WIDTH-3:0]), |
---|
3630 | .q (rst_hwint_ttype_w2[`TSA_TTYPE_WIDTH-3:0]), |
---|
3631 | .clk (clk), |
---|
3632 | .se (se), |
---|
3633 | .si (), |
---|
3634 | .so () |
---|
3635 | ); |
---|
3636 | |
---|
3637 | dffr_s dffr_rst_hwint_sel_w2 ( |
---|
3638 | .din ((|rst_ttype_sel[1:0]) | hwint_g), |
---|
3639 | .q (rst_hwint_sel_w2), |
---|
3640 | .clk (clk), |
---|
3641 | .se (se), |
---|
3642 | .rst (local_rst), |
---|
3643 | .si (), |
---|
3644 | .so () |
---|
3645 | ); |
---|
3646 | |
---|
3647 | assign rst_ttype_w2[`TSA_TTYPE_WIDTH-3:0] = |
---|
3648 | (rst_hwint_sel_w2)? rst_hwint_ttype_w2[`TSA_TTYPE_WIDTH-3:0]: |
---|
3649 | final_swint_id_w2[`TSA_TTYPE_WIDTH-3:0]; |
---|
3650 | |
---|
3651 | /* |
---|
3652 | mux3ds #(`TSA_TTYPE_WIDTH-2) mx_rst_ttype_g ( |
---|
3653 | .sel0 (rst_ttype_sel[0]), |
---|
3654 | .sel1 (rst_ttype_sel[1]), |
---|
3655 | .sel2 (rst_ttype_sel[2]), |
---|
3656 | .in0 ({4'b00,reset_id_g[2:0]}), |
---|
3657 | .in1 (wrap_tlz_ttype[6:0]), |
---|
3658 | .in2 (hwint_swint_ttype[6:0]), |
---|
3659 | .dout (rst_ttype_g[`TSA_TTYPE_WIDTH-3:0]) |
---|
3660 | ); |
---|
3661 | // |
---|
3662 | // added for timing |
---|
3663 | dff_s #(`TSA_TTYPE_WIDTH-2) dff_rst_ttype_w2 ( |
---|
3664 | .din (rst_ttype_g[`TSA_TTYPE_WIDTH-3:0]), |
---|
3665 | .q (rst_ttype_w2[`TSA_TTYPE_WIDTH-3:0]), |
---|
3666 | .clk (clk), |
---|
3667 | .se (se), |
---|
3668 | .si (), |
---|
3669 | .so () |
---|
3670 | ); |
---|
3671 | // modified for timing |
---|
3672 | |
---|
3673 | assign rst_hwdr_ttype_sel[0] = reset_sel_g; |
---|
3674 | assign rst_hwdr_ttype_sel[1] = hyper_wdr_trap & ~reset_sel_g; |
---|
3675 | assign rst_hwdr_ttype_sel[2] = |
---|
3676 | ((|tlz_trap_g[`TLU_THRD_NUM-1:0]) | pib_wrap_trap_g) & |
---|
3677 | ~(|rst_hwdr_ttype_sel[1:0]); |
---|
3678 | assign rst_hwdr_ttype_sel[3] = ~(|rst_hwdr_ttype_sel[2:0]); |
---|
3679 | |
---|
3680 | mux2ds #(`TSA_TTYPE_WIDTH-2) mx_hwint_swint_ttype ( |
---|
3681 | .sel0 (hwint_g), |
---|
3682 | .sel1 (~hwint_g), |
---|
3683 | .in0 (`HWINT_INT), |
---|
3684 | .in1 (final_swint_id[6:0]), |
---|
3685 | .dout (hwint_swint_ttype[6:0]) |
---|
3686 | ); |
---|
3687 | */ |
---|
3688 | |
---|
3689 | mux2ds #(`TSA_TTYPE_WIDTH-2) mx_wrap_tlz_ttype ( |
---|
3690 | .sel0 (|tlz_trap_g[`TLU_THRD_NUM-1:0]), |
---|
3691 | .sel1 (~(|tlz_trap_g[`TLU_THRD_NUM-1:0])), |
---|
3692 | .in0 (`TLZ_TRAP), |
---|
3693 | .in1 (`PIB_OVERFLOW_TTYPE), |
---|
3694 | .dout (wrap_tlz_ttype[6:0]) |
---|
3695 | ); |
---|
3696 | // |
---|
3697 | // modified for timing |
---|
3698 | assign rst_hwdr_ttype_sel_w2 = hyper_wdr_trap_w2 & ~reset_sel_w2; |
---|
3699 | |
---|
3700 | mux2ds #(`TSA_TTYPE_WIDTH-2) mx_rst_hwdr_ttype_w2 ( |
---|
3701 | .sel0 (rst_hwdr_ttype_sel_w2), |
---|
3702 | .sel1 (~rst_hwdr_ttype_sel_w2), |
---|
3703 | .in0 ({7'b0000010}), |
---|
3704 | .in1 (rst_ttype_w2[`TSA_TTYPE_WIDTH-3:0]), |
---|
3705 | .dout (rst_hwdr_ttype_w2[`TSA_TTYPE_WIDTH-3:0]) |
---|
3706 | ); |
---|
3707 | // |
---|
3708 | /* |
---|
3709 | mux4ds #(`TSA_TTYPE_WIDTH-2) mx_rst_hwdr_ttype ( |
---|
3710 | .sel0 (rst_hwdr_ttype_sel[0]), |
---|
3711 | .sel1 (rst_hwdr_ttype_sel[1]), |
---|
3712 | .sel2 (rst_hwdr_ttype_sel[2]), |
---|
3713 | .sel3 (rst_hwdr_ttype_sel[3]), |
---|
3714 | .in0 ({4'b00,reset_id_g[2:0]}), |
---|
3715 | .in1 ({7'b0000010}), |
---|
3716 | .in2 (wrap_tlz_ttype[6:0]), |
---|
3717 | .in3 (hwint_swint_ttype[6:0]), |
---|
3718 | .dout (rst_hwdr_ttype_g[`TSA_TTYPE_WIDTH-3:0]) |
---|
3719 | ); |
---|
3720 | // |
---|
3721 | // added for timing |
---|
3722 | dff_s #(`TSA_TTYPE_WIDTH-2) dff_rst_hwdr_ttype_w2 ( |
---|
3723 | .din (rst_hwdr_ttype_g[`TSA_TTYPE_WIDTH-3:0]), |
---|
3724 | .q (rst_hwdr_ttype_w2[`TSA_TTYPE_WIDTH-3:0]), |
---|
3725 | .clk (clk), |
---|
3726 | .se (se), |
---|
3727 | .si (), |
---|
3728 | .so () |
---|
3729 | ); |
---|
3730 | */ |
---|
3731 | // |
---|
3732 | // construct the early_ttype_g for timing to determine whether |
---|
3733 | // the trap is hypervisor or supervisor traps |
---|
3734 | // modified for bug 3646, 5117 and timing |
---|
3735 | assign early_ttype_sel[0] = |
---|
3736 | reset_sel_g | hwint_g | (|tlz_trap_g[`TLU_THRD_NUM-1:0]); |
---|
3737 | // reset_sel_g | hwint_g | swint_g | (|tlz_trap_g[`TLU_THRD_NUM-1:0]); |
---|
3738 | assign early_ttype_sel[1] = |
---|
3739 | local_early_flush_pipe_w; |
---|
3740 | // local_early_flush_pipe_w & ~(reset_sel_g | hwint_g | swint_g | |
---|
3741 | // (|tlz_trap_g[`TLU_THRD_NUM-1:0])); |
---|
3742 | assign early_ttype_sel[2] = |
---|
3743 | ~inst_vld_nf_g | inst_ifu_flush_w | ~(|early_ttype_sel[1:0]); |
---|
3744 | |
---|
3745 | assign early_ttype_g[`TSA_TTYPE_WIDTH-1:0] = |
---|
3746 | (early_ttype_sel[2])? pending_ttype[`TSA_TTYPE_WIDTH-1:0]: |
---|
3747 | (early_ttype_sel[0])? {2'b0,rst_hwint_ttype_g[`TSA_TTYPE_WIDTH-3:0]}: |
---|
3748 | // (early_ttype_sel[0])? {2'b0,rst_ttype_g[`TSA_TTYPE_WIDTH-3:0]}: |
---|
3749 | early_sync_ttype_g[`TSA_TTYPE_WIDTH-1:0]; |
---|
3750 | /* |
---|
3751 | assign early_ttype_sel[0] = |
---|
3752 | reset_sel_g | ((hwint_g | swint_g | (|tlz_trap_g[`TLU_THRD_NUM-1:0])) & |
---|
3753 | inst_vld_g) ; |
---|
3754 | assign early_ttype_sel[1] = |
---|
3755 | (local_early_flush_pipe_w & ~ifu_tlu_flush_fd_w) & ~rst_tri_en & |
---|
3756 | ~((reset_sel_g | hwint_g | swint_g | (|tlz_trap_g[`TLU_THRD_NUM-1:0])) & inst_vld_g); |
---|
3757 | assign early_ttype_sel[2] = |
---|
3758 | ~(|early_ttype_sel[1:0]); |
---|
3759 | // |
---|
3760 | mux3ds #(`TSA_TTYPE_WIDTH) mx_early_ttype ( |
---|
3761 | .sel0 (early_ttype_sel[0]), |
---|
3762 | .sel1 (early_ttype_sel[1]), |
---|
3763 | .sel2 (early_ttype_sel[2]), |
---|
3764 | .in0 ({2'b0,rst_ttype_g[`TSA_TTYPE_WIDTH-3:0]}), |
---|
3765 | .in1 (early_sync_ttype_g[`TSA_TTYPE_WIDTH-1:0]), |
---|
3766 | .in2 (pending_ttype[`TSA_TTYPE_WIDTH-1:0]), |
---|
3767 | .dout (early_ttype_g[`TSA_TTYPE_WIDTH-1:0]) |
---|
3768 | ); |
---|
3769 | */ |
---|
3770 | // |
---|
3771 | // recoded for timing |
---|
3772 | assign final_offset_en_g[0] = trap_to_redmode & ~(sir_inst_g | internal_wdr); |
---|
3773 | assign final_offset_en_g[1] = internal_wdr & ~final_offset_en_g[0]; |
---|
3774 | // modified due to one-hot mux bug |
---|
3775 | // assign final_offset_en_g[2] = ~(|final_offset_en_g[1:0]); |
---|
3776 | |
---|
3777 | dffr_s #(2) dffr_final_offset_en_w1 ( |
---|
3778 | .din (final_offset_en_g[1:0]), |
---|
3779 | .q (final_offset_en_w1[1:0]), |
---|
3780 | .rst (local_rst), |
---|
3781 | .clk (clk), |
---|
3782 | .se (se), |
---|
3783 | .si (), |
---|
3784 | .so () |
---|
3785 | ); |
---|
3786 | |
---|
3787 | assign final_offset_sel_w1[2] = |
---|
3788 | ~(|final_offset_sel_w1[1:0]); |
---|
3789 | assign final_offset_sel_w1[1] = |
---|
3790 | final_offset_en_w1[1] & ~rst_tri_en; |
---|
3791 | assign final_offset_sel_w1[0] = |
---|
3792 | final_offset_en_w1[0] & ~rst_tri_en; |
---|
3793 | |
---|
3794 | mux3ds #(`TSA_TTYPE_WIDTH) mx_final_offset_w1 ( |
---|
3795 | .sel0 (final_offset_sel_w1[0]), |
---|
3796 | .sel1 (final_offset_sel_w1[1]), |
---|
3797 | .sel2 (final_offset_sel_w1[2]), |
---|
3798 | .in0 (9'b000000101), |
---|
3799 | .in1 (9'b000000010), |
---|
3800 | .in2 (tba_ttype_w1[`TSA_TTYPE_WIDTH-1:0]), |
---|
3801 | .dout (final_offset_w1[`TSA_TTYPE_WIDTH-1:0]) |
---|
3802 | ); |
---|
3803 | |
---|
3804 | assign tlu_final_offset_w1[`TSA_TTYPE_WIDTH-1:0] = |
---|
3805 | final_offset_w1[`TSA_TTYPE_WIDTH-1:0]; |
---|
3806 | // |
---|
3807 | // generating the trap pc and trap npc |
---|
3808 | // This section has been modified due to bug 3017 |
---|
3809 | // pc and npc has been changed from 48 -> 49 bits |
---|
3810 | // added for one-hot mux problem |
---|
3811 | assign tlu_pc_mxsel_w2[0] = |
---|
3812 | tlu_self_boot_rst_w2 | rst_tri_en; |
---|
3813 | // modified for bug 3710 |
---|
3814 | assign tlu_pc_mxsel_w2[1] = |
---|
3815 | local_select_tba_w2 & ~(rst_tri_en | tlu_self_boot_rst_w2); |
---|
3816 | assign tlu_pc_mxsel_w2[2] = |
---|
3817 | ~(|tlu_pc_mxsel_w2[1:0]); |
---|
3818 | // |
---|
3819 | /* logic moved to tlu_misctl |
---|
3820 | assign normal_trap_pc_w1 [48:0] = |
---|
3821 | {1'b0, tlu_partial_trap_pc_w1[33:0],final_offset_w1[`TSA_TTYPE_WIDTH-1:0], |
---|
3822 | 5'b00000}; |
---|
3823 | assign normal_trap_npc_w1[48:0] = |
---|
3824 | {1'b0, tlu_partial_trap_pc_w1[33:0],final_offset_w1[`TSA_TTYPE_WIDTH-1:0], |
---|
3825 | 5'b00100}; |
---|
3826 | // |
---|
3827 | // code moved from tlu_tdp |
---|
3828 | mux2ds #(49) mx_trap_pc_w1 ( |
---|
3829 | .in0 (normal_trap_pc_w1[48:0]), |
---|
3830 | .in1 (tlu_restore_pc_w1[48:0]), |
---|
3831 | .sel0 (~restore_pc_sel_w1), |
---|
3832 | .sel1 (restore_pc_sel_w1), |
---|
3833 | .dout (trap_pc_w1[48:0]) |
---|
3834 | ); |
---|
3835 | // |
---|
3836 | dff_s #(49) dff_trap_pc_w2 ( |
---|
3837 | .din (trap_pc_w1[48:0]), |
---|
3838 | .q (trap_pc_w2[48:0]), |
---|
3839 | .clk (clk), |
---|
3840 | .se (se), |
---|
3841 | .si (), |
---|
3842 | .so () |
---|
3843 | ); |
---|
3844 | |
---|
3845 | assign tlu_ifu_trappc_w2[48:0] = trap_pc_w2[48:0]; |
---|
3846 | |
---|
3847 | mux2ds #(49) mx_trap_npc_w1 ( |
---|
3848 | .in0 (normal_trap_npc_w1[48:0]), |
---|
3849 | .in1 (tlu_restore_npc_w1[48:0]), |
---|
3850 | .sel0 (~restore_pc_sel_w1), |
---|
3851 | .sel1 (restore_pc_sel_w1), |
---|
3852 | .dout (trap_npc_w1[48:0]) |
---|
3853 | ); |
---|
3854 | // |
---|
3855 | dff_s #(49) dff_trap_npc_w2 ( |
---|
3856 | .din (trap_npc_w1[48:0]), |
---|
3857 | .q (trap_npc_w2[48:0]), |
---|
3858 | .clk (clk), |
---|
3859 | .se (se), |
---|
3860 | .si (), |
---|
3861 | .so () |
---|
3862 | ); |
---|
3863 | |
---|
3864 | assign tlu_ifu_trapnpc_w2[48:0] = trap_npc_w2[48:0]; |
---|
3865 | */ |
---|
3866 | |
---|
3867 | // determine whether to generate a watch-dog reset using htba as the |
---|
3868 | // trap base address instead of the watch-dog reset vector |
---|
3869 | // added for bug 1894 and modified for bug 1964 |
---|
3870 | // modified for timing |
---|
3871 | assign hyper_wdr_early_trap_g = ((true_trap_tid_g[1:0] == 2'b00) ? |
---|
3872 | (tlu_hpstate_enb[0] & ~tlu_hpstate_priv[0] & trp_lvl_at_maxstl[0]): |
---|
3873 | ((true_trap_tid_g[1:0] == 2'b01) ? |
---|
3874 | (tlu_hpstate_enb[1] & ~tlu_hpstate_priv[1] & trp_lvl_at_maxstl[1]): |
---|
3875 | ((true_trap_tid_g[1:0] == 2'b10) ? |
---|
3876 | (tlu_hpstate_enb[2] & ~tlu_hpstate_priv[2] & trp_lvl_at_maxstl[2]): |
---|
3877 | (tlu_hpstate_enb[3] & ~tlu_hpstate_priv[3] & trp_lvl_at_maxstl[3])))); |
---|
3878 | |
---|
3879 | dffr_s dffr_hyper_wdr_early_trap_w2 ( |
---|
3880 | .din (hyper_wdr_early_trap_g), |
---|
3881 | .q (hyper_wdr_early_trap_w2), |
---|
3882 | .rst (local_rst), |
---|
3883 | .clk (clk), |
---|
3884 | .se (se), |
---|
3885 | .si (), |
---|
3886 | .so () |
---|
3887 | ); |
---|
3888 | |
---|
3889 | assign hyper_wdr_trap_w2 = |
---|
3890 | hyper_wdr_early_trap_w2 & (tlu_priv_traps_w2 & ~lsu_defr_trap_w2); |
---|
3891 | // |
---|
3892 | // detetermine whehter the trapping thread is in hyperlite mode or is at |
---|
3893 | // maxstl |
---|
3894 | // modified for timing and bug 4779 |
---|
3895 | /* |
---|
3896 | assign tlu_trap_to_hyper_g = |
---|
3897 | (true_trap_tid_g[1:0] == 2'b00) ? |
---|
3898 | (~tlu_hpstate_enb[0] | tlu_hpstate_priv[0] | trp_lvl_gte_maxstl[0]): |
---|
3899 | ((true_trap_tid_g[1:0] == 2'b01) ? |
---|
3900 | (~tlu_hpstate_enb[1] | tlu_hpstate_priv[1] | trp_lvl_gte_maxstl[1]): |
---|
3901 | ((true_trap_tid_g[1:0] == 2'b10) ? |
---|
3902 | (~tlu_hpstate_enb[2] | tlu_hpstate_priv[2] | trp_lvl_gte_maxstl[2]): |
---|
3903 | (~tlu_hpstate_enb[3] | tlu_hpstate_priv[3] | trp_lvl_gte_maxstl[3]))); |
---|
3904 | */ |
---|
3905 | // |
---|
3906 | assign tlu_trap_to_hyper_g = |
---|
3907 | (true_trap_tid_g[1:0] == 2'b00) ? |
---|
3908 | (~tlu_hpstate_enb[0] | tlu_hpstate_priv[0] | |
---|
3909 | trp_lvl_gte_maxstl[0] | (tlz_trap_g[0] & inst_vld_g)): |
---|
3910 | ((true_trap_tid_g[1:0] == 2'b01) ? |
---|
3911 | (~tlu_hpstate_enb[1] | tlu_hpstate_priv[1] | |
---|
3912 | trp_lvl_gte_maxstl[1] | (tlz_trap_g[1] & inst_vld_g)): |
---|
3913 | ((true_trap_tid_g[1:0] == 2'b10) ? |
---|
3914 | (~tlu_hpstate_enb[2] | tlu_hpstate_priv[2] | |
---|
3915 | trp_lvl_gte_maxstl[2] | (tlz_trap_g[2] & inst_vld_g)): |
---|
3916 | (~tlu_hpstate_enb[3] | tlu_hpstate_priv[3] | |
---|
3917 | trp_lvl_gte_maxstl[3] | (tlz_trap_g[3] & inst_vld_g)))); |
---|
3918 | // added for timing |
---|
3919 | dffr_s dffr_tlu_tlu_trap_to_hyper_w2 ( |
---|
3920 | .din (tlu_trap_to_hyper_g), |
---|
3921 | .q (tlu_trap_to_hyper_w2), |
---|
3922 | .clk (clk), |
---|
3923 | .rst (local_rst), |
---|
3924 | .se (se), |
---|
3925 | .si (), |
---|
3926 | .so () |
---|
3927 | ); |
---|
3928 | |
---|
3929 | // recoded for timing |
---|
3930 | assign select_tba_element_w2[0] = |
---|
3931 | ~(tlu_trap_to_hyper_w2 | lsu_defr_trap_w2) & tlu_early_priv_element_w2[0]; |
---|
3932 | assign select_tba_element_w2[1] = |
---|
3933 | ~tlu_trap_to_hyper_w2 & (|tlu_early_priv_element_w2[2:1]) & ~lsu_defr_trap_w2; |
---|
3934 | assign local_select_tba_w2 = |
---|
3935 | ~tlu_trap_to_hyper_w2 & (tlu_priv_traps_w2 & ~lsu_defr_trap_w2); |
---|
3936 | assign tdp_select_tba_w2 = local_select_tba_w2; |
---|
3937 | assign tlu_select_tba_w2 = |
---|
3938 | select_tba_element_w2[1] | (select_tba_element_w2[0] & ~lsu_ttype_vld_w2); |
---|
3939 | |
---|
3940 | /* |
---|
3941 | dffr_s dffr_tlu_select_tba_w2 ( |
---|
3942 | .din (select_tba_g), |
---|
3943 | .q (tlu_select_tba_w2), |
---|
3944 | .clk (clk), |
---|
3945 | .rst (local_rst), |
---|
3946 | .se (se), |
---|
3947 | .si (), |
---|
3948 | .so () |
---|
3949 | ); |
---|
3950 | */ |
---|
3951 | // |
---|
3952 | // added for bug 2064 and modified for bug 2165 |
---|
3953 | // modified for bug3719 |
---|
3954 | assign early_priv_traps_g = |
---|
3955 | ((early_ttype_g[8:4] == 5'b00001) & (|early_ttype_g[3:0])) | |
---|
3956 | ((early_ttype_g[8:4] == 5'b00100) & (|early_ttype_g[3:0])) | |
---|
3957 | ((early_ttype_g[8:4] == 5'b00010) & ~(early_ttype_g[3] & early_ttype_g[0]))| |
---|
3958 | ((early_ttype_g[8:2] == 7'b0011000) & (early_ttype_g[1] ^ early_ttype_g[0])) | |
---|
3959 | ((early_ttype_g[8:4] == 5'b00111) & (early_ttype_g[3:2]== 2'b11)) | |
---|
3960 | (early_ttype_g[8] & ~early_ttype_g[7]) | (early_ttype_g[7] & ~early_ttype_g[8]) | |
---|
3961 | (pib_wrap_trap_g & ~(|tlz_trap_g[`TLU_THRD_NUM-1:0]) & inst_vld_g) | |
---|
3962 | (swint_g & ~(|tlz_trap_g[`TLU_THRD_NUM-1:0]) & inst_vld_g); |
---|
3963 | |
---|
3964 | assign exu_hyper_traps_g = |
---|
3965 | exu_ttype_vld_g & ((early_ttype_g[8:0] == 9'h029) | (early_ttype_g[8:0] == 9'h034)); |
---|
3966 | |
---|
3967 | // |
---|
3968 | // modified for timing |
---|
3969 | |
---|
3970 | assign tlu_early_priv_element_g[0] = |
---|
3971 | early_priv_traps_g & early_ttype_sel[2]; |
---|
3972 | assign tlu_early_priv_element_g[1] = |
---|
3973 | early_priv_traps_g & ~early_ttype_sel[2]; |
---|
3974 | // modified for bug 4431, 4443 |
---|
3975 | assign tlu_early_priv_element_g[2] = |
---|
3976 | lsu_tlu_wtchpt_trp_g & ~(misalign_addr_jmpl_rtn_g | misalign_addr_ldst_atm_g | |
---|
3977 | ifu_ttype_vld_g | exu_hyper_traps_g | lsu_tlu_priv_action_g); |
---|
3978 | // lsu_tlu_wtchpt_trp_g & ~(lsu_tlu_priv_violtn_g | misalign_addr_jmpl_rtn_g | |
---|
3979 | // |
---|
3980 | // modified for added for timing |
---|
3981 | dffr_s #(3) dffr_tlu_early_priv_element_w2 ( |
---|
3982 | .din (tlu_early_priv_element_g[2:0]), |
---|
3983 | .q (tlu_early_priv_element_w2[2:0]), |
---|
3984 | .clk (clk), |
---|
3985 | .rst (local_rst), |
---|
3986 | .se (se), |
---|
3987 | .si (), |
---|
3988 | .so () |
---|
3989 | ); |
---|
3990 | |
---|
3991 | assign tlu_priv_traps_w2 = |
---|
3992 | tlu_early_priv_element_w2[0] & ~lsu_ttype_vld_w2 | |
---|
3993 | tlu_early_priv_element_w2[1] | |
---|
3994 | tlu_early_priv_element_w2[2]; |
---|
3995 | |
---|
3996 | dffr_s dffr_tlu_self_boot_rst_w2 ( |
---|
3997 | .din (tlu_self_boot_rst_g), |
---|
3998 | .q (tlu_self_boot_rst_w2), |
---|
3999 | .clk (clk), |
---|
4000 | .rst (local_rst), |
---|
4001 | .se (se), |
---|
4002 | .si (), |
---|
4003 | .so () |
---|
4004 | ); |
---|
4005 | |
---|
4006 | //========================================================================================= |
---|
4007 | // Generate TSA Control and Data |
---|
4008 | //========================================================================================= |
---|
4009 | |
---|
4010 | // MODIFY : keep 2b tid |
---|
4011 | // added for tsa_wr_tid bug |
---|
4012 | // modified for hypervisor support and logic loop |
---|
4013 | // modified for timing |
---|
4014 | // |
---|
4015 | assign tsa_wr_tid_sel_g = |
---|
4016 | wsr_inst_g_unflushed & inst_vld_g & (tstate_rw_g | tpc_rw_g | |
---|
4017 | tnpc_rw_g | ttype_rw_g | tlu_htstate_rw_g); |
---|
4018 | |
---|
4019 | // added for timing |
---|
4020 | |
---|
4021 | assign tsa_wr_tid_sel_tim_g = |
---|
4022 | (((wsr_inst_g & (tstate_rw_g | tpc_rw_g | |
---|
4023 | tnpc_rw_g | ttype_rw_g | tlu_htstate_rw_g)) | |
---|
4024 | ((retry_inst_g | done_inst_g) & cwp_fastcmplt_g)) & |
---|
4025 | inst_vld_g) | sync_trap_taken_g ; |
---|
4026 | |
---|
4027 | dffr_s dffr_tsa_wr_tid_sel_w2 ( |
---|
4028 | .din (tsa_wr_tid_sel_tim_g), |
---|
4029 | .q (tsa_wr_tid_sel_w2), |
---|
4030 | .clk (clk), |
---|
4031 | .rst (local_rst), |
---|
4032 | .se (se), |
---|
4033 | .si (), |
---|
4034 | .so () |
---|
4035 | ); |
---|
4036 | /* |
---|
4037 | assign tsa_wr_tid_sel_w2 = |
---|
4038 | (((wsr_inst_w2 & (tstate_rw_w2 | tpc_rw_w2 | |
---|
4039 | tnpc_rw_w2 | ttype_rw_w2 | htstate_rw_w2)) | |
---|
4040 | ((retry_inst_w2 | done_inst_w2) & cwp_fastcmplt_w2)) & |
---|
4041 | inst_vld_w2) | sync_trap_taken_w2 ; |
---|
4042 | */ |
---|
4043 | // |
---|
4044 | // added for timing |
---|
4045 | assign thrid_w2[0] = thread1_wsel_w2 | thread3_wsel_w2; |
---|
4046 | assign thrid_w2[1] = thread2_wsel_w2 | thread3_wsel_w2; |
---|
4047 | // |
---|
4048 | // |
---|
4049 | // modified for bug 4403 |
---|
4050 | /* |
---|
4051 | mux2ds #(2) mx_tsa_wr_tid ( |
---|
4052 | .in0 (pend_trap_tid_w2[1:0]), |
---|
4053 | .in1 (thrid_w2[1:0]), |
---|
4054 | .sel0 (~tsa_wr_tid_sel_w2), |
---|
4055 | .sel1 (tsa_wr_tid_sel_w2), |
---|
4056 | .dout (tsa_wr_tid[1:0]) |
---|
4057 | ); |
---|
4058 | */ |
---|
4059 | // modified for bug 4403 dn 4443 |
---|
4060 | assign tsa_wr_tid[1:0] = |
---|
4061 | (tsa_wr_tid_sel_w2 & lsu_defr_trap_w2) ? true_trap_tid_w2[1:0]: |
---|
4062 | ((tsa_wr_tid_sel_w2 & ~lsu_defr_trap_w2)? thrid_w2[1:0] : |
---|
4063 | pend_trap_tid_w2[1:0]); |
---|
4064 | |
---|
4065 | // tsa should not be written by certain resets. May have to extend to wrm etc. !!! |
---|
4066 | // modified due to the swap of memory from tlu_tsa -> bw_r_rf32x144 -> 2x bw_r_rf32x80 |
---|
4067 | // modified for bug 3384 |
---|
4068 | assign tsa_wr_vld[0] = |
---|
4069 | trap_taken_w2 | local_rst | // a thread traps |
---|
4070 | ((tpc_rw_w2 | tstate_rw_w2) & wsr_inst_w2); // wrpr-tsa |
---|
4071 | |
---|
4072 | assign tsa_wr_vld[1] = |
---|
4073 | trap_taken_w2 | local_rst | // a thread traps |
---|
4074 | ((tnpc_rw_w2 | ttype_rw_w2 | |
---|
4075 | htstate_rw_w2) & wsr_inst_w2); // wrpr-tsa |
---|
4076 | // |
---|
4077 | // modified due to timing all w stage signals have been moved to w2 |
---|
4078 | assign tsa_pc_en = tpc_rw_w2 | trap_taken_w2; |
---|
4079 | assign tsa_npc_en = tnpc_rw_w2 | trap_taken_w2; |
---|
4080 | assign tsa_tstate_en = tstate_rw_w2 | trap_taken_w2; |
---|
4081 | assign tsa_ttype_en = ttype_rw_w2 | trap_taken_w2 | local_rst; |
---|
4082 | // |
---|
4083 | // added for hypervisor support |
---|
4084 | assign tsa_htstate_en = htstate_rw_w2 | trap_taken_w2; |
---|
4085 | |
---|
4086 | // Should all these regs enable a read of the tsa ? |
---|
4087 | assign tsa_rd_vld = ifu_tlu_done_inst_d | ifu_tlu_retry_inst_d | // done/retry |
---|
4088 | (tpc_rw_d | tnpc_rw_d | tstate_rw_d | ttype_rw_d | |
---|
4089 | // tick_rw_d | tba_rw_d | pstate_rw_d | tl_rw_d | |
---|
4090 | tlu_htstate_rw_d) & ifu_tlu_rsr_inst_d; // rdpr-tsa |
---|
4091 | // |
---|
4092 | // added for timing |
---|
4093 | dff_s dff_tsa_rd_vld_e ( |
---|
4094 | .din (tsa_rd_vld), |
---|
4095 | .q (tsa_rd_vld_e), |
---|
4096 | .clk (clk), |
---|
4097 | .se (se), |
---|
4098 | .si (), |
---|
4099 | .so () |
---|
4100 | ); |
---|
4101 | // |
---|
4102 | // added for timing |
---|
4103 | assign tsa_rd_en = ifu_tlu_done_inst_d | ifu_tlu_retry_inst_d | // done/retry |
---|
4104 | (~(|sraddr2[4:2]) & ifu_tlu_rsr_inst_d); // rdpr-tsa |
---|
4105 | // |
---|
4106 | dff_s #(`TLU_THRD_NUM) dff_thread_wsel_w2 ( |
---|
4107 | .din ({thread3_wsel_g, thread2_wsel_g, thread1_wsel_g, thread0_wsel_g}), |
---|
4108 | .q ({thread3_wsel_w2, thread2_wsel_w2, thread1_wsel_w2, thread0_wsel_w2}), |
---|
4109 | .clk (clk), |
---|
4110 | .se (se), |
---|
4111 | .si (), |
---|
4112 | .so () |
---|
4113 | ); |
---|
4114 | |
---|
4115 | assign tlu_thread_wsel_g[0] = thread0_rsel_dec_g; |
---|
4116 | assign tlu_thread_wsel_g[1] = thread1_rsel_dec_g; |
---|
4117 | assign tlu_thread_wsel_g[2] = thread2_rsel_dec_g; |
---|
4118 | assign tlu_thread_wsel_g[3] = thread3_rsel_dec_g; |
---|
4119 | // |
---|
4120 | // Added for tsa_wr_tid bug |
---|
4121 | // |
---|
4122 | assign thread0_wtrp_w2 = ~tsa_wr_tid[1] & ~tsa_wr_tid[0]; |
---|
4123 | assign thread1_wtrp_w2 = ~tsa_wr_tid[1] & tsa_wr_tid[0]; |
---|
4124 | assign thread2_wtrp_w2 = tsa_wr_tid[1] & ~tsa_wr_tid[0]; |
---|
4125 | assign thread3_wtrp_w2 = tsa_wr_tid[1] & tsa_wr_tid[0]; |
---|
4126 | |
---|
4127 | // write uses trp-lvl after increment. |
---|
4128 | mux4ds #(3) tsawthrd ( |
---|
4129 | .in0 (trp_lvl0_new[2:0]), |
---|
4130 | .in1 (trp_lvl1_new[2:0]), |
---|
4131 | .in2 (trp_lvl2_new[2:0]), |
---|
4132 | .in3 (trp_lvl3_new[2:0]), |
---|
4133 | .sel0 (thread0_wtrp_w2), |
---|
4134 | .sel1 (thread1_wtrp_w2), |
---|
4135 | .sel2 (thread2_wtrp_w2), |
---|
4136 | .sel3 (thread3_wtrp_w2), |
---|
4137 | .dout (tsa_wr_tpl[2:0]) |
---|
4138 | ); |
---|
4139 | |
---|
4140 | // rd use trp-lvl prior to decrement. |
---|
4141 | mux4ds #(3) tsarthrd ( |
---|
4142 | .in0 (trp_lvl0[2:0]), |
---|
4143 | .in1 (trp_lvl1[2:0]), |
---|
4144 | .in2 (trp_lvl2[2:0]), |
---|
4145 | .in3 (trp_lvl3[2:0]), |
---|
4146 | .sel0 (thread0_rsel_d), |
---|
4147 | .sel1 (thread1_rsel_d), |
---|
4148 | .sel2 (thread2_rsel_d), |
---|
4149 | .sel3 (thread3_rsel_d), |
---|
4150 | .dout (tsa_rd_tpl[2:0]) |
---|
4151 | ); |
---|
4152 | |
---|
4153 | assign tsa_rd_tid[1:0] = thrid_d[1:0]; |
---|
4154 | |
---|
4155 | //========================================================================================= |
---|
4156 | // TT initial state |
---|
4157 | //========================================================================================= |
---|
4158 | |
---|
4159 | // The initial state of TT should be 1 on por. Since this is required for 4 thread, |
---|
4160 | // it will be difficult to do this thru a write to the tsa while reset is occuring. |
---|
4161 | // Instead a bit will be used to mark whether the tt for a thread has been written to. |
---|
4162 | // If it hasn't then a '1' has to be inserted into the |
---|
4163 | dff_s dff_rst_d1 ( |
---|
4164 | .din (local_rst), |
---|
4165 | .q (reset_d1), |
---|
4166 | .clk (clk), |
---|
4167 | .se (se), |
---|
4168 | .si (), |
---|
4169 | .so () |
---|
4170 | ); |
---|
4171 | |
---|
4172 | assign tt_init_en = reset_d1 & tlu_rst_l; |
---|
4173 | // |
---|
4174 | // modified for timing all g stage signals have been move to w2 |
---|
4175 | assign tt_init_rst[0] = |
---|
4176 | local_rst | (tsa_ttype_en & (|tsa_wr_vld[1:0]) & thread0_wtrp_w2); |
---|
4177 | assign tt_init_rst[1] = |
---|
4178 | local_rst | (tsa_ttype_en & (|tsa_wr_vld[1:0]) & thread1_wtrp_w2); |
---|
4179 | assign tt_init_rst[2] = |
---|
4180 | local_rst | (tsa_ttype_en & (|tsa_wr_vld[1:0]) & thread2_wtrp_w2); |
---|
4181 | assign tt_init_rst[3] = |
---|
4182 | local_rst | (tsa_ttype_en & (|tsa_wr_vld[1:0]) & thread3_wtrp_w2); |
---|
4183 | |
---|
4184 | assign lsu_tlu_rsr_data_mod_e[7:0] = ttype_unwritten_sel ? 8'b0000_0001 : lsu_tlu_rsr_data_e[7:0]; |
---|
4185 | |
---|
4186 | dffre_s dffre_tt_init0 ( |
---|
4187 | .din (tt_init_en), |
---|
4188 | .q (tt_unwritten[0]), |
---|
4189 | .rst (tt_init_rst[0]), |
---|
4190 | .en (tt_init_en), |
---|
4191 | .clk (clk), |
---|
4192 | .se (se), |
---|
4193 | .si (), |
---|
4194 | .so () |
---|
4195 | ); |
---|
4196 | |
---|
4197 | dffre_s dffre_tt_init1 ( |
---|
4198 | .din (tt_init_en), |
---|
4199 | .q (tt_unwritten[1]), |
---|
4200 | .rst (tt_init_rst[1]), |
---|
4201 | .en (tt_init_en), |
---|
4202 | .clk (clk), |
---|
4203 | .se (se), |
---|
4204 | .si (), |
---|
4205 | .so () |
---|
4206 | ); |
---|
4207 | |
---|
4208 | dffre_s dffre_tt_init2 ( |
---|
4209 | .din (tt_init_en), |
---|
4210 | .q (tt_unwritten[2]), |
---|
4211 | .rst (tt_init_rst[2]), |
---|
4212 | .en (tt_init_en), |
---|
4213 | .clk (clk), |
---|
4214 | .se (se), |
---|
4215 | .si (), |
---|
4216 | .so () |
---|
4217 | ); |
---|
4218 | |
---|
4219 | dffre_s dffre_tt_init3 ( |
---|
4220 | .din (tt_init_en), |
---|
4221 | .q (tt_unwritten[3]), |
---|
4222 | .rst (tt_init_rst[3]), |
---|
4223 | .en (tt_init_en), |
---|
4224 | .clk (clk), |
---|
4225 | .se (se), |
---|
4226 | .si (), |
---|
4227 | .so () |
---|
4228 | ); |
---|
4229 | |
---|
4230 | //========================================================================================= |
---|
4231 | // Decode SR Addr |
---|
4232 | //========================================================================================= |
---|
4233 | |
---|
4234 | // **Exceptions for Write/Reads of Privileged/State Register** |
---|
4235 | // WRPR: |
---|
4236 | // - Access to reserved rd fields will cause exception. Done by IFU. |
---|
4237 | // - A write to TPC, TNPC, TT or TSTATE when the trap level is zero |
---|
4238 | // (TL=0) causes an illegal_instruction exception. |
---|
4239 | // - privileged opcode. Use privilege bit in sraddr for exception. |
---|
4240 | // WRSR : |
---|
4241 | // - privileged opcode. wrasr only - implementation dependent. |
---|
4242 | // - illegal inst - done by IFU. |
---|
4243 | // RDPR : |
---|
4244 | // - A read from TPC, TNPC, TT or TSTATE when the trap level is zero |
---|
4245 | // (TL=0) causes an illegal_instruction exception. |
---|
4246 | // - Access to reserved rs1 fields causes an illegal_inst exception. |
---|
4247 | // - privileged opcode. |
---|
4248 | // RDSR : |
---|
4249 | // - privileged opcode. rdasr only - implementation dependent. |
---|
4250 | // - Access to reserved rs1 fields causes an illegal_inst exception. |
---|
4251 | assign sraddr[`TLU_ASR_ADDR_WIDTH-1:0] = |
---|
4252 | ifu_tlu_sraddr_d[`TLU_ASR_ADDR_WIDTH-1:0]; |
---|
4253 | assign sraddr2[`TLU_ASR_ADDR_WIDTH-1:0] = |
---|
4254 | sraddr[`TLU_ASR_ADDR_WIDTH-1:0]; |
---|
4255 | // |
---|
4256 | // added for hypervisor support |
---|
4257 | assign asr_hyperp = sraddr2[6]; |
---|
4258 | assign asr_priv = sraddr2[5]; |
---|
4259 | |
---|
4260 | assign stickcmp_rw_d = sraddr2[4] & sraddr2[3] & ~sraddr2[2] & ~sraddr2[1] & sraddr2[0] & |
---|
4261 | ~asr_priv; // |
---|
4262 | assign stick_rw_d = sraddr2[4] & sraddr2[3] & ~sraddr2[2] & ~sraddr2[1] & ~sraddr2[0]; |
---|
4263 | |
---|
4264 | assign tpc_rw_d = ~sraddr[4] & ~sraddr[3] & ~sraddr[2] & ~sraddr[1] & ~sraddr[0] & |
---|
4265 | asr_priv; // =1 ; privileged. |
---|
4266 | assign tnpc_rw_d = ~sraddr[4] & ~sraddr[3] & ~sraddr[2] & ~sraddr[1] & sraddr[0] & |
---|
4267 | asr_priv; // =1 ; privileged. |
---|
4268 | assign tstate_rw_d = ~sraddr[4] & ~sraddr[3] & ~sraddr[2] & sraddr[1] & ~sraddr[0] & |
---|
4269 | asr_priv; // =1 ; privileged. |
---|
4270 | assign ttype_rw_d = ~sraddr[4] & ~sraddr[3] & ~sraddr[2] & sraddr[1] & sraddr[0] & |
---|
4271 | asr_priv; // =1 ; privileged. |
---|
4272 | |
---|
4273 | // stick and tick are refering to the same register. |
---|
4274 | // - privileged action - rdtick only. |
---|
4275 | assign tick_rw_d = ((~sraddr2[4] & ~sraddr2[3] & sraddr2[2] & ~sraddr2[1] & ~sraddr2[0]) | |
---|
4276 | stick_rw_d) & ~asr_hyperp; // =1 ; privileged. |
---|
4277 | // |
---|
4278 | // modified for bug 1293 |
---|
4279 | // qualified with the rsr read |
---|
4280 | assign tick_npriv_r_d = (~sraddr2[4] & ~sraddr2[3] & sraddr2[2] & ~sraddr2[1] & ~sraddr2[0] | |
---|
4281 | stick_rw_d) & ~asr_priv & ifu_tlu_rsr_inst_d; // =0; non-privileged. |
---|
4282 | |
---|
4283 | assign tickcmp_rw_d = sraddr2[4] & ~sraddr2[3] & sraddr2[2] & sraddr2[1] & sraddr2[0] & |
---|
4284 | ~asr_priv; // |
---|
4285 | assign tba_rw_d = ~sraddr[4] & ~sraddr[3] & sraddr[2] & ~sraddr[1] & sraddr[0] & |
---|
4286 | asr_priv; // =1 ; privileged. |
---|
4287 | assign pstate_rw_d = ~sraddr[4] & ~sraddr[3] & sraddr[2] & sraddr[1] & ~sraddr[0] & |
---|
4288 | asr_priv; // =1 ; privileged. |
---|
4289 | assign tl_rw_d = ~sraddr[4] & ~sraddr[3] & sraddr[2] & sraddr[1] & sraddr[0] & |
---|
4290 | asr_priv; // =1 ; privileged. |
---|
4291 | assign pil_rw_d = ~sraddr2[4] & sraddr2[3] & ~sraddr2[2] & ~sraddr2[1] & ~sraddr2[0] & |
---|
4292 | asr_priv; // =1 ; privileged. |
---|
4293 | assign set_sftint_d = sraddr2[4] & ~sraddr2[3] & sraddr2[2] & ~sraddr2[1] & ~sraddr2[0] & |
---|
4294 | ~(asr_priv | asr_hyperp); |
---|
4295 | assign clr_sftint_d = sraddr2[4] & ~sraddr2[3] & sraddr2[2] & ~sraddr2[1] & sraddr2[0] & |
---|
4296 | ~(asr_priv | asr_hyperp); |
---|
4297 | assign sftint_rg_rw_d = sraddr2[4] & ~sraddr2[3] & sraddr2[2] & sraddr2[1] & ~sraddr2[0] & |
---|
4298 | ~(asr_priv | asr_hyperp); |
---|
4299 | // |
---|
4300 | // pib register decodes |
---|
4301 | assign pcr_rsr_d = |
---|
4302 | (sraddr[`TLU_ASR_ADDR_WIDTH-1:0] == `PCR_ASR_ADDR); |
---|
4303 | assign pic_rsr_d = |
---|
4304 | ((sraddr[`TLU_ASR_ADDR_WIDTH-1:0] == `PIC_ASR_PRIV_ADDR) | |
---|
4305 | (sraddr[`TLU_ASR_ADDR_WIDTH-1:0] == `PIC_ASR_NPRIV_ADDR)); |
---|
4306 | |
---|
4307 | // Bug 818 fix: The qualification to sraddr[5] is removed due to the sftint and tick_cmp registers |
---|
4308 | // are priveledged write state registers and not priveledged registers, therefore, the sraddr[5] is |
---|
4309 | // not asserted for these |
---|
4310 | // modified due to timing |
---|
4311 | // assign wsr_inst_d = ifu_tlu_wsr_inst_d; |
---|
4312 | // |
---|
4313 | // added for bug 1293 |
---|
4314 | |
---|
4315 | // Stage to E1. |
---|
4316 | |
---|
4317 | dff_s dff_tpc_rw_e ( |
---|
4318 | .din (tpc_rw_d), |
---|
4319 | .q (tpc_rw_e), |
---|
4320 | .clk (clk), |
---|
4321 | .se (se), |
---|
4322 | .si (), |
---|
4323 | .so () |
---|
4324 | ); |
---|
4325 | |
---|
4326 | dff_s dff_tnpc_rw_e ( |
---|
4327 | .din (tnpc_rw_d), |
---|
4328 | .q (tnpc_rw_e), |
---|
4329 | .clk (clk), |
---|
4330 | .se (se), |
---|
4331 | .si (), |
---|
4332 | .so () |
---|
4333 | ); |
---|
4334 | |
---|
4335 | dff_s dff_tstate_rw_e ( |
---|
4336 | .din (tstate_rw_d), |
---|
4337 | .q (tstate_rw_e), |
---|
4338 | .clk (clk), |
---|
4339 | .se (se), |
---|
4340 | .si (), |
---|
4341 | .so () |
---|
4342 | ); |
---|
4343 | |
---|
4344 | dff_s dff_ttype_rw_e ( |
---|
4345 | .din (ttype_rw_d), |
---|
4346 | .q (ttype_rw_e), |
---|
4347 | .clk (clk), |
---|
4348 | .se (se), |
---|
4349 | .si (), |
---|
4350 | .so () |
---|
4351 | ); |
---|
4352 | |
---|
4353 | dff_s dff_tick_rw_e ( |
---|
4354 | .din (tick_rw_d), |
---|
4355 | .q (tick_rw_e), |
---|
4356 | .clk (clk), |
---|
4357 | .se (se), |
---|
4358 | .si (), |
---|
4359 | .so () |
---|
4360 | ); |
---|
4361 | |
---|
4362 | dff_s dff_tick_npriv_r_e ( |
---|
4363 | .din (tick_npriv_r_d), |
---|
4364 | .q (tick_npriv_r_e), |
---|
4365 | .clk (clk), |
---|
4366 | .se (se), |
---|
4367 | .si (), |
---|
4368 | .so () |
---|
4369 | ); |
---|
4370 | |
---|
4371 | dff_s dff_tickcmp_rw_e ( |
---|
4372 | .din (tickcmp_rw_d), |
---|
4373 | .q (tickcmp_rw_e), |
---|
4374 | .clk (clk), |
---|
4375 | .se (se), |
---|
4376 | .si (), |
---|
4377 | .so () |
---|
4378 | ); |
---|
4379 | |
---|
4380 | dff_s dff_tba_rw_e ( |
---|
4381 | .din (tba_rw_d), |
---|
4382 | .q (tba_rw_e), |
---|
4383 | .clk (clk), |
---|
4384 | .se (se), |
---|
4385 | .si (), |
---|
4386 | .so () |
---|
4387 | ); |
---|
4388 | |
---|
4389 | dff_s dff_pstate_rw_e ( |
---|
4390 | .din (pstate_rw_d), |
---|
4391 | .q (pstate_rw_e), |
---|
4392 | .clk (clk), |
---|
4393 | .se (se), |
---|
4394 | .si (), |
---|
4395 | .so () |
---|
4396 | ); |
---|
4397 | |
---|
4398 | dff_s dff_tl_rw_d_e ( |
---|
4399 | .din (tl_rw_d), |
---|
4400 | .q (tl_rw_e), |
---|
4401 | .clk (clk), |
---|
4402 | .se (se), |
---|
4403 | .si (), |
---|
4404 | .so () |
---|
4405 | ); |
---|
4406 | |
---|
4407 | dff_s dff_pil_rw_d_e ( |
---|
4408 | .din (pil_rw_d), |
---|
4409 | .q (pil_rw_e), |
---|
4410 | .clk (clk), |
---|
4411 | .se (se), |
---|
4412 | .si (), |
---|
4413 | .so () |
---|
4414 | ); |
---|
4415 | |
---|
4416 | dff_s dff_set_sftint_e ( |
---|
4417 | .din (set_sftint_d), |
---|
4418 | .q (set_sftint_e), |
---|
4419 | .clk (clk), |
---|
4420 | .se (se), |
---|
4421 | .si (), |
---|
4422 | .so () |
---|
4423 | ); |
---|
4424 | |
---|
4425 | dff_s dff_clr_sftint_e ( |
---|
4426 | .din (clr_sftint_d), |
---|
4427 | .q (clr_sftint_e), |
---|
4428 | .clk (clk), |
---|
4429 | .se (se), |
---|
4430 | .si (), |
---|
4431 | .so () |
---|
4432 | ); |
---|
4433 | |
---|
4434 | dff_s dff_sftint_rg_rw_e ( |
---|
4435 | .din (sftint_rg_rw_d), |
---|
4436 | .q (sftint_rg_rw_e), |
---|
4437 | .clk (clk), |
---|
4438 | .se (se), |
---|
4439 | .si (), |
---|
4440 | .so () |
---|
4441 | ); |
---|
4442 | |
---|
4443 | dff_s dff_pcr_rsr_e ( |
---|
4444 | .din (pcr_rsr_d), |
---|
4445 | .q (pcr_rsr_e), |
---|
4446 | .clk (clk), |
---|
4447 | .se (se), |
---|
4448 | .si (), |
---|
4449 | .so () |
---|
4450 | ); |
---|
4451 | |
---|
4452 | dff_s dff_pic_rsr_e ( |
---|
4453 | .din (pic_rsr_d), |
---|
4454 | .q (pic_rsr_e), |
---|
4455 | .clk (clk), |
---|
4456 | .se (se), |
---|
4457 | .si (), |
---|
4458 | .so () |
---|
4459 | ); |
---|
4460 | // |
---|
4461 | // modified due to timing |
---|
4462 | /* |
---|
4463 | dff_s dff_wsr_inst_d_e ( |
---|
4464 | .din (wsr_inst_d), |
---|
4465 | .q (wsr_inst_e), |
---|
4466 | .clk (clk), |
---|
4467 | .se (se), |
---|
4468 | .si (), |
---|
4469 | .so () |
---|
4470 | ); |
---|
4471 | */ |
---|
4472 | assign wsr_inst_e = lsu_tlu_wsr_inst_e; |
---|
4473 | |
---|
4474 | dff_s dff_stickcmp_rw_e ( |
---|
4475 | .din (stickcmp_rw_d), |
---|
4476 | .q (stickcmp_rw_e), |
---|
4477 | .clk (clk), |
---|
4478 | .se (se), |
---|
4479 | .si (), |
---|
4480 | .so () |
---|
4481 | ); |
---|
4482 | |
---|
4483 | // Stage to E2. |
---|
4484 | |
---|
4485 | dff_s dff_tpc_rw_m ( |
---|
4486 | .din (tpc_rw_e), |
---|
4487 | .q (tpc_rw_m), |
---|
4488 | .clk (clk), |
---|
4489 | .se (se), |
---|
4490 | .si (), |
---|
4491 | .so () |
---|
4492 | ); |
---|
4493 | |
---|
4494 | dff_s dff_tnpc_rw_m ( |
---|
4495 | .din (tnpc_rw_e), |
---|
4496 | .q (tnpc_rw_m), |
---|
4497 | .clk (clk), |
---|
4498 | .se (se), |
---|
4499 | .si (), |
---|
4500 | .so () |
---|
4501 | ); |
---|
4502 | |
---|
4503 | dff_s dff_tstate_rw_m ( |
---|
4504 | .din (tstate_rw_e), |
---|
4505 | .q (tstate_rw_m), |
---|
4506 | .clk (clk), |
---|
4507 | .se (se), |
---|
4508 | .si (), |
---|
4509 | .so () |
---|
4510 | ); |
---|
4511 | |
---|
4512 | dff_s dff_ttype_rw_m ( |
---|
4513 | .din (ttype_rw_e), |
---|
4514 | .q (ttype_rw_m), |
---|
4515 | .clk (clk), |
---|
4516 | .se (se), |
---|
4517 | .si (), |
---|
4518 | .so () |
---|
4519 | ); |
---|
4520 | |
---|
4521 | dff_s dff_tick_rw_m ( |
---|
4522 | .din (tick_rw_e), |
---|
4523 | .q (tick_rw_m), |
---|
4524 | .clk (clk), |
---|
4525 | .se (se), |
---|
4526 | .si (), |
---|
4527 | .so () |
---|
4528 | ); |
---|
4529 | |
---|
4530 | dff_s dff_tick_npriv_r_m ( |
---|
4531 | .din (tick_npriv_r_e), |
---|
4532 | .q (tick_npriv_r_m), |
---|
4533 | .clk (clk), |
---|
4534 | .se (se), |
---|
4535 | .si (), |
---|
4536 | .so () |
---|
4537 | ); |
---|
4538 | |
---|
4539 | dff_s dff_tickcmp_rw_m ( |
---|
4540 | .din (tickcmp_rw_e), |
---|
4541 | .q (tickcmp_rw_m), |
---|
4542 | .clk (clk), |
---|
4543 | .se (se), |
---|
4544 | .si (), |
---|
4545 | .so () |
---|
4546 | ); |
---|
4547 | // |
---|
4548 | // added for timing - moved from hypervisor |
---|
4549 | dff_s dff_htickcmp_rw_m_m ( |
---|
4550 | .din (tlu_htickcmp_rw_e), |
---|
4551 | .q (htickcmp_rw_m), |
---|
4552 | .clk (clk), |
---|
4553 | .se (se), |
---|
4554 | .si (), |
---|
4555 | .so () |
---|
4556 | ); |
---|
4557 | |
---|
4558 | dff_s dff_tba_rw_m ( |
---|
4559 | .din (tba_rw_e), |
---|
4560 | .q (tba_rw_m), |
---|
4561 | .clk (clk), |
---|
4562 | .se (se), |
---|
4563 | .si (), |
---|
4564 | .so () |
---|
4565 | ); |
---|
4566 | |
---|
4567 | dff_s dff_pstate_rw_m ( |
---|
4568 | .din (pstate_rw_e), |
---|
4569 | .q (pstate_rw_m), |
---|
4570 | .clk (clk), |
---|
4571 | .se (se), |
---|
4572 | .si (), |
---|
4573 | .so () |
---|
4574 | ); |
---|
4575 | |
---|
4576 | dff_s dff_tl_rw_m ( |
---|
4577 | .din (tl_rw_e), |
---|
4578 | .q (tl_rw_m), |
---|
4579 | .clk (clk), |
---|
4580 | .se (se), |
---|
4581 | .si (), |
---|
4582 | .so () |
---|
4583 | ); |
---|
4584 | |
---|
4585 | dff_s dff_pil_rw_m ( |
---|
4586 | .din (pil_rw_e), |
---|
4587 | .q (pil_rw_m), |
---|
4588 | .clk (clk), |
---|
4589 | .se (se), |
---|
4590 | .si (), |
---|
4591 | .so () |
---|
4592 | ); |
---|
4593 | |
---|
4594 | dff_s dff_set_sftint_m ( |
---|
4595 | .din (set_sftint_e), |
---|
4596 | .q (set_sftint_m), |
---|
4597 | .clk (clk), |
---|
4598 | .se (se), |
---|
4599 | .si (), |
---|
4600 | .so () |
---|
4601 | ); |
---|
4602 | |
---|
4603 | dff_s dff_clr_sftint_m ( |
---|
4604 | .din (clr_sftint_e), |
---|
4605 | .q (clr_sftint_m), |
---|
4606 | .clk (clk), |
---|
4607 | .se (se), |
---|
4608 | .si (), |
---|
4609 | .so () |
---|
4610 | ); |
---|
4611 | |
---|
4612 | dff_s dff_sftint_rg_rw_m ( |
---|
4613 | .din (sftint_rg_rw_e), |
---|
4614 | .q (sftint_rg_rw_m), |
---|
4615 | .clk (clk), |
---|
4616 | .se (se), |
---|
4617 | .si (), |
---|
4618 | .so () |
---|
4619 | ); |
---|
4620 | |
---|
4621 | dff_s dff_wsr_inst_m ( |
---|
4622 | .din (wsr_inst_e), |
---|
4623 | .q (wsr_inst_m), |
---|
4624 | .clk (clk), |
---|
4625 | .se (se), |
---|
4626 | .si (), |
---|
4627 | .so () |
---|
4628 | ); |
---|
4629 | // |
---|
4630 | // added for hypervisor support |
---|
4631 | dff_s dff_stickcmp_rw_m ( |
---|
4632 | .din (stickcmp_rw_e), |
---|
4633 | .q (stickcmp_rw_m), |
---|
4634 | .clk (clk), |
---|
4635 | .se (se), |
---|
4636 | .si (), |
---|
4637 | .so () |
---|
4638 | ); |
---|
4639 | |
---|
4640 | dff_s dff_tpc_rw_g ( |
---|
4641 | .din (tpc_rw_m), |
---|
4642 | .q (tpc_rw_g), |
---|
4643 | .clk (clk), |
---|
4644 | .se (se), |
---|
4645 | .si (), |
---|
4646 | .so () |
---|
4647 | ); |
---|
4648 | |
---|
4649 | dff_s dff_tnpc_rw_g ( |
---|
4650 | .din (tnpc_rw_m), |
---|
4651 | .q (tnpc_rw_g), |
---|
4652 | .clk (clk), |
---|
4653 | .se (se), |
---|
4654 | .si (), |
---|
4655 | .so () |
---|
4656 | ); |
---|
4657 | |
---|
4658 | dff_s dff_tstate_rw_g ( |
---|
4659 | .din (tstate_rw_m), |
---|
4660 | .q (tstate_rw_g), |
---|
4661 | .clk (clk), |
---|
4662 | .se (se), |
---|
4663 | .si (), |
---|
4664 | .so () |
---|
4665 | ); |
---|
4666 | |
---|
4667 | dff_s dff_ttype_rw_g ( |
---|
4668 | .din (ttype_rw_m), |
---|
4669 | .q (ttype_rw_g), |
---|
4670 | .clk (clk), |
---|
4671 | .se (se), |
---|
4672 | .si (), |
---|
4673 | .so () |
---|
4674 | ); |
---|
4675 | |
---|
4676 | dff_s dff_tick_rw_g ( |
---|
4677 | .din (tick_rw_m), |
---|
4678 | .q (tick_rw_g), |
---|
4679 | .clk (clk), |
---|
4680 | .se (se), |
---|
4681 | .si (), |
---|
4682 | .so () |
---|
4683 | ); |
---|
4684 | |
---|
4685 | dff_s dff_tick_npriv_r_g ( |
---|
4686 | .din (tick_npriv_r_m), |
---|
4687 | .q (tick_npriv_r_g), |
---|
4688 | .clk (clk), |
---|
4689 | .se (se), |
---|
4690 | .si (), |
---|
4691 | .so () |
---|
4692 | ); |
---|
4693 | |
---|
4694 | dff_s dff_tickcmp_rw_g ( |
---|
4695 | .din (tickcmp_rw_m), |
---|
4696 | .q (tickcmp_rw_g), |
---|
4697 | .clk (clk), |
---|
4698 | .se (se), |
---|
4699 | .si (), |
---|
4700 | .so () |
---|
4701 | ); |
---|
4702 | // |
---|
4703 | // added for timing - moved form hyperv |
---|
4704 | dff_s dff_htickcmp_rw_m_g ( |
---|
4705 | .din (htickcmp_rw_m), |
---|
4706 | .q (htickcmp_rw_g), |
---|
4707 | .clk (clk), |
---|
4708 | .se (se), |
---|
4709 | .si (), |
---|
4710 | .so () |
---|
4711 | ); |
---|
4712 | |
---|
4713 | dff_s dff_tba_rw_g ( |
---|
4714 | .din (tba_rw_m), |
---|
4715 | .q (tba_rw_g), |
---|
4716 | .clk (clk), |
---|
4717 | .se (se), |
---|
4718 | .si (), |
---|
4719 | .so () |
---|
4720 | ); |
---|
4721 | |
---|
4722 | dff_s dff_pstate_rw_g ( |
---|
4723 | .din (pstate_rw_m), |
---|
4724 | .q (pstate_rw_g), |
---|
4725 | .clk (clk), |
---|
4726 | .se (se), |
---|
4727 | .si (), |
---|
4728 | .so () |
---|
4729 | ); |
---|
4730 | |
---|
4731 | dff_s dff_pstate_rw_w2 ( |
---|
4732 | .din (pstate_rw_g), |
---|
4733 | .q (pstate_rw_w2), |
---|
4734 | .clk (clk), |
---|
4735 | .se (se), |
---|
4736 | .si (), |
---|
4737 | .so () |
---|
4738 | ); |
---|
4739 | |
---|
4740 | dff_s dff_tl_rw_g ( |
---|
4741 | .din (tl_rw_m), |
---|
4742 | .q (tl_rw_g), |
---|
4743 | .clk (clk), |
---|
4744 | .se (se), |
---|
4745 | .si (), |
---|
4746 | .so () |
---|
4747 | ); |
---|
4748 | |
---|
4749 | dff_s dff_tl_rw_w2 ( |
---|
4750 | .din (tl_rw_g), |
---|
4751 | .q (tl_rw_w2), |
---|
4752 | .clk (clk), |
---|
4753 | .se (se), |
---|
4754 | .si (), |
---|
4755 | .so () |
---|
4756 | ); |
---|
4757 | |
---|
4758 | dff_s dff_pil_rw_g ( |
---|
4759 | .din (pil_rw_m), |
---|
4760 | .q (pil_rw_g), |
---|
4761 | .clk (clk), |
---|
4762 | .se (se), |
---|
4763 | .si (), |
---|
4764 | .so () |
---|
4765 | ); |
---|
4766 | |
---|
4767 | dff_s dff_tpc_rw_w2 ( |
---|
4768 | .din (tpc_rw_g), |
---|
4769 | .q (tpc_rw_w2), |
---|
4770 | .clk (clk), |
---|
4771 | .se (se), |
---|
4772 | .si (), |
---|
4773 | .so () |
---|
4774 | ); |
---|
4775 | |
---|
4776 | dff_s dff_tnpc_rw_w2 ( |
---|
4777 | .din (tnpc_rw_g), |
---|
4778 | .q (tnpc_rw_w2), |
---|
4779 | .clk (clk), |
---|
4780 | .se (se), |
---|
4781 | .si (), |
---|
4782 | .so () |
---|
4783 | ); |
---|
4784 | |
---|
4785 | dff_s dff_tstate_rw_w2 ( |
---|
4786 | .din (tstate_rw_g), |
---|
4787 | .q (tstate_rw_w2), |
---|
4788 | .clk (clk), |
---|
4789 | .se (se), |
---|
4790 | .si (), |
---|
4791 | .so () |
---|
4792 | ); |
---|
4793 | |
---|
4794 | dff_s dff_ttype_rw_w2 ( |
---|
4795 | .din (ttype_rw_g), |
---|
4796 | .q (ttype_rw_w2), |
---|
4797 | .clk (clk), |
---|
4798 | .se (se), |
---|
4799 | .si (), |
---|
4800 | .so () |
---|
4801 | ); |
---|
4802 | |
---|
4803 | dff_s dff_htstate_rw_w2 ( |
---|
4804 | .din (tlu_htstate_rw_g), |
---|
4805 | .q (htstate_rw_w2), |
---|
4806 | .clk (clk), |
---|
4807 | .se (se), |
---|
4808 | .si (), |
---|
4809 | .so () |
---|
4810 | ); |
---|
4811 | |
---|
4812 | dff_s dff_set_sftint_g ( |
---|
4813 | .din (set_sftint_m), |
---|
4814 | .q (set_sftint_g), |
---|
4815 | .clk (clk), |
---|
4816 | .se (se), |
---|
4817 | .si (), |
---|
4818 | .so () |
---|
4819 | ); |
---|
4820 | |
---|
4821 | dff_s dff_clr_sftint_g ( |
---|
4822 | .din (clr_sftint_m), |
---|
4823 | .q (clr_sftint_g), |
---|
4824 | .clk (clk), |
---|
4825 | .se (se), |
---|
4826 | .si (), |
---|
4827 | .so () |
---|
4828 | ); |
---|
4829 | |
---|
4830 | dff_s dff_sftint_rg_rw_g ( |
---|
4831 | .din (sftint_rg_rw_m), |
---|
4832 | .q (sftint_rg_rw_g), |
---|
4833 | .clk (clk), |
---|
4834 | .se (se), |
---|
4835 | .si (), |
---|
4836 | .so () |
---|
4837 | ); |
---|
4838 | |
---|
4839 | dff_s dff_wsr_inst_g ( |
---|
4840 | .din (wsr_inst_m), |
---|
4841 | .q (wsr_inst_g_unflushed), |
---|
4842 | .clk (clk), |
---|
4843 | .se (se), |
---|
4844 | .si (), |
---|
4845 | .so () |
---|
4846 | ); |
---|
4847 | |
---|
4848 | dff_s dff_wsr_inst_w2 ( |
---|
4849 | .din (wsr_inst_g), |
---|
4850 | .q (wsr_inst_w2), |
---|
4851 | .clk (clk), |
---|
4852 | .se (se), |
---|
4853 | .si (), |
---|
4854 | .so () |
---|
4855 | ); |
---|
4856 | |
---|
4857 | dff_s dff_tlu_gl_rw_g ( |
---|
4858 | .din (tlu_gl_rw_m), |
---|
4859 | .q (tlu_gl_rw_g), |
---|
4860 | .clk (clk), |
---|
4861 | .se (se), |
---|
4862 | .si (), |
---|
4863 | .so () |
---|
4864 | ); |
---|
4865 | |
---|
4866 | // |
---|
4867 | // added for hypervisor support |
---|
4868 | dff_s dff_stickcmp_rw_g ( |
---|
4869 | .din (stickcmp_rw_m), |
---|
4870 | .q (stickcmp_rw_g), |
---|
4871 | .clk (clk), |
---|
4872 | .se (se), |
---|
4873 | .si (), |
---|
4874 | .so () |
---|
4875 | ); |
---|
4876 | // modified due to timing violations |
---|
4877 | // assign wsr_inst_g = wsr_inst_g_unflushed & ~tlu_ifu_flush_pipe_w & inst_vld_g; |
---|
4878 | assign wsr_inst_g = wsr_inst_g_unflushed & ~local_early_flush_pipe_w & inst_vld_g; |
---|
4879 | assign tlu_wsr_inst_nq_g = |
---|
4880 | wsr_inst_g_unflushed & ~local_early_flush_pipe_w & inst_vld_nf_g; |
---|
4881 | |
---|
4882 | |
---|
4883 | //========================================================================================= |
---|
4884 | // TICK/TICK-CMP RELATED |
---|
4885 | //========================================================================================= |
---|
4886 | |
---|
4887 | wire [1:0] tckctr; |
---|
4888 | wire [1:0] tckctr_in; |
---|
4889 | |
---|
4890 | // modified due to swapping in the incr64 soft macro |
---|
4891 | // assign tckctr_incr = tckctr + 1; |
---|
4892 | assign tckctr_in[1:0] = tlu_tckctr_in[1:0]; |
---|
4893 | assign tlu_incr_tick[1:0] = tckctr[1:0]; |
---|
4894 | |
---|
4895 | dffr_s #(2) dffr_tckctr_cnt ( |
---|
4896 | .din (tckctr_in[1:0]), |
---|
4897 | .q (tckctr[1:0]), |
---|
4898 | .rst (local_rst | ~tlu_tick_en_l), |
---|
4899 | .clk (clk), |
---|
4900 | .se (se), |
---|
4901 | .si (), |
---|
4902 | .so () |
---|
4903 | ); |
---|
4904 | |
---|
4905 | // 3rd cycle, increment tick reg. |
---|
4906 | // assign tlu_incr_tick = tckctr[1] & tckctr[0]; |
---|
4907 | |
---|
4908 | assign tlu_tickcmp_sel[0] = ~tckctr[1] & ~tckctr[0]; |
---|
4909 | assign tlu_tickcmp_sel[1] = ~tckctr[1] & tckctr[0]; |
---|
4910 | assign tlu_tickcmp_sel[2] = tckctr[1] & ~tckctr[0]; |
---|
4911 | assign tlu_tickcmp_sel[3] = tckctr[1] & tckctr[0]; |
---|
4912 | |
---|
4913 | // TICK.NPT |
---|
4914 | |
---|
4915 | // reset should not be needed in this equation !!! |
---|
4916 | assign tick_ctl_din = tlu_wsr_data_b63_w | local_rst | por_rstint_g; |
---|
4917 | assign tlu_tick_ctl_din = tick_ctl_din; |
---|
4918 | |
---|
4919 | dffe_s dffe_npt0 ( |
---|
4920 | .din (tick_ctl_din), |
---|
4921 | .q (tick_npt0), |
---|
4922 | .en (tick_en[0]), |
---|
4923 | .clk (clk), |
---|
4924 | .se (se), |
---|
4925 | .si (), |
---|
4926 | .so () |
---|
4927 | ); |
---|
4928 | |
---|
4929 | dffe_s dffe_npt1 ( |
---|
4930 | .din (tick_ctl_din), |
---|
4931 | .q (tick_npt1), |
---|
4932 | .en (tick_en[1]), |
---|
4933 | .clk (clk), |
---|
4934 | .se (se), |
---|
4935 | .si (), |
---|
4936 | .so () |
---|
4937 | ); |
---|
4938 | |
---|
4939 | dffe_s dffe_npt2 ( |
---|
4940 | .din (tick_ctl_din), |
---|
4941 | .q (tick_npt2), |
---|
4942 | .en (tick_en[2]), |
---|
4943 | .clk (clk), |
---|
4944 | .se (se), |
---|
4945 | .si (), |
---|
4946 | .so () |
---|
4947 | ); |
---|
4948 | |
---|
4949 | dffe_s dffe_npt3 ( |
---|
4950 | .din (tick_ctl_din), |
---|
4951 | .q (tick_npt3), |
---|
4952 | .en (tick_en[3]), |
---|
4953 | .clk (clk), |
---|
4954 | .se (se), |
---|
4955 | .si (), |
---|
4956 | .so () |
---|
4957 | ); |
---|
4958 | |
---|
4959 | assign tlu_tick_npt = |
---|
4960 | (thread0_rsel_e & tick_npt0) | |
---|
4961 | (thread1_rsel_e & tick_npt1) | |
---|
4962 | (thread2_rsel_e & tick_npt2) | |
---|
4963 | (thread3_rsel_e & tick_npt3); |
---|
4964 | |
---|
4965 | assign tick_npt_priv_act_g = |
---|
4966 | (tick_npriv_r_g & ~ifu_ttype_vld_tmp_g) & |
---|
4967 | ((tick_npt0 & thread0_rsel_g & tlu_none_priv[0]) | |
---|
4968 | (tick_npt1 & thread1_rsel_g & tlu_none_priv[1]) | |
---|
4969 | (tick_npt2 & thread2_rsel_g & tlu_none_priv[2]) | |
---|
4970 | (tick_npt3 & thread3_rsel_g & tlu_none_priv[3])); |
---|
4971 | // |
---|
4972 | // added for timing fix |
---|
4973 | assign tick_npt_priv_act_m = |
---|
4974 | (tick_npriv_r_m & ~ifu_ttype_vld_m) & |
---|
4975 | ((tick_npt0 & thread0_rsel_m & tlu_none_priv[0]) | |
---|
4976 | (tick_npt1 & thread1_rsel_m & tlu_none_priv[1]) | |
---|
4977 | (tick_npt2 & thread2_rsel_m & tlu_none_priv[2]) | |
---|
4978 | (tick_npt3 & thread3_rsel_m & tlu_none_priv[3])); |
---|
4979 | |
---|
4980 | assign exu_tick_npt_priv_act_m = |
---|
4981 | tick_npriv_r_m & |
---|
4982 | ((tick_npt0 & thread0_stg_m_buf & tlu_none_priv[0]) | |
---|
4983 | (tick_npt1 & thread1_stg_m_buf & tlu_none_priv[1]) | |
---|
4984 | (tick_npt2 & thread2_stg_m_buf & tlu_none_priv[2]) | |
---|
4985 | (tick_npt3 & thread3_stg_m_buf & tlu_none_priv[3])); |
---|
4986 | |
---|
4987 | //========================================================================================= |
---|
4988 | // Soft Interrupt Control |
---|
4989 | //========================================================================================= |
---|
4990 | |
---|
4991 | wire [1:0] sftintctr; |
---|
4992 | wire [1:0] sftintctr_incr; |
---|
4993 | |
---|
4994 | assign sftintctr_incr[1:0] = sftintctr[1:0] + 2'b01; |
---|
4995 | |
---|
4996 | dffr_s #(2) dffr_sftint_cnt ( |
---|
4997 | .din (sftintctr_incr[1:0]), |
---|
4998 | .q (sftintctr[1:0]), |
---|
4999 | .rst (local_rst), |
---|
5000 | .clk (clk), |
---|
5001 | .se (se), |
---|
5002 | .si (), |
---|
5003 | .so () |
---|
5004 | ); |
---|
5005 | // |
---|
5006 | // modified for bug 4626 and 5117 |
---|
5007 | /* |
---|
5008 | assign swint_nq_g = swint_g; |
---|
5009 | assign swint_thrd_g[0]= swint_nq_g & thread0_rsel_g & tlu_int_pstate_ie[0]; |
---|
5010 | assign swint_thrd_g[1]= swint_nq_g & thread1_rsel_g & tlu_int_pstate_ie[1]; |
---|
5011 | assign swint_thrd_g[2]= swint_nq_g & thread2_rsel_g & tlu_int_pstate_ie[2]; |
---|
5012 | // assign swint_thrd_g[3]= swint_nq_g & thread3_rsel_g & tlu_int_pstate_ie[3]; |
---|
5013 | */ |
---|
5014 | |
---|
5015 | assign sftint_user_update_g = |
---|
5016 | clr_sftint_g | sftint_rg_rw_g; |
---|
5017 | |
---|
5018 | dffr_s dffr_sftint_user_update_w2 ( |
---|
5019 | .din (sftint_user_update_g), |
---|
5020 | .q (sftint_user_update_w2), |
---|
5021 | .clk (clk), |
---|
5022 | .rst (local_rst), |
---|
5023 | .se (se), |
---|
5024 | .si (), |
---|
5025 | .so () |
---|
5026 | ); |
---|
5027 | |
---|
5028 | assign penc_sel_user_update = sftint_user_update_w2 & ~swint_g; |
---|
5029 | |
---|
5030 | assign sftint_penc_update = sftint_user_update_w2 | swint_g; |
---|
5031 | |
---|
5032 | assign sftint_penc_thrd[0]= |
---|
5033 | (swint_g & thread0_rsel_g) | (penc_sel_user_update & thread0_wsel_w2); |
---|
5034 | assign sftint_penc_thrd[1]= |
---|
5035 | (swint_g & thread1_rsel_g) | (penc_sel_user_update & thread1_wsel_w2); |
---|
5036 | assign sftint_penc_thrd[2]= |
---|
5037 | (swint_g & thread2_rsel_g) | (penc_sel_user_update & thread2_wsel_w2); |
---|
5038 | |
---|
5039 | assign tlu_sftint_penc_sel[0] = |
---|
5040 | ((~sftintctr[1] & ~sftintctr[0] & ~sftint_penc_update) | |
---|
5041 | sftint_penc_thrd[0]) & ~rst_tri_en; |
---|
5042 | assign tlu_sftint_penc_sel[1] = |
---|
5043 | ((~sftintctr[1] & sftintctr[0] & ~sftint_penc_update) | |
---|
5044 | sftint_penc_thrd[1]) & ~rst_tri_en; |
---|
5045 | assign tlu_sftint_penc_sel[2] = |
---|
5046 | (( sftintctr[1] & ~sftintctr[0] & ~sftint_penc_update) | |
---|
5047 | sftint_penc_thrd[2]) & ~rst_tri_en; |
---|
5048 | // |
---|
5049 | // added for bug 5117 |
---|
5050 | |
---|
5051 | assign sftint_wait_rst[0] = |
---|
5052 | sftint_pend_wait[0] & tlu_sftint_penc_sel[0]; |
---|
5053 | assign sftint_wait_rst[1] = |
---|
5054 | sftint_pend_wait[1] & tlu_sftint_penc_sel[1]; |
---|
5055 | assign sftint_wait_rst[2] = |
---|
5056 | sftint_pend_wait[2] & tlu_sftint_penc_sel[2]; |
---|
5057 | assign sftint_wait_rst[3] = |
---|
5058 | sftint_pend_wait[3] & tlu_sftint_penc_sel[3]; |
---|
5059 | |
---|
5060 | dffr_s dffr_sftint_pend_wait_0 ( |
---|
5061 | .din (sftint_user_update_g & thread0_rsel_dec_g), |
---|
5062 | .q (sftint_pend_wait[0]), |
---|
5063 | .clk (clk), |
---|
5064 | .rst (local_rst | sftint_wait_rst[0]), |
---|
5065 | .se (se), |
---|
5066 | .si (), |
---|
5067 | .so () |
---|
5068 | ); |
---|
5069 | dffr_s dffr_sftint_pend_wait_1 ( |
---|
5070 | .din (sftint_user_update_g & thread1_rsel_dec_g), |
---|
5071 | .q (sftint_pend_wait[1]), |
---|
5072 | .clk (clk), |
---|
5073 | .rst (local_rst | sftint_wait_rst[1]), |
---|
5074 | .se (se), |
---|
5075 | .si (), |
---|
5076 | .so () |
---|
5077 | ); |
---|
5078 | |
---|
5079 | dffr_s dffr_sftint_pend_wait_2 ( |
---|
5080 | .din (sftint_user_update_g & thread2_rsel_dec_g), |
---|
5081 | .q (sftint_pend_wait[2]), |
---|
5082 | .clk (clk), |
---|
5083 | .rst (local_rst | sftint_wait_rst[2]), |
---|
5084 | .se (se), |
---|
5085 | .si (), |
---|
5086 | .so () |
---|
5087 | ); |
---|
5088 | |
---|
5089 | dffr_s dffr_sftint_pend_wait_3 ( |
---|
5090 | .din (sftint_user_update_g & thread3_rsel_dec_g), |
---|
5091 | .q (sftint_pend_wait[3]), |
---|
5092 | .clk (clk), |
---|
5093 | .rst (local_rst | sftint_wait_rst[3]), |
---|
5094 | .se (se), |
---|
5095 | .si (), |
---|
5096 | .so () |
---|
5097 | ); |
---|
5098 | /* |
---|
5099 | assign tlu_sftint_penc_sel[0] = |
---|
5100 | (~sftintctr[1] & ~sftintctr[0] & ~swint_nq_g) | swint_thrd_g[0]; |
---|
5101 | assign tlu_sftint_penc_sel[1] = |
---|
5102 | (~sftintctr[1] & sftintctr[0] & ~swint_nq_g) | swint_thrd_g[1]; |
---|
5103 | assign tlu_sftint_penc_sel[2] = |
---|
5104 | ( sftintctr[1] & ~sftintctr[0] & ~swint_nq_g) | swint_thrd_g[2]; |
---|
5105 | // |
---|
5106 | */ |
---|
5107 | // |
---|
5108 | // modified for one-hot problem |
---|
5109 | assign tlu_sftint_penc_sel[3] = |
---|
5110 | ~(|tlu_sftint_penc_sel[2:0]); |
---|
5111 | // assign tlu_sftint_penc_sel[3] = |
---|
5112 | // ( sftintctr[1] & sftintctr[0] & ~swint_nq_g) | swint_thrd_g[3]; |
---|
5113 | /* |
---|
5114 | assign tlu_sftint_penc_sel[0] = ~sftintctr[1] & ~sftintctr[0]; |
---|
5115 | assign tlu_sftint_penc_sel[1] = ~sftintctr[1] & sftintctr[0]; |
---|
5116 | assign tlu_sftint_penc_sel[2] = sftintctr[1] & ~sftintctr[0]; |
---|
5117 | assign tlu_sftint_penc_sel[3] = sftintctr[1] & sftintctr[0]; |
---|
5118 | */ |
---|
5119 | |
---|
5120 | // Flop sftint values on a per thread basis. |
---|
5121 | dffe_s #(4) dffe_sftint_id0 ( |
---|
5122 | .din (tlu_sftint_id[3:0]), |
---|
5123 | .q (sftint0_id[3:0]), |
---|
5124 | .en (tlu_sftint_penc_sel[0]), |
---|
5125 | .clk (clk), |
---|
5126 | .se (se), |
---|
5127 | .si (), |
---|
5128 | .so () |
---|
5129 | ); |
---|
5130 | |
---|
5131 | dffe_s #(4) dffe_sftint_id1 ( |
---|
5132 | .din (tlu_sftint_id[3:0]), |
---|
5133 | .q (sftint1_id[3:0]), |
---|
5134 | .en (tlu_sftint_penc_sel[1]), |
---|
5135 | .clk (clk), |
---|
5136 | .se (se), |
---|
5137 | .si (), |
---|
5138 | .so () |
---|
5139 | ); |
---|
5140 | |
---|
5141 | dffe_s #(4) dffe_sftint_id2 ( |
---|
5142 | .din (tlu_sftint_id[3:0]), |
---|
5143 | .q (sftint2_id[3:0]), |
---|
5144 | .en (tlu_sftint_penc_sel[2]), |
---|
5145 | .clk (clk), |
---|
5146 | .se (se), |
---|
5147 | .si (), |
---|
5148 | .so () |
---|
5149 | ); |
---|
5150 | |
---|
5151 | dffe_s #(4) dffe_sftint_id3 ( |
---|
5152 | .din (tlu_sftint_id[3:0]), |
---|
5153 | .q (sftint3_id[3:0]), |
---|
5154 | .en (tlu_sftint_penc_sel[3]), |
---|
5155 | .clk (clk), |
---|
5156 | .se (se), |
---|
5157 | .si (), |
---|
5158 | .so () |
---|
5159 | ); |
---|
5160 | |
---|
5161 | // Soft Int Control |
---|
5162 | // modified to fix one-hot problem |
---|
5163 | assign tlu_set_sftint_l_g = ~(set_sftint_g) | rst_tri_en; |
---|
5164 | assign tlu_clr_sftint_l_g = ~(clr_sftint_g) | rst_tri_en; |
---|
5165 | assign tlu_wr_sftint_l_g = ~(sftint_rg_rw_g) | rst_tri_en; |
---|
5166 | // modified for timing |
---|
5167 | /* |
---|
5168 | assign tlu_set_sftint_l_g = ~(set_sftint_g & wsr_inst_g); |
---|
5169 | assign tlu_clr_sftint_l_g = ~(clr_sftint_g & wsr_inst_g); |
---|
5170 | assign tlu_wr_sftint_l_g = ~(sftint_rg_rw_g & wsr_inst_g); |
---|
5171 | */ |
---|
5172 | |
---|
5173 | // modified for pib support |
---|
5174 | // |
---|
5175 | assign tlu_sftint_en_l_g[0] = |
---|
5176 | ~((set_sftint_g | clr_sftint_g | sftint_rg_rw_g) & |
---|
5177 | wsr_inst_g & thread0_rsel_dec_g) & tlu_rst_l; |
---|
5178 | assign tlu_sftint_en_l_g[1] = |
---|
5179 | ~((set_sftint_g | clr_sftint_g | sftint_rg_rw_g) & |
---|
5180 | wsr_inst_g & thread1_rsel_dec_g) & tlu_rst_l; |
---|
5181 | assign tlu_sftint_en_l_g[2] = |
---|
5182 | ~((set_sftint_g | clr_sftint_g | sftint_rg_rw_g) & |
---|
5183 | wsr_inst_g & thread2_rsel_dec_g) & tlu_rst_l; |
---|
5184 | assign tlu_sftint_en_l_g[3] = |
---|
5185 | ~((set_sftint_g | clr_sftint_g | sftint_rg_rw_g) & |
---|
5186 | wsr_inst_g & thread3_rsel_dec_g) & tlu_rst_l; |
---|
5187 | |
---|
5188 | // added for one-hot mux bug |
---|
5189 | // modified for timing |
---|
5190 | assign tlu_sftint_mx_sel[0] = |
---|
5191 | ~(|tlu_sftint_mx_sel[3:1]); |
---|
5192 | assign tlu_sftint_mx_sel[1] = |
---|
5193 | (set_sftint_g | clr_sftint_g | sftint_rg_rw_g) & |
---|
5194 | thread1_rsel_dec_g & ~rst_tri_en; |
---|
5195 | assign tlu_sftint_mx_sel[2] = |
---|
5196 | (set_sftint_g | clr_sftint_g | sftint_rg_rw_g) & |
---|
5197 | thread2_rsel_dec_g & ~rst_tri_en; |
---|
5198 | assign tlu_sftint_mx_sel[3] = |
---|
5199 | (set_sftint_g | clr_sftint_g | sftint_rg_rw_g) & |
---|
5200 | thread3_rsel_dec_g & ~rst_tri_en; |
---|
5201 | // |
---|
5202 | // determine whether there is a pending sftint interrupt for each thread |
---|
5203 | // |
---|
5204 | assign tlu_int_sftint_pend[0] = |(sftint0_id[3:0]) & ~sftint_pend_wait[0]; |
---|
5205 | assign tlu_int_sftint_pend[1] = |(sftint1_id[3:0]) & ~sftint_pend_wait[1]; |
---|
5206 | assign tlu_int_sftint_pend[2] = |(sftint2_id[3:0]) & ~sftint_pend_wait[2]; |
---|
5207 | assign tlu_int_sftint_pend[3] = |(sftint3_id[3:0]) & ~sftint_pend_wait[3]; |
---|
5208 | |
---|
5209 | // if there is no existing sft interrupt, then sftint_id = 0, and vld would never be asserted. |
---|
5210 | // this is why a 15b vector has been encoded as a 16b vector. |
---|
5211 | // modified for hypervisor support |
---|
5212 | |
---|
5213 | // fix for bug 7027 |
---|
5214 | /* |
---|
5215 | assign sftint_only_vld[0] = (tlu_int_sftint_pend[0]) ? |
---|
5216 | (sftint0_id[3:0] > true_pil0[3:0]) & pil_cmp_en[0] : 1'b0; |
---|
5217 | assign sftint_only_vld[1] = (tlu_int_sftint_pend[1]) ? |
---|
5218 | (sftint1_id[3:0] > true_pil1[3:0]) & pil_cmp_en[1] : 1'b0; |
---|
5219 | assign sftint_only_vld[2] = (tlu_int_sftint_pend[2]) ? |
---|
5220 | (sftint2_id[3:0] > true_pil2[3:0]) & pil_cmp_en[2] : 1'b0; |
---|
5221 | assign sftint_only_vld[3] = (tlu_int_sftint_pend[3]) ? |
---|
5222 | (sftint3_id[3:0] > true_pil3[3:0]) & pil_cmp_en[3] : 1'b0; |
---|
5223 | */ |
---|
5224 | |
---|
5225 | assign sftint_only_vld[0] = (tlu_int_sftint_pend[0]) ? |
---|
5226 | (sftint0_id[3:0] > true_pil0[3:0]) : 1'b0; |
---|
5227 | assign sftint_only_vld[1] = (tlu_int_sftint_pend[1]) ? |
---|
5228 | (sftint1_id[3:0] > true_pil1[3:0]) : 1'b0; |
---|
5229 | assign sftint_only_vld[2] = (tlu_int_sftint_pend[2]) ? |
---|
5230 | (sftint2_id[3:0] > true_pil2[3:0]) : 1'b0; |
---|
5231 | assign sftint_only_vld[3] = (tlu_int_sftint_pend[3]) ? |
---|
5232 | (sftint3_id[3:0] > true_pil3[3:0]) : 1'b0; |
---|
5233 | |
---|
5234 | |
---|
5235 | // swint |
---|
5236 | // removed the qualification of the tlu_int_pstate_ie - otherwise, IFU might never wakeup |
---|
5237 | // after the thread has been suspended. |
---|
5238 | // |
---|
5239 | // modified for timing |
---|
5240 | assign tlu_sftint_vld[0] = |
---|
5241 | (tlu_cpu_mondo_trap[0] | tlu_dev_mondo_trap[0] | sftint_only_vld[0]); |
---|
5242 | assign tlu_sftint_vld[1] = |
---|
5243 | (tlu_cpu_mondo_trap[1] | tlu_dev_mondo_trap[1] | sftint_only_vld[1]); |
---|
5244 | assign tlu_sftint_vld[2] = |
---|
5245 | (tlu_cpu_mondo_trap[2] | tlu_dev_mondo_trap[2] | sftint_only_vld[2]); |
---|
5246 | assign tlu_sftint_vld[3] = |
---|
5247 | (tlu_cpu_mondo_trap[3] | tlu_dev_mondo_trap[3] | sftint_only_vld[3]); |
---|
5248 | // |
---|
5249 | // added for hypervisor support |
---|
5250 | // htick_match traps |
---|
5251 | |
---|
5252 | // fix for bug 7027 |
---|
5253 | /* |
---|
5254 | assign tlu_hintp_vld[0] = |
---|
5255 | tlu_hintp[0] & (~tlu_hpstate_priv[0] | |
---|
5256 | (tlu_hpstate_priv[0] & tlu_int_pstate_ie[0])); |
---|
5257 | assign tlu_hintp_vld[1] = |
---|
5258 | tlu_hintp[1] & (~tlu_hpstate_priv[1] | |
---|
5259 | (tlu_hpstate_priv[1] & tlu_int_pstate_ie[1])); |
---|
5260 | assign tlu_hintp_vld[2] = |
---|
5261 | tlu_hintp[2] & (~tlu_hpstate_priv[2] | |
---|
5262 | (tlu_hpstate_priv[2] & tlu_int_pstate_ie[2])); |
---|
5263 | assign tlu_hintp_vld[3] = |
---|
5264 | tlu_hintp[3] & (~tlu_hpstate_priv[3] | |
---|
5265 | (tlu_hpstate_priv[3] & tlu_int_pstate_ie[3])); |
---|
5266 | */ |
---|
5267 | |
---|
5268 | assign tlu_hintp_vld[0] = tlu_hintp[0]; |
---|
5269 | assign tlu_hintp_vld[1] = tlu_hintp[1]; |
---|
5270 | assign tlu_hintp_vld[2] = tlu_hintp[2]; |
---|
5271 | assign tlu_hintp_vld[3] = tlu_hintp[3]; |
---|
5272 | |
---|
5273 | |
---|
5274 | // |
---|
5275 | // resum_err traps |
---|
5276 | // modified for timing |
---|
5277 | |
---|
5278 | // fix for bug 7027 |
---|
5279 | /* |
---|
5280 | assign tlu_rerr_vld[0] = tlu_resum_err_trap[0] & tlu_int_pstate_ie[0]; |
---|
5281 | assign tlu_rerr_vld[1] = tlu_resum_err_trap[1] & tlu_int_pstate_ie[1]; |
---|
5282 | assign tlu_rerr_vld[2] = tlu_resum_err_trap[2] & tlu_int_pstate_ie[2]; |
---|
5283 | assign tlu_rerr_vld[3] = tlu_resum_err_trap[3] & tlu_int_pstate_ie[3]; |
---|
5284 | */ |
---|
5285 | assign tlu_rerr_vld[0] = tlu_resum_err_trap[0]; |
---|
5286 | assign tlu_rerr_vld[1] = tlu_resum_err_trap[1]; |
---|
5287 | assign tlu_rerr_vld[2] = tlu_resum_err_trap[2]; |
---|
5288 | assign tlu_rerr_vld[3] = tlu_resum_err_trap[3]; |
---|
5289 | |
---|
5290 | |
---|
5291 | assign pil_cmp_en[0] = |
---|
5292 | ~(tlu_hpstate_priv[0] & tlu_hpstate_enb[0]); |
---|
5293 | assign pil_cmp_en[1] = |
---|
5294 | ~(tlu_hpstate_priv[1] & tlu_hpstate_enb[1]); |
---|
5295 | assign pil_cmp_en[2] = |
---|
5296 | ~(tlu_hpstate_priv[2] & tlu_hpstate_enb[2]); |
---|
5297 | assign pil_cmp_en[3] = |
---|
5298 | ~(tlu_hpstate_priv[3] & tlu_hpstate_enb[3]); |
---|
5299 | |
---|
5300 | // TLU.TICK_INT - The tick and stick interrupt logic has been moved to tlu_tdp |
---|
5301 | // the interrupt will be report back to tlu_tcl via the softint settings |
---|
5302 | /* |
---|
5303 | assign wsr_tick_intclr_g = (tlu_clr_sftint_l_g | ~tlu_wsr_data_w[0]) & (tlu_wr_sftint_l_g | tlu_wsr_data_w[0]); |
---|
5304 | assign wsr_tick_intset_g = ~(tlu_set_sftint_l_g & tlu_wr_sftint_l_g) & tlu_wsr_data_w[0]; |
---|
5305 | // |
---|
5306 | // added for hypervisor suppor for tlu_stck_int |
---|
5307 | assign wsr_stick_intclr_g = (tlu_clr_sftint_l_g | ~tlu_wsr_data_b16_w) & (tlu_wr_sftint_l_g | tlu_wsr_data_b16_w); |
---|
5308 | assign wsr_stick_intset_g = ~(tlu_set_sftint_l_g & tlu_wr_sftint_l_g) & tlu_wsr_data_b16_w; |
---|
5309 | */ |
---|
5310 | // The following code has been moved to tlu_tdp |
---|
5311 | /* |
---|
5312 | assign tick_intclr[0] = tlu_tick_int[0] & wsr_tick_intclr_g; |
---|
5313 | assign tick_intclr[1] = tlu_tick_int[1] & wsr_tick_intclr_g; |
---|
5314 | assign tick_intclr[2] = tlu_tick_int[2] & wsr_tick_intclr_g; |
---|
5315 | assign tick_intclr[3] = tlu_tick_int[3] & wsr_tick_intclr_g; |
---|
5316 | // |
---|
5317 | assign tickcmp_int[0] = tlu_tick_match & ~tick_intdis0 & tlu_tickcmp_sel[0]; |
---|
5318 | assign tickcmp_int[1] = tlu_tick_match & ~tick_intdis1 & tlu_tickcmp_sel[1]; |
---|
5319 | assign tickcmp_int[2] = tlu_tick_match & ~tick_intdis2 & tlu_tickcmp_sel[2]; |
---|
5320 | assign tickcmp_int[3] = tlu_tick_match & ~tick_intdis3 & tlu_tickcmp_sel[3]; |
---|
5321 | |
---|
5322 | assign tick_intrpt[0] = tickcmp_int[0] | tick_intclr[0]; |
---|
5323 | assign tick_intrpt[1] = tickcmp_int[1] | tick_intclr[1]; |
---|
5324 | assign tick_intrpt[2] = tickcmp_int[2] | tick_intclr[2]; |
---|
5325 | assign tick_intrpt[3] = tickcmp_int[3] | tick_intclr[3]; |
---|
5326 | |
---|
5327 | // modified for bug 1022 |
---|
5328 | // qualified tlu_set_sftint with wsr_data_w[0] |
---|
5329 | // |
---|
5330 | assign tick_int_en[0] = ~tlu_sftint_en_l_g[0] | tick_intrpt[0]; |
---|
5331 | assign tick_int_din[0] = (tick_intrpt[0] | wsr_tick_intset_g) ? 1'b1 : 1'b0; |
---|
5332 | |
---|
5333 | assign tick_int_en[1] = ~tlu_sftint_en_l_g[1] | tick_intrpt[1]; |
---|
5334 | assign tick_int_din[1] = (tick_intrpt[1] | wsr_tick_intset_g) ? 1'b1 : 1'b0; |
---|
5335 | |
---|
5336 | assign tick_int_en[2] = ~tlu_sftint_en_l_g[2] | tick_intrpt[2]; |
---|
5337 | assign tick_int_din[2] = (tick_intrpt[2] | wsr_tick_intset_g) ? 1'b1 : 1'b0; |
---|
5338 | |
---|
5339 | assign tick_int_en[3] = ~tlu_sftint_en_l_g[3] | tick_intrpt[3]; |
---|
5340 | assign tick_int_din[3] = (tick_intrpt[3] | wsr_tick_intset_g) ? 1'b1 : 1'b0; |
---|
5341 | // |
---|
5342 | // recoded tlu_tick_int for bug 818 |
---|
5343 | dffre_s dffre_tick_int0 ( |
---|
5344 | .din (tick_int_din[0]), |
---|
5345 | .q (tlu_tick_int[0]), |
---|
5346 | .rst (local_rst), |
---|
5347 | .en (tick_int_en[0]), |
---|
5348 | .clk (clk), |
---|
5349 | .se (se), |
---|
5350 | .si (), |
---|
5351 | .so () |
---|
5352 | ); |
---|
5353 | // |
---|
5354 | // recoded tlu_tick_int for bug 818 |
---|
5355 | dffre_s dffre_tick_int1 ( |
---|
5356 | .din (tick_int_din[1]), |
---|
5357 | .q (tlu_tick_int[1]), |
---|
5358 | .rst (local_rst), |
---|
5359 | .en (tick_int_en[1]), |
---|
5360 | .clk (clk), |
---|
5361 | .se (se), |
---|
5362 | .si (), |
---|
5363 | .so () |
---|
5364 | ); |
---|
5365 | // recoded tlu_tick_int for bug 818 |
---|
5366 | // |
---|
5367 | dffre_s dffre_tick_int2 ( |
---|
5368 | .din (tick_int_din[2]), |
---|
5369 | .q (tlu_tick_int[2]), |
---|
5370 | .rst (local_rst), |
---|
5371 | .en (tick_int_en[2]), |
---|
5372 | .clk (clk), |
---|
5373 | .se (se), |
---|
5374 | .si (), |
---|
5375 | .so () |
---|
5376 | ); |
---|
5377 | // |
---|
5378 | // recoded tlu_tick_int for bug 818 |
---|
5379 | dffre_s dffre_tick_int3 ( |
---|
5380 | .din (tick_int_din[3]), |
---|
5381 | .q (tlu_tick_int[3]), |
---|
5382 | .rst (local_rst), |
---|
5383 | .en (tick_int_en[3]), |
---|
5384 | .clk (clk), |
---|
5385 | .se (se), |
---|
5386 | .si (), |
---|
5387 | .so () |
---|
5388 | ); |
---|
5389 | */ |
---|
5390 | // |
---|
5391 | // added and/or modified for hypervisor support |
---|
5392 | // the following logic has been moved to tlu_tdp |
---|
5393 | /* |
---|
5394 | assign stick_intclr[0] = tlu_stick_int[0] & wsr_stick_intclr_g; |
---|
5395 | assign stick_intclr[1] = tlu_stick_int[1] & wsr_stick_intclr_g; |
---|
5396 | assign stick_intclr[2] = tlu_stick_int[2] & wsr_stick_intclr_g; |
---|
5397 | assign stick_intclr[3] = tlu_stick_int[3] & wsr_stick_intclr_g; |
---|
5398 | // |
---|
5399 | assign stickcmp_int[0] = tlu_stick_match & ~stick_intdis0 & tlu_tickcmp_sel[0]; |
---|
5400 | assign stickcmp_int[1] = tlu_stick_match & ~stick_intdis1 & tlu_tickcmp_sel[1]; |
---|
5401 | assign stickcmp_int[2] = tlu_stick_match & ~stick_intdis2 & tlu_tickcmp_sel[2]; |
---|
5402 | assign stickcmp_int[3] = tlu_stick_match & ~stick_intdis3 & tlu_tickcmp_sel[3]; |
---|
5403 | // |
---|
5404 | assign stick_intrpt[0] = stickcmp_int[0] | stick_intclr[0]; |
---|
5405 | assign stick_intrpt[1] = stickcmp_int[1] | stick_intclr[1]; |
---|
5406 | assign stick_intrpt[2] = stickcmp_int[2] | stick_intclr[2]; |
---|
5407 | assign stick_intrpt[3] = stickcmp_int[3] | stick_intclr[3]; |
---|
5408 | // |
---|
5409 | // modified for bug 1022 |
---|
5410 | // qualified tlu_set_sftint with wsr_data_w[16] |
---|
5411 | // |
---|
5412 | assign stick_int_en[0] = ~tlu_sftint_en_l_g[0] | stick_intrpt[0]; |
---|
5413 | assign stick_int_din[0] = (stick_intrpt[0] | wsr_stick_intset_g) ? 1'b1 : 1'b0; |
---|
5414 | |
---|
5415 | assign stick_int_en[1] = ~tlu_sftint_en_l_g[1] | stick_intrpt[1]; |
---|
5416 | assign stick_int_din[1] = (stick_intrpt[1] | wsr_stick_intset_g) ? 1'b1 : 1'b0; |
---|
5417 | |
---|
5418 | assign stick_int_en[2] = ~tlu_sftint_en_l_g[2] | stick_intrpt[2]; |
---|
5419 | assign stick_int_din[2] = (stick_intrpt[2] | wsr_stick_intset_g) ? 1'b1 : 1'b0; |
---|
5420 | |
---|
5421 | assign stick_int_en[3] = ~tlu_sftint_en_l_g[3] | stick_intrpt[3]; |
---|
5422 | assign stick_int_din[3] = (stick_intrpt[3] | wsr_stick_intset_g) ? 1'b1 : 1'b0; |
---|
5423 | |
---|
5424 | // recoded tlu_tick_int for bug 818 |
---|
5425 | // |
---|
5426 | dffre_s dffre_stick_int0 ( |
---|
5427 | .din (stick_int_din[0]), |
---|
5428 | .q (tlu_stick_int[0]), |
---|
5429 | .rst (local_rst), |
---|
5430 | .en (stick_int_en[0]), |
---|
5431 | .clk (clk), |
---|
5432 | .se (se), |
---|
5433 | .si (), |
---|
5434 | .so () |
---|
5435 | ); |
---|
5436 | // |
---|
5437 | dffre_s dffre_stick_int1 ( |
---|
5438 | .din (stick_int_din[1]), |
---|
5439 | .q (tlu_stick_int[1]), |
---|
5440 | .rst (local_rst), |
---|
5441 | .en (stick_int_en[1]), |
---|
5442 | .clk (clk), |
---|
5443 | .se (se), |
---|
5444 | .si (), |
---|
5445 | .so () |
---|
5446 | ); |
---|
5447 | // |
---|
5448 | dffre_s dffre_stick_int2 ( |
---|
5449 | .din (stick_int_din[2]), |
---|
5450 | .q (tlu_stick_int[2]), |
---|
5451 | .rst (local_rst), |
---|
5452 | .en (stick_int_en[2]), |
---|
5453 | .clk (clk), |
---|
5454 | .se (se), |
---|
5455 | .si (), |
---|
5456 | .so () |
---|
5457 | ); |
---|
5458 | // |
---|
5459 | dffre_s dffre_stick_int3 ( |
---|
5460 | .din (stick_int_din[3]), |
---|
5461 | .q (tlu_stick_int[3]), |
---|
5462 | .rst (local_rst), |
---|
5463 | .en (stick_int_en[3]), |
---|
5464 | .clk (clk), |
---|
5465 | .se (se), |
---|
5466 | .si (), |
---|
5467 | .so () |
---|
5468 | ); |
---|
5469 | // modified for hypervisor support |
---|
5470 | // |
---|
5471 | assign tlu_sftint_lvl14_all[0] = |
---|
5472 | tlu_sftint_lvl14[0] | tlu_tick_int[0] | tlu_stick_int[0]; |
---|
5473 | assign tlu_sftint_lvl14_all[1] = |
---|
5474 | tlu_sftint_lvl14[1] | tlu_tick_int[1] | tlu_stick_int[1]; |
---|
5475 | assign tlu_sftint_lvl14_all[2] = |
---|
5476 | tlu_sftint_lvl14[2] | tlu_tick_int[2] | tlu_stick_int[2]; |
---|
5477 | assign tlu_sftint_lvl14_all[3] = |
---|
5478 | tlu_sftint_lvl14[3] | tlu_tick_int[3] | tlu_stick_int[3]; |
---|
5479 | // |
---|
5480 | assign tlu_sftint_lvl14_int[0] = tickcmp_int[0] | stickcmp_int[0]; |
---|
5481 | assign tlu_sftint_lvl14_int[1] = tickcmp_int[1] | stickcmp_int[1]; |
---|
5482 | assign tlu_sftint_lvl14_int[2] = tickcmp_int[2] | stickcmp_int[2]; |
---|
5483 | assign tlu_sftint_lvl14_int[3] = tickcmp_int[3] | stickcmp_int[3]; |
---|
5484 | */ |
---|
5485 | |
---|
5486 | //========================================================================================= |
---|
5487 | // PIL for Threads |
---|
5488 | //========================================================================================= |
---|
5489 | |
---|
5490 | assign pil0_en = pil_rw_g & wsr_inst_g & thread0_wsel_g; |
---|
5491 | assign pil1_en = pil_rw_g & wsr_inst_g & thread1_wsel_g; |
---|
5492 | assign pil2_en = pil_rw_g & wsr_inst_g & thread2_wsel_g; |
---|
5493 | assign pil3_en = pil_rw_g & wsr_inst_g & thread3_wsel_g; |
---|
5494 | |
---|
5495 | // THREAD 0 |
---|
5496 | dffe_s #(4) dffe_pil0 ( |
---|
5497 | .din (tlu_wsr_data_w[3:0]), |
---|
5498 | .q (true_pil0[3:0]), |
---|
5499 | .en (pil0_en), |
---|
5500 | .clk (clk), |
---|
5501 | .se (se), |
---|
5502 | .si (), |
---|
5503 | .so () |
---|
5504 | ); |
---|
5505 | // |
---|
5506 | // THREAD 1 |
---|
5507 | dffe_s #(4) dffe_pil1 ( |
---|
5508 | .din (tlu_wsr_data_w[3:0]), |
---|
5509 | .q (true_pil1[3:0]), |
---|
5510 | .en (pil1_en), |
---|
5511 | .clk (clk), |
---|
5512 | .se (se), |
---|
5513 | .si (), |
---|
5514 | .so () |
---|
5515 | ); |
---|
5516 | // |
---|
5517 | // THREAD 2 |
---|
5518 | dffe_s #(4) dffe_pil2 ( |
---|
5519 | .din (tlu_wsr_data_w[3:0]), |
---|
5520 | .q (true_pil2[3:0]), |
---|
5521 | .en (pil2_en), |
---|
5522 | .clk (clk), |
---|
5523 | .se (se), |
---|
5524 | .si (), |
---|
5525 | .so () |
---|
5526 | ); |
---|
5527 | // |
---|
5528 | // THREAD 3 |
---|
5529 | dffe_s #(4) dffe_pil3 ( |
---|
5530 | .din (tlu_wsr_data_w[3:0]), |
---|
5531 | .q (true_pil3[3:0]), |
---|
5532 | .en (pil3_en), |
---|
5533 | .clk (clk), |
---|
5534 | .se (se), |
---|
5535 | .si (), |
---|
5536 | .so () |
---|
5537 | ); |
---|
5538 | |
---|
5539 | //========================================================================================= |
---|
5540 | // TL for Threads |
---|
5541 | //========================================================================================= |
---|
5542 | // |
---|
5543 | dff_s dff_stgim_g ( |
---|
5544 | .din (ifu_tlu_immu_miss_m), |
---|
5545 | .q (immu_miss_g), |
---|
5546 | .clk (clk), |
---|
5547 | .se (se), |
---|
5548 | .si (), |
---|
5549 | .so () |
---|
5550 | ); |
---|
5551 | |
---|
5552 | // wrpr supplies new value else increment on trap. |
---|
5553 | // wrpr %tl when tl=0 will cause a trap. |
---|
5554 | // trap in MAXTL-1 enters RED_MODE. |
---|
5555 | // added for hypervisor support |
---|
5556 | // capped the tl value by supervisor write at MAXSTL |
---|
5557 | // |
---|
5558 | assign maxstl_wr_sel[0] = |
---|
5559 | ~tlu_hyper_lite[0] & (tlu_wsr_data_w[2:0] > `MAXSTL); |
---|
5560 | assign maxstl_wr_sel[1] = |
---|
5561 | ~tlu_hyper_lite[1] & (tlu_wsr_data_w[2:0] > `MAXSTL); |
---|
5562 | assign maxstl_wr_sel[2] = |
---|
5563 | ~tlu_hyper_lite[2] & (tlu_wsr_data_w[2:0] > `MAXSTL); |
---|
5564 | assign maxstl_wr_sel[3] = |
---|
5565 | ~tlu_hyper_lite[3] & (tlu_wsr_data_w[2:0] > `MAXSTL); |
---|
5566 | |
---|
5567 | assign maxtl_wr_sel = (tlu_wsr_data_w[2:0] == 3'b111); |
---|
5568 | |
---|
5569 | // THREAD0 |
---|
5570 | // Use to signal page fault for now. |
---|
5571 | // sync_trap_taken_g already qualified with inst_vld_g. |
---|
5572 | // long-latency sparc traps have to be killed in own pipeline |
---|
5573 | // hwint interrupts are qualified elsewhere |
---|
5574 | // modified due to timing |
---|
5575 | // modified for bug 4561 |
---|
5576 | assign thrd0_traps = |
---|
5577 | (sync_trap_taken_g & thread0_rsel_g) | |
---|
5578 | (pending_trap_sel[0] & ~(dnrtry_inst_g | tsa_wr_tid_sel_g | |
---|
5579 | ifu_thrd_flush_w[0] | cwp_cmplt0_pending | sync_trap_taken_g | |
---|
5580 | (tlu_gl_rw_g & wsr_inst_g))); |
---|
5581 | // |
---|
5582 | // trap level will get updated next cycle. |
---|
5583 | dff_s #(1) dff_stgw2_0 ( |
---|
5584 | .din (thrd0_traps), |
---|
5585 | .q (thrd0_traps_w2), |
---|
5586 | .clk (clk), |
---|
5587 | .se (se), |
---|
5588 | .si (), |
---|
5589 | .so () |
---|
5590 | ); |
---|
5591 | |
---|
5592 | assign tlu_thrd_traps_w2[0] = thrd0_traps_w2; |
---|
5593 | |
---|
5594 | assign trp_lvl0_at_maxtl = (trp_lvl0[2:0] == `MAXTL); |
---|
5595 | assign trp_lvl0_at_maxtlless1 = (trp_lvl0[2:0] == `MAXTL_LESSONE); |
---|
5596 | // |
---|
5597 | // added for modified for hypervisor support |
---|
5598 | assign trp_lvl_at_maxstl[0] = (trp_lvl0[2:0] == `MAXSTL); |
---|
5599 | assign trp_lvl_gte_maxstl[0] = (trp_lvl0[2:0] > `MAXSTL) | trp_lvl_at_maxstl[0]; |
---|
5600 | assign wsr_trp_lvl0_data_w[2:0] = |
---|
5601 | (maxstl_wr_sel[0])? `MAXSTL_TL: |
---|
5602 | ((maxtl_wr_sel)? `MAXTL: tlu_wsr_data_w[2:0]); |
---|
5603 | // |
---|
5604 | // added for timing |
---|
5605 | dff_s #(3) dff_wsr_trp_lvl0_data_w2 ( |
---|
5606 | .din (wsr_trp_lvl0_data_w[2:0]), |
---|
5607 | .q (wsr_trp_lvl0_data_w2[2:0]), |
---|
5608 | .clk (clk), |
---|
5609 | .se (se), |
---|
5610 | .si (), |
---|
5611 | .so () |
---|
5612 | ); |
---|
5613 | |
---|
5614 | //========================================================================================= |
---|
5615 | // The following section has been recoded due to timing |
---|
5616 | //========================================================================================= |
---|
5617 | // trap level to be incremented if thread not at MAXTL and not in redmode |
---|
5618 | assign trp_lvl0_incr_w2 = thrd0_traps_w2 & ~trp_lvl0_at_maxtl; |
---|
5619 | |
---|
5620 | assign trp_lvl0_new[2:0] = |
---|
5621 | (tl_rw_w2 & wsr_inst_w2 & thread0_wsel_w2) ? |
---|
5622 | wsr_trp_lvl0_data_w2[2:0] : |
---|
5623 | (local_rst | por_rstint0_w2) ? `MAXTL : |
---|
5624 | (dnrtry_inst_w2[0]) ? |
---|
5625 | trp_lvl0[2:0] - 3'b001:// done/retry decrements |
---|
5626 | trp_lvl0[2:0] + {2'b00,trp_lvl0_incr_w2};// trap increments |
---|
5627 | assign tl0_en = |
---|
5628 | (tl_rw_w2 & wsr_inst_w2 & thread0_wsel_w2) | |
---|
5629 | trp_lvl0_incr_w2| local_rst | por_rstint0_w2 | |
---|
5630 | dnrtry_inst_w2[0]; |
---|
5631 | |
---|
5632 | // Reset required as processor will start out at tl0 after reset. |
---|
5633 | // tl has to be correctly defined for all conditions !!! |
---|
5634 | dffe_s #(3) dffe_tl0 ( |
---|
5635 | .din (trp_lvl0_new[2:0]), |
---|
5636 | .q (trp_lvl0[2:0]), |
---|
5637 | .en (tl0_en), |
---|
5638 | .clk (clk), |
---|
5639 | .se (se), |
---|
5640 | .si (), |
---|
5641 | .so () |
---|
5642 | ); |
---|
5643 | assign tlu_lsu_tl_zero[0] = ~trp_lvl0[2] & ~trp_lvl0[1] & ~trp_lvl0[0]; |
---|
5644 | assign tl0_gt_0 = trp_lvl0[2] | trp_lvl0[1] | trp_lvl0[0]; |
---|
5645 | // |
---|
5646 | // THREAD1 |
---|
5647 | // Use to signal page fault for now. |
---|
5648 | // sync_trap_taken_g already qualified with inst_vld_g. |
---|
5649 | // long-latency sparc traps have to be killed in own pipeline |
---|
5650 | // hwint interrupts are qualified elsewhere |
---|
5651 | // modified due to timing |
---|
5652 | assign thrd1_traps = |
---|
5653 | (sync_trap_taken_g & thread1_rsel_g ) | |
---|
5654 | (pending_trap_sel[1] & ~(dnrtry_inst_g | tsa_wr_tid_sel_g | |
---|
5655 | ifu_thrd_flush_w[1] | cwp_cmplt1_pending | sync_trap_taken_g | |
---|
5656 | (tlu_gl_rw_g & wsr_inst_g))); |
---|
5657 | // |
---|
5658 | // trap level will get updated next cycle. |
---|
5659 | dff_s #(1) dff_stgw2_1 ( |
---|
5660 | .din (thrd1_traps), |
---|
5661 | .q (thrd1_traps_w2), |
---|
5662 | .clk (clk), |
---|
5663 | .se (se), |
---|
5664 | .si (), |
---|
5665 | .so () |
---|
5666 | ); |
---|
5667 | |
---|
5668 | assign tlu_thrd_traps_w2[1] = thrd1_traps_w2; |
---|
5669 | |
---|
5670 | assign trp_lvl1_at_maxtl = (trp_lvl1[2:0] == `MAXTL); |
---|
5671 | assign trp_lvl1_at_maxtlless1 = (trp_lvl1[2:0] == `MAXTL_LESSONE); |
---|
5672 | // |
---|
5673 | // added for modified for hypervisor support |
---|
5674 | assign trp_lvl_at_maxstl[1] = (trp_lvl1[2:0] == `MAXSTL); |
---|
5675 | assign trp_lvl_gte_maxstl[1] = (trp_lvl1[2:0] > `MAXSTL) | trp_lvl_at_maxstl[1]; |
---|
5676 | assign wsr_trp_lvl1_data_w[2:0] = |
---|
5677 | (maxstl_wr_sel[1])? `MAXSTL_TL: |
---|
5678 | ((maxtl_wr_sel)? `MAXTL: tlu_wsr_data_w[2:0]); |
---|
5679 | // |
---|
5680 | // added for timing |
---|
5681 | dff_s #(3) dff_wsr_trp_lvl1_data_w2 ( |
---|
5682 | .din (wsr_trp_lvl1_data_w[2:0]), |
---|
5683 | .q (wsr_trp_lvl1_data_w2[2:0]), |
---|
5684 | .clk (clk), |
---|
5685 | .se (se), |
---|
5686 | .si (), |
---|
5687 | .so () |
---|
5688 | ); |
---|
5689 | |
---|
5690 | //========================================================================================= |
---|
5691 | // The following section has been recoded due to timing |
---|
5692 | //========================================================================================= |
---|
5693 | // trap level to be incremented if thread not at MAXTL and not in redmode |
---|
5694 | assign trp_lvl1_incr_w2 = thrd1_traps_w2 & ~trp_lvl1_at_maxtl; |
---|
5695 | |
---|
5696 | assign trp_lvl1_new[2:0] = |
---|
5697 | (tl_rw_w2 & wsr_inst_w2 & thread1_wsel_w2) ? |
---|
5698 | wsr_trp_lvl1_data_w2[2:0] : |
---|
5699 | (local_rst | por_rstint1_w2) ? `MAXTL : |
---|
5700 | (dnrtry_inst_w2[1]) ? |
---|
5701 | trp_lvl1[2:0] - 3'b001:// done/retry decrements |
---|
5702 | trp_lvl1[2:0] + {2'b00,trp_lvl1_incr_w2};// trap increments |
---|
5703 | assign tl1_en = |
---|
5704 | (tl_rw_w2 & wsr_inst_w2 & thread1_wsel_w2) | |
---|
5705 | trp_lvl1_incr_w2| local_rst | por_rstint1_w2 | |
---|
5706 | dnrtry_inst_w2[1]; |
---|
5707 | |
---|
5708 | // Reset required as processor will start out at tl1 after reset. |
---|
5709 | // tl has to be correctly defined for all conditions !!! |
---|
5710 | dffe_s #(3) dffe_tl1 ( |
---|
5711 | .din (trp_lvl1_new[2:0]), |
---|
5712 | .q (trp_lvl1[2:0]), |
---|
5713 | .en (tl1_en), |
---|
5714 | .clk (clk), |
---|
5715 | .se (se), |
---|
5716 | .si (), |
---|
5717 | .so () |
---|
5718 | ); |
---|
5719 | assign tlu_lsu_tl_zero[1] = ~trp_lvl1[2] & ~trp_lvl1[1] & ~trp_lvl1[0]; |
---|
5720 | assign tl1_gt_0 = trp_lvl1[2] | trp_lvl1[1] | trp_lvl1[0]; |
---|
5721 | // |
---|
5722 | // THREAD2 |
---|
5723 | // Use to signal page fault for now. |
---|
5724 | // sync_trap_taken_g already qualified with inst_vld_g. |
---|
5725 | // long-latency sparc traps have to be killed in own pipeline |
---|
5726 | // hwint interrupts are qualified elsewhere |
---|
5727 | // modified due to timing |
---|
5728 | // modified for bug 3827 |
---|
5729 | assign thrd2_traps = |
---|
5730 | (sync_trap_taken_g & thread2_rsel_g) | |
---|
5731 | (pending_trap_sel[2] & ~(dnrtry_inst_g | tsa_wr_tid_sel_g | |
---|
5732 | ifu_thrd_flush_w[2] | cwp_cmplt2_pending | sync_trap_taken_g | |
---|
5733 | (tlu_gl_rw_g & wsr_inst_g))); |
---|
5734 | |
---|
5735 | // trap level will get updated next cycle. |
---|
5736 | dff_s #(1) dff_stgw2_2 ( |
---|
5737 | .din (thrd2_traps), |
---|
5738 | .q (thrd2_traps_w2), |
---|
5739 | .clk (clk), |
---|
5740 | .se (se), |
---|
5741 | .si (), |
---|
5742 | .so () |
---|
5743 | ); |
---|
5744 | |
---|
5745 | assign tlu_thrd_traps_w2[2] = thrd2_traps_w2; |
---|
5746 | |
---|
5747 | assign trp_lvl2_at_maxtl = (trp_lvl2[2:0] == `MAXTL); |
---|
5748 | assign trp_lvl2_at_maxtlless1 = (trp_lvl2[2:0] == `MAXTL_LESSONE); |
---|
5749 | // |
---|
5750 | // added or modified for hypervisor support |
---|
5751 | assign trp_lvl_at_maxstl[2] = (trp_lvl2[2:0] == `MAXSTL); |
---|
5752 | assign trp_lvl_gte_maxstl[2] = (trp_lvl2[2:0] > `MAXSTL) | trp_lvl_at_maxstl[2]; |
---|
5753 | assign wsr_trp_lvl2_data_w[2:0] = |
---|
5754 | (maxstl_wr_sel[2])? `MAXSTL_TL: |
---|
5755 | ((maxtl_wr_sel)? `MAXTL: tlu_wsr_data_w[2:0]); |
---|
5756 | // |
---|
5757 | // added for timing |
---|
5758 | dff_s #(3) dff_wsr_trp_lvl2_data_w2 ( |
---|
5759 | .din (wsr_trp_lvl2_data_w[2:0]), |
---|
5760 | .q (wsr_trp_lvl2_data_w2[2:0]), |
---|
5761 | .clk (clk), |
---|
5762 | .se (se), |
---|
5763 | .si (), |
---|
5764 | .so () |
---|
5765 | ); |
---|
5766 | |
---|
5767 | //========================================================================================= |
---|
5768 | // The following section has been recoded due to timing |
---|
5769 | //========================================================================================= |
---|
5770 | // trap level to be incremented if thread not at MAXTL and not in redmode |
---|
5771 | assign trp_lvl2_incr_w2 = thrd2_traps_w2 & ~trp_lvl2_at_maxtl; |
---|
5772 | |
---|
5773 | assign trp_lvl2_new[2:0] = |
---|
5774 | (tl_rw_w2 & wsr_inst_w2 & thread2_wsel_w2) ? |
---|
5775 | wsr_trp_lvl2_data_w2[2:0] : |
---|
5776 | (local_rst | por_rstint2_w2) ? `MAXTL : |
---|
5777 | (dnrtry_inst_w2[2]) ? |
---|
5778 | trp_lvl2[2:0] - 3'b001:// done/retry decrements |
---|
5779 | trp_lvl2[2:0] + {2'b00,trp_lvl2_incr_w2};// trap increments |
---|
5780 | assign tl2_en = |
---|
5781 | (tl_rw_w2 & wsr_inst_w2 & thread2_wsel_w2) | |
---|
5782 | trp_lvl2_incr_w2| local_rst | por_rstint2_w2 | |
---|
5783 | dnrtry_inst_w2[2]; |
---|
5784 | |
---|
5785 | // Reset required as processor will start out at tl1 after reset. |
---|
5786 | // tl has to be correctly defined for all conditions !!! |
---|
5787 | dffe_s #(3) dffe_tl2 ( |
---|
5788 | .din (trp_lvl2_new[2:0]), |
---|
5789 | .q (trp_lvl2[2:0]), |
---|
5790 | .en (tl2_en), |
---|
5791 | .clk (clk), |
---|
5792 | .se (se), |
---|
5793 | .si (), |
---|
5794 | .so () |
---|
5795 | ); |
---|
5796 | assign tlu_lsu_tl_zero[2] = ~trp_lvl2[2] & ~trp_lvl2[1] & ~trp_lvl2[0]; |
---|
5797 | assign tl2_gt_0 = trp_lvl2[2] | trp_lvl2[1] | trp_lvl2[0]; |
---|
5798 | // |
---|
5799 | // THREAD3 |
---|
5800 | // Use to signal page fault for now. |
---|
5801 | // sync_trap_taken_g already qualified with inst_vld_g. |
---|
5802 | // long-latency sparc traps have to be killed in own pipeline |
---|
5803 | // hwint interrupts are qualified elsewhere |
---|
5804 | // modified due to timing |
---|
5805 | assign thrd3_traps = |
---|
5806 | (sync_trap_taken_g & thread3_rsel_g) | |
---|
5807 | (pending_trap_sel[3] & ~(dnrtry_inst_g | tsa_wr_tid_sel_g | |
---|
5808 | ifu_thrd_flush_w[3] | cwp_cmplt3_pending | sync_trap_taken_g | |
---|
5809 | (tlu_gl_rw_g & wsr_inst_g))); |
---|
5810 | |
---|
5811 | // trap level will get updated next cycle. |
---|
5812 | dff_s #(1) dff_stgw2_3 ( |
---|
5813 | .din (thrd3_traps), |
---|
5814 | .q (thrd3_traps_w2), |
---|
5815 | .clk (clk), |
---|
5816 | .se (se), |
---|
5817 | .si (), |
---|
5818 | .so () |
---|
5819 | ); |
---|
5820 | |
---|
5821 | assign tlu_thrd_traps_w2[3] = thrd3_traps_w2; |
---|
5822 | |
---|
5823 | assign trp_lvl3_at_maxtl = (trp_lvl3[2:0] == `MAXTL); |
---|
5824 | assign trp_lvl3_at_maxtlless1 = (trp_lvl3[2:0] == `MAXTL_LESSONE); |
---|
5825 | // |
---|
5826 | // added for modified for hypervisor support |
---|
5827 | assign trp_lvl_at_maxstl[3] = (trp_lvl3[2:0] == `MAXSTL); |
---|
5828 | assign trp_lvl_gte_maxstl[3] = (trp_lvl3[2:0] > `MAXSTL) | trp_lvl_at_maxstl[3]; |
---|
5829 | assign wsr_trp_lvl3_data_w[2:0] = |
---|
5830 | (maxstl_wr_sel[3])? `MAXSTL_TL: |
---|
5831 | ((maxtl_wr_sel)? `MAXTL: tlu_wsr_data_w[2:0]); |
---|
5832 | // |
---|
5833 | // added for timing |
---|
5834 | dff_s #(3) dff_wsr_trp_lvl3_data_w2 ( |
---|
5835 | .din (wsr_trp_lvl3_data_w[2:0]), |
---|
5836 | .q (wsr_trp_lvl3_data_w2[2:0]), |
---|
5837 | .clk (clk), |
---|
5838 | .se (se), |
---|
5839 | .si (), |
---|
5840 | .so () |
---|
5841 | ); |
---|
5842 | |
---|
5843 | //========================================================================================= |
---|
5844 | // The following section has been recoded due to timing |
---|
5845 | //========================================================================================= |
---|
5846 | // trap level to be incremented if thread not at MAXTL and not in redmode |
---|
5847 | assign trp_lvl3_incr_w2 = thrd3_traps_w2 & ~trp_lvl3_at_maxtl; |
---|
5848 | |
---|
5849 | assign trp_lvl3_new[2:0] = |
---|
5850 | (tl_rw_w2 & wsr_inst_w2 & thread3_wsel_w2) ? |
---|
5851 | wsr_trp_lvl3_data_w2[2:0] : |
---|
5852 | (local_rst | por_rstint3_w2) ? `MAXTL : |
---|
5853 | (dnrtry_inst_w2[3]) ? |
---|
5854 | trp_lvl3[2:0] - 3'b001:// done/retry decrements |
---|
5855 | trp_lvl3[2:0] + {2'b00,trp_lvl3_incr_w2};// trap increments |
---|
5856 | |
---|
5857 | assign tl3_en = |
---|
5858 | (tl_rw_w2 & wsr_inst_w2 & thread3_wsel_w2) | |
---|
5859 | trp_lvl3_incr_w2| local_rst | por_rstint3_w2 | |
---|
5860 | dnrtry_inst_w2[3]; |
---|
5861 | |
---|
5862 | // Reset required as processor will start out at tl1 after reset. |
---|
5863 | dffe_s #(3) dffe_tl3 ( |
---|
5864 | .din (trp_lvl3_new[2:0]), |
---|
5865 | .q (trp_lvl3[2:0]), |
---|
5866 | .en (tl3_en), |
---|
5867 | .clk (clk), |
---|
5868 | .se (se), |
---|
5869 | .si (), |
---|
5870 | .so () |
---|
5871 | ); |
---|
5872 | assign tlu_lsu_tl_zero[3] = ~trp_lvl3[2] & ~trp_lvl3[1] & ~trp_lvl3[0]; |
---|
5873 | assign tl3_gt_0 = trp_lvl3[2] | trp_lvl3[1] | trp_lvl3[0]; |
---|
5874 | // |
---|
5875 | // added for hypervisor support - TLZ trap |
---|
5876 | // detection of transition of trap-level from <> 0 to 0 |
---|
5877 | // modified for bug 3192 |
---|
5878 | |
---|
5879 | assign tlz_thread_set[0] = ~(tlu_lsu_tl_zero[0] | (|(trp_lvl0_new[2:0]))) & tl0_en; |
---|
5880 | assign tlz_thread_set[1] = ~(tlu_lsu_tl_zero[1] | (|(trp_lvl1_new[2:0]))) & tl1_en; |
---|
5881 | assign tlz_thread_set[2] = ~(tlu_lsu_tl_zero[2] | (|(trp_lvl2_new[2:0]))) & tl2_en; |
---|
5882 | assign tlz_thread_set[3] = ~(tlu_lsu_tl_zero[3] | (|(trp_lvl3_new[2:0]))) & tl3_en; |
---|
5883 | |
---|
5884 | dff_s #(`TLU_THRD_NUM) dff_tlz_thread_data ( |
---|
5885 | .din (tlz_thread_set[`TLU_THRD_NUM-1:0]), |
---|
5886 | .q (tlz_thread_data[`TLU_THRD_NUM-1:0]), |
---|
5887 | .clk (clk), |
---|
5888 | .se (se), |
---|
5889 | .si (), |
---|
5890 | .so () |
---|
5891 | ); |
---|
5892 | |
---|
5893 | // |
---|
5894 | // storing the state of the tlz trap to take the trap on the next valid |
---|
5895 | // instruction |
---|
5896 | // modified for bug 3646 |
---|
5897 | dffre_s dffr_tlz_thread_0 ( |
---|
5898 | .din (tlz_thread_data[0]), |
---|
5899 | .q (tlz_thread[0]), |
---|
5900 | .rst (local_rst | tlz_trap_g[0] | thread_inst_vld_g[0]), |
---|
5901 | .en (tlz_thread_data[0] & tlu_hpstate_tlz[0]), |
---|
5902 | .clk (clk), |
---|
5903 | .se (se), |
---|
5904 | .si (), |
---|
5905 | .so () |
---|
5906 | ); |
---|
5907 | |
---|
5908 | dffre_s dffr_tlz_thread_1 ( |
---|
5909 | .din (tlz_thread_data[1]), |
---|
5910 | .q (tlz_thread[1]), |
---|
5911 | .rst (local_rst | tlz_trap_g[1] | thread_inst_vld_g[1]), |
---|
5912 | .en (tlz_thread_data[1] & tlu_hpstate_tlz[1]), |
---|
5913 | .clk (clk), |
---|
5914 | .se (se), |
---|
5915 | .si (), |
---|
5916 | .so () |
---|
5917 | ); |
---|
5918 | |
---|
5919 | dffre_s dffr_tlz_thread_2 ( |
---|
5920 | .din (tlz_thread_data[2]), |
---|
5921 | .q (tlz_thread[2]), |
---|
5922 | .rst (local_rst | tlz_trap_g[2] | thread_inst_vld_g[2]), |
---|
5923 | .en (tlz_thread_data[2] & tlu_hpstate_tlz[2]), |
---|
5924 | .clk (clk), |
---|
5925 | .se (se), |
---|
5926 | .si (), |
---|
5927 | .so () |
---|
5928 | ); |
---|
5929 | |
---|
5930 | dffre_s dffr_tlz_thread_3 ( |
---|
5931 | .din (tlz_thread_data[3]), |
---|
5932 | .q (tlz_thread[3]), |
---|
5933 | .rst (local_rst | tlz_trap_g[3] | thread_inst_vld_g[3]), |
---|
5934 | .en (tlz_thread_data[3] & tlu_hpstate_tlz[3]), |
---|
5935 | .clk (clk), |
---|
5936 | .se (se), |
---|
5937 | .si (), |
---|
5938 | .so () |
---|
5939 | ); |
---|
5940 | // |
---|
5941 | // initiate the trap for the appropriate thread |
---|
5942 | // modified for bug 4434 & 4758 |
---|
5943 | assign tlz_trap_m[0] = |
---|
5944 | ~ifu_rstint_m & |
---|
5945 | // ~(ifu_rstint_m | (ifu_hwint_m & tlu_int_pstate_ie[0])) & |
---|
5946 | inst_vld_m & tlu_lsu_tl_zero[0] & thread0_rsel_m & tlz_thread[0] & |
---|
5947 | ~tlu_hpstate_priv[0] & tlu_hpstate_tlz[0]; |
---|
5948 | assign tlz_trap_m[1] = |
---|
5949 | ~ifu_rstint_m & |
---|
5950 | // ~(ifu_rstint_m | (ifu_hwint_m & tlu_int_pstate_ie[1])) & |
---|
5951 | inst_vld_m & tlu_lsu_tl_zero[1] & thread1_rsel_m & tlz_thread[1] & |
---|
5952 | ~tlu_hpstate_priv[1] & tlu_hpstate_tlz[1]; |
---|
5953 | assign tlz_trap_m[2] = |
---|
5954 | ~ifu_rstint_m & |
---|
5955 | // ~(ifu_rstint_m | (ifu_hwint_m & tlu_int_pstate_ie[2])) & |
---|
5956 | inst_vld_m & tlu_lsu_tl_zero[2] & thread2_rsel_m & tlz_thread[2] & |
---|
5957 | ~tlu_hpstate_priv[2] & tlu_hpstate_tlz[2]; |
---|
5958 | assign tlz_trap_m[3] = |
---|
5959 | ~ifu_rstint_m & |
---|
5960 | // ~(ifu_rstint_m | (ifu_hwint_m & tlu_int_pstate_ie[3])) & |
---|
5961 | inst_vld_m & tlu_lsu_tl_zero[3] & thread3_rsel_m & tlz_thread[3] & |
---|
5962 | ~tlu_hpstate_priv[3] & tlu_hpstate_tlz[3]; |
---|
5963 | // |
---|
5964 | // added for timing - modifed to removed the qualification of the interrupts from |
---|
5965 | // IFU |
---|
5966 | assign tlz_exu_trap_m[0] = |
---|
5967 | tlu_lsu_tl_zero[0] & thread0_rsel_m & tlz_thread[0] & ~tlu_hpstate_priv[0] & |
---|
5968 | tlu_hpstate_tlz[0]; |
---|
5969 | assign tlz_exu_trap_m[1] = |
---|
5970 | tlu_lsu_tl_zero[1] & thread1_rsel_m & tlz_thread[1] & ~tlu_hpstate_priv[1] & |
---|
5971 | tlu_hpstate_tlz[1]; |
---|
5972 | assign tlz_exu_trap_m[2] = |
---|
5973 | tlu_lsu_tl_zero[2] & thread2_rsel_m & tlz_thread[2] & ~tlu_hpstate_priv[2] & |
---|
5974 | tlu_hpstate_tlz[2]; |
---|
5975 | assign tlz_exu_trap_m[3] = |
---|
5976 | tlu_lsu_tl_zero[3] & thread3_rsel_m & tlz_thread[3] & ~tlu_hpstate_priv[3] & |
---|
5977 | tlu_hpstate_tlz[3]; |
---|
5978 | // |
---|
5979 | // modified for bug 4862 |
---|
5980 | // indicate that a TLZ trap needs to be taken |
---|
5981 | dffr_s #(`TLU_THRD_NUM) dffr_tlz_trap_g ( |
---|
5982 | .din (tlz_trap_m[`TLU_THRD_NUM-1:0]), |
---|
5983 | .q (tlz_trap_nq_g[`TLU_THRD_NUM-1:0]), |
---|
5984 | .rst (local_rst), |
---|
5985 | .clk (clk), |
---|
5986 | .se (se), |
---|
5987 | .si (), |
---|
5988 | .so () |
---|
5989 | ); |
---|
5990 | |
---|
5991 | assign tlz_trap_g[0] = tlz_trap_nq_g[0] & ~inst_ifu_flush2_w; |
---|
5992 | assign tlz_trap_g[1] = tlz_trap_nq_g[1] & ~inst_ifu_flush2_w; |
---|
5993 | assign tlz_trap_g[2] = tlz_trap_nq_g[2] & ~inst_ifu_flush2_w; |
---|
5994 | assign tlz_trap_g[3] = tlz_trap_nq_g[3] & ~inst_ifu_flush2_w; |
---|
5995 | |
---|
5996 | //========================================================================================= |
---|
5997 | // EXCEPTION HANDLING |
---|
5998 | //========================================================================================= |
---|
5999 | // modified to test out timing - |
---|
6000 | /* |
---|
6001 | assign tlu_ifu_flush_pipe_w = |
---|
6002 | (thrd0_traps_flush | thrd1_traps_flush | thrd2_traps_flush | thrd3_traps_flush) & |
---|
6003 | inst_vld_g; |
---|
6004 | // |
---|
6005 | assign tlu_ifu_flush_pipe_w = |
---|
6006 | (dside_sync_trap_g & inst_vld_g) | local_early_flush_pipe_w; |
---|
6007 | */ |
---|
6008 | assign tlu_ifu_flush_pipe_w = |
---|
6009 | (early_dside_trap_g & inst_vld_g) | lsu_tlu_defr_trp_taken_g | |
---|
6010 | local_early_flush_pipe_w | lsu_ttype_vld_w; |
---|
6011 | // modified for bug 4561 |
---|
6012 | // (lsu_defr_trap_g & (thrid_g[1:0] == thrid_w2[1:0])) | |
---|
6013 | |
---|
6014 | // |
---|
6015 | // modified for timing fix |
---|
6016 | assign tlu_flush_all_w = |
---|
6017 | inst_ifu_flush_w | local_early_flush_pipe_w | |
---|
6018 | (lsu_tlu_early_flush_w & inst_vld_nf_g); |
---|
6019 | |
---|
6020 | |
---|
6021 | // staging the all flush signal |
---|
6022 | dffr_s dffr_tlu_flush_all_w2 ( |
---|
6023 | .din (tlu_flush_all_w), |
---|
6024 | .q (tlu_flush_all_w2), |
---|
6025 | .rst (local_rst), |
---|
6026 | .clk (clk), |
---|
6027 | .se (se), |
---|
6028 | .si (), |
---|
6029 | .so () |
---|
6030 | ); |
---|
6031 | // |
---|
6032 | // added for timing |
---|
6033 | assign lsu_ttype_vld_w = |
---|
6034 | lsu_tlu_ttype_vld_m2 & inst_vld_g; |
---|
6035 | // |
---|
6036 | // staging the flush-pipe signal |
---|
6037 | dffr_s dffr_lsu_ttype_vld_w2 ( |
---|
6038 | .din (lsu_ttype_vld_w), |
---|
6039 | .q (lsu_ttype_vld_w2), |
---|
6040 | .rst (local_rst), |
---|
6041 | .clk (clk), |
---|
6042 | .se (se), |
---|
6043 | .si (), |
---|
6044 | .so () |
---|
6045 | ); |
---|
6046 | |
---|
6047 | assign tlu_flush_pipe_w = tlu_ifu_flush_pipe_w; |
---|
6048 | // |
---|
6049 | // added for timing |
---|
6050 | assign tlu_full_flush_pipe_w2 = |
---|
6051 | lsu_ttype_vld_w2 | tlu_flush_all_w2; |
---|
6052 | |
---|
6053 | // added for early flush pipe timing fix |
---|
6054 | // assign tlu_early_flush_pipe_m = sync_trap_taken_m; |
---|
6055 | |
---|
6056 | assign tlu_local_flush_w = local_early_flush_pipe_w; |
---|
6057 | assign tlu_early_flush_pipe2_w = local_early_flush_pipe2_w; |
---|
6058 | assign tlu_exu_early_flush_pipe_w = local_early_flush_pipe3_w; |
---|
6059 | assign tlu_early_flush_pipe_w = local_early_flush_pipe4_w; |
---|
6060 | |
---|
6061 | // added local early flush pipe timing fix |
---|
6062 | |
---|
6063 | dffr_s dffr_local_early_flush_pipe_w ( |
---|
6064 | .din (sync_trap_taken_m), |
---|
6065 | .q (local_early_flush_pipe_w), |
---|
6066 | .rst (local_rst), |
---|
6067 | .clk (clk), |
---|
6068 | .se (se), |
---|
6069 | .si (), |
---|
6070 | .so () |
---|
6071 | ); |
---|
6072 | |
---|
6073 | dffr_s dffr_local_early_flush_pipe2_w ( |
---|
6074 | .din (sync_trap_taken_m), |
---|
6075 | .q (local_early_flush_pipe2_w), |
---|
6076 | .rst (local_rst), |
---|
6077 | .clk (clk), |
---|
6078 | .se (se), |
---|
6079 | .si (), |
---|
6080 | .so () |
---|
6081 | ); |
---|
6082 | |
---|
6083 | dffr_s dffr_local_early_flush_pipe3_w ( |
---|
6084 | .din (sync_trap_taken_m), |
---|
6085 | .q (local_early_flush_pipe3_w), |
---|
6086 | .rst (local_rst), |
---|
6087 | .clk (clk), |
---|
6088 | .se (se), |
---|
6089 | .si (), |
---|
6090 | .so () |
---|
6091 | ); |
---|
6092 | |
---|
6093 | dffr_s dffr_local_early_flush_pipe4_w ( |
---|
6094 | .din (sync_trap_taken_m), |
---|
6095 | .q (local_early_flush_pipe4_w), |
---|
6096 | .rst (local_rst), |
---|
6097 | .clk (clk), |
---|
6098 | .se (se), |
---|
6099 | .si (), |
---|
6100 | .so () |
---|
6101 | ); |
---|
6102 | |
---|
6103 | //========================================================================================= |
---|
6104 | // SFSR/SFAR HANDLING |
---|
6105 | //========================================================================================= |
---|
6106 | |
---|
6107 | assign thread_tl_zero = |
---|
6108 | thread0_rsel_e ? tlu_lsu_tl_zero[0] : |
---|
6109 | thread1_rsel_e ? tlu_lsu_tl_zero[1] : |
---|
6110 | thread2_rsel_e ? tlu_lsu_tl_zero[2] : tlu_lsu_tl_zero[3]; |
---|
6111 | |
---|
6112 | // Generate selects for ctxt to be written to tag_access |
---|
6113 | // iside trap meant to cover immu_miss and inst_access_excp |
---|
6114 | // modified for hypervisor support |
---|
6115 | // assign iside_trap = exu_tlu_ttype_vld_m | immu_va_oor_brnchetc_m | exu_tlu_va_oor_jl_ret_m; |
---|
6116 | // removed for timing |
---|
6117 | /* |
---|
6118 | assign iside_trap = |
---|
6119 | ifu_tlu_immu_miss_m | exu_tlu_ttype_vld_m | |
---|
6120 | immu_va_oor_brnchetc_m | exu_tlu_va_oor_jl_ret_m ; |
---|
6121 | |
---|
6122 | assign tlu_tag_access_ctxt_sel_m[0] = iside_trap & thread_tl_zero_m; |
---|
6123 | assign tlu_tag_access_ctxt_sel_m[1] = iside_trap & ~thread_tl_zero_m; |
---|
6124 | assign tlu_tag_access_ctxt_sel_m[2] = ~iside_trap; |
---|
6125 | */ |
---|
6126 | |
---|
6127 | // ISFSR |
---|
6128 | |
---|
6129 | // voor reported for both ifetch and memref - need to distinguish. |
---|
6130 | // va-out-of-range for ldst,branch,call,sequential |
---|
6131 | // modified for bug 4763 |
---|
6132 | // assign immu_va_oor_brnchetc_m |
---|
6133 | // = exu_tlu_va_oor_m & ~pstate_am & ~memref_m; |
---|
6134 | |
---|
6135 | dffr_s dffr_immu_va_oor_brnchetc_m ( |
---|
6136 | .din (ifu_tlu_pc_oor_e), |
---|
6137 | .q (immu_va_oor_brnchetc_m), |
---|
6138 | .rst (local_rst), |
---|
6139 | .clk (clk), |
---|
6140 | .se (se), |
---|
6141 | .si (), |
---|
6142 | .so () |
---|
6143 | ); |
---|
6144 | |
---|
6145 | dff_s dff_memref_e ( |
---|
6146 | .din (ifu_lsu_memref_d), |
---|
6147 | .q (memref_e), |
---|
6148 | .clk (clk), |
---|
6149 | .se (se), |
---|
6150 | .si (), |
---|
6151 | .so () |
---|
6152 | ); |
---|
6153 | |
---|
6154 | |
---|
6155 | dff_s dff_memref_m ( |
---|
6156 | .din (memref_e),// ifu_tlu_flsh_inst_e |
---|
6157 | .q (memref_m),// flsh_inst_m |
---|
6158 | .clk (clk), |
---|
6159 | .se (se), |
---|
6160 | .si (), |
---|
6161 | .so () |
---|
6162 | ); |
---|
6163 | |
---|
6164 | assign isfsr_flt_vld_m = |
---|
6165 | (thread0_rsel_m & tlu_isfsr_flt_vld[0]) | |
---|
6166 | (thread1_rsel_m & tlu_isfsr_flt_vld[1]) | |
---|
6167 | (thread2_rsel_m & tlu_isfsr_flt_vld[2]) | |
---|
6168 | (thread3_rsel_m & tlu_isfsr_flt_vld[3]); |
---|
6169 | |
---|
6170 | assign tlu_lsu_pstate_am[3:0] = tlu_pstate_am[3:0]; |
---|
6171 | |
---|
6172 | assign pstate_am = |
---|
6173 | (thread0_rsel_m & tlu_pstate_am[0]) | |
---|
6174 | (thread1_rsel_m & tlu_pstate_am[1]) | |
---|
6175 | (thread2_rsel_m & tlu_pstate_am[2]) | |
---|
6176 | (thread3_rsel_m & tlu_pstate_am[3]); |
---|
6177 | |
---|
6178 | dff_s #(1) dff_am_stgg ( |
---|
6179 | .din (pstate_am), |
---|
6180 | .q (tlu_addr_msk_g), |
---|
6181 | .clk (clk), |
---|
6182 | .se (se), |
---|
6183 | .si (), |
---|
6184 | .so () |
---|
6185 | ); |
---|
6186 | // |
---|
6187 | // logic moved to lsu_expctl due to timing |
---|
6188 | /* |
---|
6189 | assign pstate_priv = |
---|
6190 | (thread0_rsel_m & tlu_pstate_priv[0]) | |
---|
6191 | (thread1_rsel_m & tlu_pstate_priv[1]) | |
---|
6192 | (thread2_rsel_m & tlu_pstate_priv[2]) | |
---|
6193 | (thread3_rsel_m & tlu_pstate_priv[3]); |
---|
6194 | */ |
---|
6195 | |
---|
6196 | |
---|
6197 | assign trp_lvl_zero = |
---|
6198 | (thread0_rsel_g & tlu_lsu_tl_zero[0]) | |
---|
6199 | (thread1_rsel_g & tlu_lsu_tl_zero[1]) | |
---|
6200 | (thread2_rsel_g & tlu_lsu_tl_zero[2]) | |
---|
6201 | (thread3_rsel_g & tlu_lsu_tl_zero[3]); |
---|
6202 | |
---|
6203 | assign isfsr_ftype_sel[0] = ifu_tlu_priv_violtn_m; |
---|
6204 | // The 2 out of range exceptions are mutex as they are based on inst type. |
---|
6205 | assign isfsr_ftype_sel[1] = ~isfsr_ftype_sel[0] & immu_va_oor_brnchetc_m; |
---|
6206 | // modified for bug 4452 |
---|
6207 | assign isfsr_ftype_sel[2] = |
---|
6208 | ~isfsr_ftype_sel[0] & exu_tlu_va_oor_jl_ret_m & |
---|
6209 | ~(exu_tlu_ttype_vld_m | ifu_tlu_ttype_vld_m) & ~pstate_am; |
---|
6210 | |
---|
6211 | assign isfsr_trp_wr_m = |isfsr_ftype_sel[2:0]; |
---|
6212 | |
---|
6213 | dff_s #(1) dff_isfsrw_stgg ( |
---|
6214 | .din (isfsr_trp_wr_m), |
---|
6215 | .q (isfsr_trp_wr_g), |
---|
6216 | .clk (clk), |
---|
6217 | .se (se), |
---|
6218 | .si (), |
---|
6219 | .so () |
---|
6220 | ); |
---|
6221 | |
---|
6222 | dff_s #(1) dff_itag_acc_sel_g ( |
---|
6223 | .din (isfsr_trp_wr_m | ifu_tlu_immu_miss_m), |
---|
6224 | .q (itag_acc_sel_g), |
---|
6225 | .clk (clk), |
---|
6226 | .se (se), |
---|
6227 | .si (), |
---|
6228 | .so () |
---|
6229 | ); |
---|
6230 | |
---|
6231 | assign tlu_itag_acc_sel_g = itag_acc_sel_g; |
---|
6232 | |
---|
6233 | // terms below can be made common. (grape) |
---|
6234 | // recoded for timing - flush qualification moved to mmu_ctl |
---|
6235 | assign immu_sfsr_trp_wr[0] = |
---|
6236 | isfsr_trp_wr_g & inst_vld_nf_g & thread0_rsel_g; |
---|
6237 | assign immu_sfsr_trp_wr[1] = |
---|
6238 | isfsr_trp_wr_g & inst_vld_nf_g & thread1_rsel_g; |
---|
6239 | assign immu_sfsr_trp_wr[2] = |
---|
6240 | isfsr_trp_wr_g & inst_vld_nf_g & thread2_rsel_g; |
---|
6241 | assign immu_sfsr_trp_wr[3] = |
---|
6242 | isfsr_trp_wr_g & inst_vld_nf_g & thread3_rsel_g; |
---|
6243 | |
---|
6244 | assign isfsr_ftype_m[6] = isfsr_ftype_sel[2]; |
---|
6245 | assign isfsr_ftype_m[5] = isfsr_ftype_sel[1]; |
---|
6246 | assign isfsr_ftype_m[4:1] = 4'b0000; |
---|
6247 | assign isfsr_ftype_m[0] = isfsr_ftype_sel[0]; |
---|
6248 | // |
---|
6249 | // modified due to timing |
---|
6250 | dff_s #(8) dff_isfsr_stgg ( |
---|
6251 | .din ({isfsr_ftype_m[6:0],isfsr_flt_vld_m}), // pstate_priv, |
---|
6252 | .q ({isfsr_ftype_g[6:0],isfsr_flt_vld_g}), // pstate_priv_g, |
---|
6253 | .clk (clk), |
---|
6254 | .se (se), |
---|
6255 | .si (), |
---|
6256 | .so () |
---|
6257 | ); |
---|
6258 | |
---|
6259 | // Can we remove the excessive bits in isfsr ? |
---|
6260 | // Do jmpl/rtrn define the asi in i or dsfsr ? seems only jmpl_rtrn mem_addr_not_aligned |
---|
6261 | // traps set the asi and that too in the dsfsr |
---|
6262 | // Need to add ctxt !!! |
---|
6263 | |
---|
6264 | assign isfsr_ctxt_g[1:0] = |
---|
6265 | trp_lvl_zero ? 2'b00 : 2'b10; |
---|
6266 | |
---|
6267 | dff_s #(1) dff_thread_tl_zero_m ( |
---|
6268 | .din (thread_tl_zero), |
---|
6269 | .q (thread_tl_zero_m), |
---|
6270 | .clk (clk), |
---|
6271 | .se (se), |
---|
6272 | .si (), |
---|
6273 | .so () |
---|
6274 | ); |
---|
6275 | |
---|
6276 | dff_s #(1) dff_thread_tl_zero_g ( |
---|
6277 | .din (thread_tl_zero_m), |
---|
6278 | .q (thread_tl_zero_g), |
---|
6279 | .clk (clk), |
---|
6280 | .se (se), |
---|
6281 | .si (), |
---|
6282 | .so () |
---|
6283 | ); |
---|
6284 | |
---|
6285 | assign isfsr_asi_g[7:0] = |
---|
6286 | thread_tl_zero_g ? 8'h80 : 8'h04; |
---|
6287 | // |
---|
6288 | // modified for bug 3323 |
---|
6289 | assign tlu_isfsr_din_g[23:0] = |
---|
6290 | {isfsr_asi_g[7:0],2'b0,isfsr_ftype_g[6:0],1'b0,isfsr_ctxt_g[1:0],2'b0,isfsr_flt_vld_g,1'b1}; |
---|
6291 | |
---|
6292 | assign dmmu_va_oor_m = exu_tlu_va_oor_m & ~pstate_am & memref_m & ~lsu_tlu_squash_va_oor_m; |
---|
6293 | |
---|
6294 | dff_s #(3) dff_dsfsr_stgg ( |
---|
6295 | .din ({dmmu_va_oor_m,// memref_m, |
---|
6296 | exu_tlu_misalign_addr_jmpl_rtn_m, |
---|
6297 | lsu_tlu_misalign_addr_ldst_atm_m}), |
---|
6298 | .q ({dmmu_va_oor_g, |
---|
6299 | misalign_addr_jmpl_rtn_g, |
---|
6300 | misalign_addr_ldst_atm_g}), |
---|
6301 | .clk (clk), |
---|
6302 | .se (se), |
---|
6303 | .si (), |
---|
6304 | .so () |
---|
6305 | ); |
---|
6306 | |
---|
6307 | //========================================================================================= |
---|
6308 | // GLOBAL REGISTER SWITCHING |
---|
6309 | //========================================================================================= |
---|
6310 | // modified for bug 3827 |
---|
6311 | // |
---|
6312 | assign agp_tid_sel = |
---|
6313 | (dnrtry_inst_g) | (tlu_gl_rw_g & wsr_inst_g); |
---|
6314 | assign agp_tid_g[1:0] = |
---|
6315 | agp_tid_sel ? thrid_g[1:0] : trap_tid_g[1:0]; |
---|
6316 | |
---|
6317 | dff_s #(2) dff_tlu_agp_tid_w2 ( |
---|
6318 | .din (agp_tid_g[1:0]), |
---|
6319 | .q (agp_tid_w2[1:0]), |
---|
6320 | .clk (clk), |
---|
6321 | .se (se), |
---|
6322 | .si (), |
---|
6323 | .so () |
---|
6324 | ); |
---|
6325 | // |
---|
6326 | // added for timing |
---|
6327 | dff_s #(2) dff_agp_tid_w3 ( |
---|
6328 | .din (agp_tid_w2[1:0]), |
---|
6329 | .q (agp_tid_w3[1:0]), |
---|
6330 | .clk (clk), |
---|
6331 | .se (se), |
---|
6332 | .si (), |
---|
6333 | .so () |
---|
6334 | ); |
---|
6335 | |
---|
6336 | assign tlu_agp_tid_w2[1:0] = agp_tid_w2[1:0]; |
---|
6337 | assign tlu_exu_agp_tid[1:0] = agp_tid_w3[1:0]; |
---|
6338 | |
---|
6339 | //========================================================================================= |
---|
6340 | // CWP/CCR restoration |
---|
6341 | //========================================================================================= |
---|
6342 | // code moved to tlu_misctl |
---|
6343 | /* |
---|
6344 | dff_s #(8) dff_ccr_stgm ( |
---|
6345 | .din (tsa_rdata_ccr[7:0]), |
---|
6346 | .q (tlu_exu_ccr_m[7:0]), |
---|
6347 | .clk (clk), |
---|
6348 | .se (se), |
---|
6349 | .si (), |
---|
6350 | .so () |
---|
6351 | ); |
---|
6352 | |
---|
6353 | dff_s #(3) dff_cwp_stgm ( |
---|
6354 | .din (tsa_rdata_cwp[2:0]), |
---|
6355 | .q (tlu_exu_cwp_m[2:0]), |
---|
6356 | .clk (clk), |
---|
6357 | .se (se), |
---|
6358 | .si (), |
---|
6359 | .so () |
---|
6360 | ); |
---|
6361 | |
---|
6362 | dff_s #(8) dff_lsu_asi_m ( |
---|
6363 | .din (tsa_rdata_asi[7:0]), |
---|
6364 | .q (tlu_lsu_asi_m[7:0]), |
---|
6365 | .clk (clk), |
---|
6366 | .se (se), |
---|
6367 | .si (), |
---|
6368 | .so () |
---|
6369 | ); |
---|
6370 | */ |
---|
6371 | // |
---|
6372 | |
---|
6373 | assign tlu_exu_tid_m[1:0] = thrid_m[1:0]; |
---|
6374 | |
---|
6375 | assign tlu_int_tid_m[1:0] = tlu_exu_tid_m[1:0]; |
---|
6376 | assign tlu_lsu_tid_m[1:0] = tlu_exu_tid_m[1:0]; |
---|
6377 | |
---|
6378 | // modified due to timing violations |
---|
6379 | assign tlu_lsu_asi_update_m = tlu_exu_cwpccr_update_m; |
---|
6380 | |
---|
6381 | // Assumption is that this will be transmitted in the equivalent |
---|
6382 | // of the w-stage from the exu. |
---|
6383 | assign cwp_cmplt0 = ~exu_tlu_cwp_cmplt_tid[1] & ~exu_tlu_cwp_cmplt_tid[0] |
---|
6384 | & exu_tlu_cwp_cmplt; |
---|
6385 | assign cwp_cmplt1 = ~exu_tlu_cwp_cmplt_tid[1] & exu_tlu_cwp_cmplt_tid[0] |
---|
6386 | & exu_tlu_cwp_cmplt; |
---|
6387 | assign cwp_cmplt2 = exu_tlu_cwp_cmplt_tid[1] & ~exu_tlu_cwp_cmplt_tid[0] |
---|
6388 | & exu_tlu_cwp_cmplt; |
---|
6389 | assign cwp_cmplt3 = exu_tlu_cwp_cmplt_tid[1] & exu_tlu_cwp_cmplt_tid[0] |
---|
6390 | & exu_tlu_cwp_cmplt; |
---|
6391 | |
---|
6392 | |
---|
6393 | assign pending_dntry0_taken = cwp_cmplt0_pending & pending_thrd0_event_taken; |
---|
6394 | assign pending_dntry1_taken = cwp_cmplt1_pending & pending_thrd1_event_taken; |
---|
6395 | assign pending_dntry2_taken = cwp_cmplt2_pending & pending_thrd2_event_taken; |
---|
6396 | assign pending_dntry3_taken = cwp_cmplt3_pending & pending_thrd3_event_taken; |
---|
6397 | |
---|
6398 | // Any pending cwp change completes. |
---|
6399 | // ** This equation can be optimized in terms of gate count ** |
---|
6400 | assign cwp_cmplt_g = |
---|
6401 | pending_dntry0_taken | pending_dntry1_taken | |
---|
6402 | pending_dntry2_taken | pending_dntry3_taken; |
---|
6403 | |
---|
6404 | // A cwp change related to retry completes. |
---|
6405 | assign cwp_cmplt_rtry_g = |
---|
6406 | (cwp_cmplt0_pending & pending_thrd0_event_taken & cwp_retry0) | |
---|
6407 | (cwp_cmplt1_pending & pending_thrd1_event_taken & cwp_retry1) | |
---|
6408 | (cwp_cmplt2_pending & pending_thrd2_event_taken & cwp_retry2) | |
---|
6409 | (cwp_cmplt3_pending & pending_thrd3_event_taken & cwp_retry3); |
---|
6410 | // |
---|
6411 | |
---|
6412 | dff_s #(2) dff_ccmplt_stgw2 ( |
---|
6413 | .din ({cwp_cmplt_g,cwp_cmplt_rtry_g}), |
---|
6414 | .q ({cwp_cmplt_w2,cwp_cmplt_rtry_w2}), |
---|
6415 | .clk (clk), |
---|
6416 | .se (se), |
---|
6417 | .si (), |
---|
6418 | .so () |
---|
6419 | ); |
---|
6420 | |
---|
6421 | //========================================================================================= |
---|
6422 | // Generate SSCAN data |
---|
6423 | //========================================================================================= |
---|
6424 | // |
---|
6425 | assign sscan_tid_sel[`TLU_THRD_NUM-1:0] = ctu_sscan_tid[`TLU_THRD_NUM-1:0]; |
---|
6426 | /* |
---|
6427 | // logic moved to tlu_misctl |
---|
6428 | // generating write indicators of ttype to the tsa |
---|
6429 | assign sscan_tt_wr_sel[0] = |
---|
6430 | tsa_ttype_en & tsa_wr_vld[1] & thread0_wtrp_w2; |
---|
6431 | assign sscan_tt_wr_sel[1] = |
---|
6432 | tsa_ttype_en & tsa_wr_vld[1] & thread1_wtrp_w2; |
---|
6433 | assign sscan_tt_wr_sel[2] = |
---|
6434 | tsa_ttype_en & tsa_wr_vld[1] & thread2_wtrp_w2; |
---|
6435 | assign sscan_tt_wr_sel[3] = |
---|
6436 | tsa_ttype_en & tsa_wr_vld[1] & thread3_wtrp_w2; |
---|
6437 | // |
---|
6438 | // generating read indicators of ttype from the tsa |
---|
6439 | assign sscan_tt_rd_sel[0] = |
---|
6440 | tsa_rd_vld_m & thread0_rsel_m; |
---|
6441 | assign sscan_tt_rd_sel[1] = |
---|
6442 | tsa_rd_vld_m & thread1_rsel_m; |
---|
6443 | assign sscan_tt_rd_sel[2] = |
---|
6444 | tsa_rd_vld_m & thread2_rsel_m; |
---|
6445 | assign sscan_tt_rd_sel[3] = |
---|
6446 | tsa_rd_vld_m & thread3_rsel_m; |
---|
6447 | |
---|
6448 | assign sscan_ttype_en[0] = |
---|
6449 | sscan_tt_rd_sel[0] | sscan_tt_wr_sel[0]; |
---|
6450 | assign sscan_ttype_en[1] = |
---|
6451 | sscan_tt_rd_sel[1] | sscan_tt_wr_sel[1]; |
---|
6452 | assign sscan_ttype_en[2] = |
---|
6453 | sscan_tt_rd_sel[2] | sscan_tt_wr_sel[2]; |
---|
6454 | assign sscan_ttype_en[3] = |
---|
6455 | sscan_tt_rd_sel[3] | sscan_tt_wr_sel[3]; |
---|
6456 | // |
---|
6457 | assign sscan_tt0_din[`TSA_TTYPE_WIDTH-1:0] = |
---|
6458 | (sscan_tt_wr_sel[0]) ? |
---|
6459 | final_ttype_w2[`TSA_TTYPE_WIDTH-1:0] : tsa_rdata_ttype_m[`TSA_TTYPE_WIDTH-1:0]; |
---|
6460 | assign sscan_tt1_din[`TSA_TTYPE_WIDTH-1:0] = |
---|
6461 | (sscan_tt_wr_sel[1]) ? |
---|
6462 | final_ttype_w2[`TSA_TTYPE_WIDTH-1:0] : tsa_rdata_ttype_m[`TSA_TTYPE_WIDTH-1:0]; |
---|
6463 | assign sscan_tt2_din[`TSA_TTYPE_WIDTH-1:0] = |
---|
6464 | (sscan_tt_wr_sel[2]) ? |
---|
6465 | final_ttype_w2[`TSA_TTYPE_WIDTH-1:0] : tsa_rdata_ttype_m[`TSA_TTYPE_WIDTH-1:0]; |
---|
6466 | assign sscan_tt3_din[`TSA_TTYPE_WIDTH-1:0] = |
---|
6467 | (sscan_tt_wr_sel[3]) ? |
---|
6468 | final_ttype_w2[`TSA_TTYPE_WIDTH-1:0] : tsa_rdata_ttype_m[`TSA_TTYPE_WIDTH-1:0]; |
---|
6469 | // |
---|
6470 | dffe_s #(`TSA_TTYPE_WIDTH) dffe_sscan_tt0_data ( |
---|
6471 | .din (sscan_tt0_din[`TSA_TTYPE_WIDTH-1:0]), |
---|
6472 | .q (sscan_tt0_data[`TSA_TTYPE_WIDTH-1:0]), |
---|
6473 | .en (sscan_ttype_en[0]), |
---|
6474 | .clk (clk), |
---|
6475 | .se (se), |
---|
6476 | .si (), |
---|
6477 | .so () |
---|
6478 | ); |
---|
6479 | |
---|
6480 | dffe_s #(`TSA_TTYPE_WIDTH) dffe_sscan_tt1_data ( |
---|
6481 | .din (sscan_tt1_din[`TSA_TTYPE_WIDTH-1:0]), |
---|
6482 | .q (sscan_tt1_data[`TSA_TTYPE_WIDTH-1:0]), |
---|
6483 | .en (sscan_ttype_en[1]), |
---|
6484 | .clk (clk), |
---|
6485 | .se (se), |
---|
6486 | .si (), |
---|
6487 | .so () |
---|
6488 | ); |
---|
6489 | |
---|
6490 | dffe_s #(`TSA_TTYPE_WIDTH) dffe_sscan_tt2_data ( |
---|
6491 | .din (sscan_tt2_din[`TSA_TTYPE_WIDTH-1:0]), |
---|
6492 | .q (sscan_tt2_data[`TSA_TTYPE_WIDTH-1:0]), |
---|
6493 | .en (sscan_ttype_en[2]), |
---|
6494 | .clk (clk), |
---|
6495 | .se (se), |
---|
6496 | .si (), |
---|
6497 | .so () |
---|
6498 | ); |
---|
6499 | |
---|
6500 | dffe_s #(`TSA_TTYPE_WIDTH) dffe_sscan_tt3_data ( |
---|
6501 | .din (sscan_tt3_din[`TSA_TTYPE_WIDTH-1:0]), |
---|
6502 | .q (sscan_tt3_data[`TSA_TTYPE_WIDTH-1:0]), |
---|
6503 | .en (sscan_ttype_en[3]), |
---|
6504 | .clk (clk), |
---|
6505 | .se (se), |
---|
6506 | .si (), |
---|
6507 | .so () |
---|
6508 | ); |
---|
6509 | |
---|
6510 | dff_s #(`TSA_TTYPE_WIDTH) dff_tsa_rdata_ttype_m ( |
---|
6511 | .din (tsa_rdata_ttype[`TSA_TTYPE_WIDTH-1:0]), |
---|
6512 | .q (tsa_rdata_ttype_m[`TSA_TTYPE_WIDTH-1:0]), |
---|
6513 | .clk (clk), |
---|
6514 | .se (se), |
---|
6515 | .si (), |
---|
6516 | .so () |
---|
6517 | ); |
---|
6518 | |
---|
6519 | dff_s dff_tsa_rd_vld_e ( |
---|
6520 | .din (tsa_rd_vld), |
---|
6521 | .q (tsa_rd_vld_e), |
---|
6522 | .clk (clk), |
---|
6523 | .se (se), |
---|
6524 | .si (), |
---|
6525 | .so () |
---|
6526 | ); |
---|
6527 | |
---|
6528 | dff_s dff_tsa_rd_vld_m ( |
---|
6529 | .din (tsa_rd_vld_e), |
---|
6530 | .q (tsa_rd_vld_m), |
---|
6531 | .clk (clk), |
---|
6532 | .se (se), |
---|
6533 | .si (), |
---|
6534 | .so () |
---|
6535 | ); |
---|
6536 | // |
---|
6537 | // modified - due to sscan_tt[0-3]_data moved to tlu_misctl |
---|
6538 | mux4ds #(`TCL_SSCAN_WIDTH) mx_sscan_test_data ( |
---|
6539 | .in0 ({trp_lvl0[2:0],sscan_tt0_data[`TSA_TTYPE_WIDTH-1:0]}), |
---|
6540 | .in1 ({trp_lvl1[2:0],sscan_tt1_data[`TSA_TTYPE_WIDTH-1:0]}), |
---|
6541 | .in2 ({trp_lvl2[2:0],sscan_tt2_data[`TSA_TTYPE_WIDTH-1:0]}), |
---|
6542 | .in3 ({trp_lvl3[2:0],sscan_tt3_data[`TSA_TTYPE_WIDTH-1:0]}), |
---|
6543 | .sel0 (sscan_tid_sel[0]), |
---|
6544 | .sel1 (sscan_tid_sel[1]), |
---|
6545 | .sel2 (sscan_tid_sel[2]), |
---|
6546 | .sel3 (sscan_tid_sel[3]), |
---|
6547 | .dout (tcl_sscan_test_data[`TCL_SSCAN_WIDTH-1:0]) |
---|
6548 | ); |
---|
6549 | */ |
---|
6550 | |
---|
6551 | mux4ds #(`TCL_SSCAN_WIDTH) mx_sscan_test_data ( |
---|
6552 | .in0 (trp_lvl0[2:0]), |
---|
6553 | .in1 (trp_lvl1[2:0]), |
---|
6554 | .in2 (trp_lvl2[2:0]), |
---|
6555 | .in3 (trp_lvl3[2:0]), |
---|
6556 | .sel0 (sscan_tid_sel[0]), |
---|
6557 | .sel1 (sscan_tid_sel[1]), |
---|
6558 | .sel2 (sscan_tid_sel[2]), |
---|
6559 | .sel3 (sscan_tid_sel[3]), |
---|
6560 | .dout (tcl_sscan_test_data[`TCL_SSCAN_WIDTH-1:0]) |
---|
6561 | ); |
---|
6562 | |
---|
6563 | assign tlu_sscan_tcl_data[`TCL_SSCAN_WIDTH-1:0] = |
---|
6564 | tcl_sscan_test_data[`TCL_SSCAN_WIDTH-1:0]; |
---|
6565 | |
---|
6566 | //========================================================================================= |
---|
6567 | // Instrumentation signals created for sas |
---|
6568 | //========================================================================================= |
---|
6569 | // |
---|
6570 | // synopsys translate_off |
---|
6571 | wire [`TSA_TTYPE_WIDTH-1:0] sas_final_ttype_g; |
---|
6572 | wire [`TSA_TTYPE_WIDTH-1:0] sas_adj_lsu_ttype_m2; |
---|
6573 | wire [6:0] sas_hwint_swint_ttype; |
---|
6574 | wire [`TSA_TTYPE_WIDTH-3:0] sas_rst_ttype_g; |
---|
6575 | |
---|
6576 | mux4ds #(`TSA_TTYPE_WIDTH) mx_sas_final_ttype_g ( |
---|
6577 | .sel0 (final_ttype_sel_g[0]), |
---|
6578 | .sel1 (final_ttype_sel_g[1]), |
---|
6579 | .sel2 (final_ttype_sel_g[2]), |
---|
6580 | .sel3 (final_ttype_sel_g[3]), |
---|
6581 | .in0 ({2'b0,sas_rst_ttype_g[`TSA_TTYPE_WIDTH-3:0]}), |
---|
6582 | .in1 (early_sync_ttype_g[`TSA_TTYPE_WIDTH-1:0]), |
---|
6583 | .in2 (sas_adj_lsu_ttype_m2[`TSA_TTYPE_WIDTH-1:0]), |
---|
6584 | .in3 (pending_ttype[`TSA_TTYPE_WIDTH-1:0]), |
---|
6585 | .dout (sas_final_ttype_g[`TSA_TTYPE_WIDTH-1:0]) |
---|
6586 | ); |
---|
6587 | |
---|
6588 | mux3ds #(`TSA_TTYPE_WIDTH) mx_sas_adj_lsu_ttype_m2 ( |
---|
6589 | .sel0 (lsu_defr_trap_g), |
---|
6590 | .sel1 (va_oor_data_acc_excp_g & ~lsu_defr_trap_g), |
---|
6591 | .sel2 (~(va_oor_data_acc_excp_g | lsu_defr_trap_g)), |
---|
6592 | .in0 (9'h032), |
---|
6593 | .in1 (9'h030), |
---|
6594 | .in2 (lsu_tlu_ttype_m2), |
---|
6595 | .dout (sas_adj_lsu_ttype_m2[`TSA_TTYPE_WIDTH-1:0]) |
---|
6596 | ); |
---|
6597 | |
---|
6598 | assign sas_hwint_swint_ttype[6:0] = |
---|
6599 | (hwint_g)? `HWINT_INT: |
---|
6600 | (cpu_mondo_trap_g)? `CPU_MONDO_TRAP: |
---|
6601 | (dev_mondo_trap_g)? `DEV_MONDO_TRAP: |
---|
6602 | {3'b100, tlu_sftint_id[3:0]}; |
---|
6603 | |
---|
6604 | assign sas_rst_ttype_g[`TSA_TTYPE_WIDTH-3:0] = |
---|
6605 | (rst_ttype_sel[0])? {4'b00,reset_id_g[2:0]}: |
---|
6606 | (rst_ttype_sel[1])? wrap_tlz_ttype[6:0]: |
---|
6607 | sas_hwint_swint_ttype[6:0]; |
---|
6608 | |
---|
6609 | // synopsys translate_on |
---|
6610 | endmodule |
---|