1 | // ========== Copyright Header Begin ========================================== |
---|
2 | // |
---|
3 | // OpenSPARC T1 Processor File: tlu_pib.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: Performance Instrumentation Block |
---|
24 | // Performance monitoring 2 of the 9 possible events |
---|
25 | // can be tracked per thread |
---|
26 | */ |
---|
27 | //////////////////////////////////////////////////////////////////////// |
---|
28 | // Global header file includes |
---|
29 | //////////////////////////////////////////////////////////////////////// |
---|
30 | `include "sys.h" // system level definition file which contains the |
---|
31 | // time scale definition |
---|
32 | |
---|
33 | `include "tlu.h" |
---|
34 | |
---|
35 | //////////////////////////////////////////////////////////////////////// |
---|
36 | // Local header file includes / local defines |
---|
37 | //////////////////////////////////////////////////////////////////////// |
---|
38 | |
---|
39 | module tlu_pib (/*AUTOARG*/ |
---|
40 | // input |
---|
41 | ifu_tlu_imiss_e, ifu_tlu_immu_miss_m, ifu_tlu_thrid_d, |
---|
42 | ifu_tlu_sraddr_d, ifu_tlu_rsr_inst_d, // ifu_tlu_wsr_inst_d, |
---|
43 | ifu_tlu_l2imiss, tlu_tcc_inst_w, lsu_tlu_wsr_inst_e, |
---|
44 | ffu_tlu_fpu_tid, ffu_tlu_fpu_cmplt, |
---|
45 | lsu_tlu_dmmu_miss_g, lsu_tlu_dcache_miss_w2, lsu_tlu_l2_dmiss, |
---|
46 | lsu_tlu_stb_full_w2, exu_tlu_wsr_data_m, // tlu_tickcmp_sel, |
---|
47 | tlu_hpstate_priv, tlu_thread_inst_vld_g, tlu_wsr_inst_nq_g, |
---|
48 | tlu_full_flush_pipe_w2, tlu_pstate_priv, tlu_thread_wsel_g, |
---|
49 | tlu_pib_rsr_data_e, tlu_hpstate_enb, ifu_tlu_flush_fd_w, |
---|
50 | // |
---|
51 | // reset was modified to abide to the Niagara reset methodology |
---|
52 | rclk, arst_l, grst_l, si, se, // tlu_rst_l, rst_tri_en, |
---|
53 | // output |
---|
54 | |
---|
55 | // tlu_pcr_ut_e, tlu_pcr_st_e, |
---|
56 | pib_picl_wrap, pich_wrap_flg, pich_onebelow_flg, pich_twobelow_flg, |
---|
57 | tlu_pic_onebelow_e, tlu_pic_twobelow_e, pib_priv_act_trap_m, |
---|
58 | tlu_wsr_data_w, tlu_pcr_ut, tlu_pcr_st, tlu_pic_wrap_e, so); |
---|
59 | |
---|
60 | // Input section |
---|
61 | // Events generated by IFU |
---|
62 | input ifu_tlu_imiss_e; // icache misses -- New interface |
---|
63 | input ifu_tlu_immu_miss_m; // itlb misses |
---|
64 | input [1:0] ifu_tlu_thrid_d; // thread id For instruction complete |
---|
65 | input [`TLU_THRD_NUM-1:0] tlu_thread_inst_vld_g; // For instruction complete |
---|
66 | input [`TLU_THRD_NUM-1:0] tlu_thread_wsel_g; // thread of instruction fetched |
---|
67 | input [`TLU_THRD_NUM-1:0] ifu_tlu_l2imiss; // l2 imiss -- new interface |
---|
68 | |
---|
69 | // ASR register read/write requests |
---|
70 | input [`TLU_ASR_ADDR_WIDTH-1:0] ifu_tlu_sraddr_d; |
---|
71 | input ifu_tlu_rsr_inst_d; // valid rd sr(st/pr) |
---|
72 | // input ifu_tlu_wsr_inst_d; // valid wr sr(st/pr) |
---|
73 | input lsu_tlu_wsr_inst_e; // valid wr sr(st/pr) |
---|
74 | // input tlu_wsr_inst_g; // valid wr sr(st/pr) |
---|
75 | // modified for timing |
---|
76 | input tlu_wsr_inst_nq_g; // valid wr sr(st/pr) |
---|
77 | input [`TLU_ASR_DATA_WIDTH-1:0] exu_tlu_wsr_data_m; // pr/st data to irf. |
---|
78 | // modified due to timing |
---|
79 | // input [`TLU_ASR_DATA_WIDTH-1:0] tlu_pib_rsr_data_e; // this was the tlu_exu_rsr_data_e |
---|
80 | |
---|
81 | // LSU generated events - also include L2 miss |
---|
82 | input [`TLU_THRD_NUM-1:0] lsu_tlu_dcache_miss_w2; // dcache miss -- new interface |
---|
83 | input [`TLU_THRD_NUM-1:0] lsu_tlu_l2_dmiss; // l2 dmisses -- new interface |
---|
84 | input [`TLU_THRD_NUM-1:0] lsu_tlu_stb_full_w2; // store buffer full -- new interface |
---|
85 | input lsu_tlu_dmmu_miss_g; // dtlb misses |
---|
86 | // FFU generated events - also include L2 miss |
---|
87 | input [1:0] ffu_tlu_fpu_tid; // ThrdID for the FF instr_cmplt -- new |
---|
88 | input ffu_tlu_fpu_cmplt; // FF instru complete -- new |
---|
89 | // TLU information for event filtering |
---|
90 | // |
---|
91 | input [`TLU_THRD_NUM-1:0] tlu_pstate_priv; // supervisor privilege information |
---|
92 | input [`TLU_THRD_NUM-1:0] tlu_hpstate_priv;// hypervisor privilege information |
---|
93 | input [`TLU_THRD_NUM-1:0] tlu_hpstate_enb; // hyperlite enabling |
---|
94 | input tlu_tcc_inst_w; // For instruction complete |
---|
95 | input tlu_full_flush_pipe_w2; // For instruction complete |
---|
96 | input ifu_tlu_flush_fd_w; // For instruction complete |
---|
97 | // Global signals |
---|
98 | input rclk; |
---|
99 | // |
---|
100 | // reset was modified to abide to the Niagara reset methodology |
---|
101 | // input reset; |
---|
102 | // input tlu_rst_l; |
---|
103 | input grst_l; // global reset - active log |
---|
104 | input arst_l; // global reset - active log |
---|
105 | input si; // global scan-in |
---|
106 | input se; // global scan-out |
---|
107 | // input rst_tri_en; // global reset - active log |
---|
108 | |
---|
109 | // output section |
---|
110 | // modified to make inst vld overflow trap precies |
---|
111 | // output [`TLU_THRD_NUM-1:0] pib_pic_wrap; // pic register wrap transition |
---|
112 | // output pib_rst_l; // local unit reset - active low |
---|
113 | output [`TLU_THRD_NUM-1:0] pib_picl_wrap; // pic register wrap transition |
---|
114 | output [`TLU_THRD_NUM-1:0] pich_wrap_flg; // pic register wrap transition |
---|
115 | output [`TLU_THRD_NUM-1:0] pich_onebelow_flg; // pic register wrap transition |
---|
116 | output [`TLU_THRD_NUM-1:0] pich_twobelow_flg; // pic register wrap transition |
---|
117 | // output [`TLU_THRD_NUM-1:0] pich_threebelow_flg; // pic register wrap transition |
---|
118 | // modified due to timing fixes |
---|
119 | output [`TLU_ASR_DATA_WIDTH-1:0] tlu_pib_rsr_data_e; // rsr data register data |
---|
120 | output tlu_pic_onebelow_e, tlu_pic_twobelow_e, tlu_pic_wrap_e; |
---|
121 | // |
---|
122 | // modified for bug 5436 - Niagara 2.0 |
---|
123 | output [`TLU_THRD_NUM-1:0] tlu_pcr_ut; |
---|
124 | output [`TLU_THRD_NUM-1:0] tlu_pcr_st; |
---|
125 | wire tlu_pcr_ut_e, tlu_pcr_st_e; |
---|
126 | |
---|
127 | |
---|
128 | // |
---|
129 | // output [`TLU_THRD_NUM-1:0] pib_priv_act_trap; // access privilege violation for pics |
---|
130 | output [`TLU_THRD_NUM-1:0] pib_priv_act_trap_m; // access privilege violation for pics |
---|
131 | // output [`TLU_ASR_DATA_WIDTH-1:0] tlu_exu_rsr_data_e; // Add in the final muxing of pib asr data |
---|
132 | output [`TLU_ASR_DATA_WIDTH-1:0] tlu_wsr_data_w; // flopped version of exu_tlu_wsr_data_m |
---|
133 | // output [47:0] tlu_ifu_trappc_w2; // temporary for timing |
---|
134 | // output [47:0] tlu_ifu_trapnpc_w2; // temporary for timing |
---|
135 | output so; // global scan-out |
---|
136 | |
---|
137 | //============================================================================== |
---|
138 | // Local signal defines |
---|
139 | //============================================================================== |
---|
140 | // decoded address for pcr and pic |
---|
141 | wire pcr_rw_e, pcr_rw_m, pcr_rw_g; // pcr_rw_d, |
---|
142 | wire pic_priv_rw_e, pic_priv_rw_m, pic_priv_rw_g; // pic_priv_rw_d, |
---|
143 | wire pic_npriv_rw_e, pic_npriv_rw_m, pic_npriv_rw_g;// pic_npriv_rw_d, |
---|
144 | // |
---|
145 | // read/write to pcr, evq and pic |
---|
146 | wire [`TLU_THRD_NUM-1:0] wsr_thread_inst_g; |
---|
147 | wire [`TLU_THRD_NUM-1:0] update_picl_sel, update_picl_wrap_en; |
---|
148 | wire [`TLU_THRD_NUM-1:0] picl_cnt_wrap_datain; |
---|
149 | wire [`TLU_THRD_NUM-1:0] update_pich_sel, update_pich_wrap_en; |
---|
150 | wire [`TLU_THRD_NUM-1:0] pich_cnt_wrap_datain; |
---|
151 | wire [`TLU_THRD_NUM-1:0] update_evq_sel; |
---|
152 | wire [`TLU_THRD_NUM-1:0] wsr_pcr_sel; |
---|
153 | wire [`TLU_THRD_NUM-1:0] wsr_pic_sel; |
---|
154 | wire [`TLU_THRD_NUM-1:0] update_pich_ovf; |
---|
155 | wire [`TLU_THRD_NUM-1:0] update_picl_ovf; |
---|
156 | wire [`TLU_THRD_NUM-1:0] inst_vld_w2; |
---|
157 | wire tcc_inst_w2; |
---|
158 | // |
---|
159 | // added for bug 2919 |
---|
160 | wire [`TLU_THRD_NUM-1:0] pic_update_ctl; |
---|
161 | wire [1:0] pic_update_sel_ctr; |
---|
162 | wire [1:0] pic_update_sel_incr; |
---|
163 | // |
---|
164 | // modified for timing |
---|
165 | // wire [`TLU_ASR_ADDR_WIDTH-1:0] pib_sraddr_d; |
---|
166 | wire [`TLU_ASR_ADDR_WIDTH-1:0] pib_sraddr_e; |
---|
167 | wire tlu_rsr_inst_e, tlu_wsr_inst_e; |
---|
168 | // |
---|
169 | // picl masks |
---|
170 | wire [`PICL_MASK_WIDTH-1:0] picl_mask0, picl_mask1, picl_mask2, picl_mask3; |
---|
171 | wire [`PICL_MASK_WIDTH-1:0] picl_event0, picl_event1, picl_event2, picl_event3; |
---|
172 | // added for bug2332 |
---|
173 | // wire incr_pich_onehot; |
---|
174 | // pic counters |
---|
175 | wire [`TLU_THRD_NUM-1:0] incr_pich; |
---|
176 | wire [`TLU_THRD_NUM-1:0] pich_mux_sel; |
---|
177 | wire [`TLU_THRD_NUM-1:0] pich_cnt_wrap; |
---|
178 | wire [`TLU_THRD_NUM-1:0] picl_cnt_wrap; |
---|
179 | wire [`TLU_THRD_NUM-2:0] thread_rsel_d; |
---|
180 | wire [`TLU_THRD_NUM-2:0] thread_rsel_e; |
---|
181 | wire [`TLU_THRD_NUM-1:0] pic_onebelow_e, pic_twobelow_e, pic_wrap_e; |
---|
182 | wire [`PIB_PIC_CNT_WIDTH-1:0] picl_cnt0, picl_cnt1, picl_cnt2, picl_cnt3; |
---|
183 | wire [`PIB_PIC_CNT_WIDTH-1:0] picl_cnt_din, picl_cnt_sum; |
---|
184 | wire [`PIB_PIC_CNT_WIDTH-1:0] picl_wsr_data; |
---|
185 | wire [`PIB_PIC_CNT_WIDTH-1:0] update_picl0_data, update_picl1_data; |
---|
186 | wire [`PIB_PIC_CNT_WIDTH-1:0] update_picl2_data, update_picl3_data; |
---|
187 | wire [`PIB_PIC_CNT_WIDTH-1:0] pich_cnt0, pich_cnt1, pich_cnt2, pich_cnt3; |
---|
188 | wire [`PIB_PIC_CNT_WIDTH-1:0] pich_cnt_din, pich_cnt_sum; |
---|
189 | wire [`PIB_PIC_CNT_WIDTH-1:0] pich_wsr_data; |
---|
190 | wire [`PIB_PIC_CNT_WIDTH-1:0] update_pich0_data, update_pich1_data; |
---|
191 | wire [`PIB_PIC_CNT_WIDTH-1:0] update_pich2_data, update_pich3_data; |
---|
192 | wire [`TLU_ASR_DATA_WIDTH-1:0] pic_rdata_e; |
---|
193 | wire [`TLU_ASR_DATA_WIDTH-1:0] pcr_rdata_e; |
---|
194 | wire [`PIB_PCR_WIDTH-1:0] pcr_reg_rdata_e; |
---|
195 | wire [`PIB_PCR_WIDTH-1:0] pcr_wdata_in; |
---|
196 | wire [`TLU_THRD_NUM-1:0] picl_ovf_wdata_in; |
---|
197 | wire [`TLU_THRD_NUM-1:0] pich_ovf_wdata_in; |
---|
198 | // experiment |
---|
199 | wire [`TLU_THRD_NUM-1:0] pich_fourbelow_din; |
---|
200 | wire [`TLU_THRD_NUM-1:0] pich_fourbelow_flg; |
---|
201 | // wire [`TLU_THRD_NUM-1:0] pich_threebelow_flg; |
---|
202 | // modified due to timing |
---|
203 | // wire [2:0] rsr_data_sel_e; |
---|
204 | wire [1:0] rsr_data_sel_e; |
---|
205 | // picl evqs |
---|
206 | wire [`PIB_EVQ_CNT_WIDTH-1:0] picl_evq0, picl_evq1, picl_evq2, picl_evq3; |
---|
207 | wire [`PIB_EVQ_CNT_WIDTH-1:0] picl_evq0_sum, picl_evq1_sum; |
---|
208 | wire [`PIB_EVQ_CNT_WIDTH-1:0] picl_evq2_sum, picl_evq3_sum; |
---|
209 | wire [`PIB_EVQ_CNT_WIDTH-1:0] update_evq0_data, update_evq1_data; |
---|
210 | wire [`PIB_EVQ_CNT_WIDTH-1:0] update_evq2_data, update_evq3_data; |
---|
211 | wire [`PIB_EVQ_CNT_WIDTH-1:0] picl_evq_din; |
---|
212 | wire [`PIB_EVQ_CNT_WIDTH-1:0] picl_evq0_din, picl_evq1_din; |
---|
213 | wire [`PIB_EVQ_CNT_WIDTH-1:0] picl_evq2_din, picl_evq3_din; |
---|
214 | wire [`TLU_THRD_NUM-1:0] incr_evq_din, incr_evq; |
---|
215 | // pcr registers |
---|
216 | wire [`PIB_PCR_WIDTH-1:0] pcr0, pcr1, pcr2, pcr3; |
---|
217 | // |
---|
218 | wire local_rst; // local active high reset |
---|
219 | wire local_rst_l; // local active high reset |
---|
220 | // counting enable indicator |
---|
221 | wire [`TLU_THRD_NUM-1:0] pic_cnt_en, pic_cnt_en_w2; |
---|
222 | // |
---|
223 | // staged icache and itlb misses |
---|
224 | wire imiss_m, imiss_g; |
---|
225 | wire immu_miss_g; |
---|
226 | // |
---|
227 | // threaded icache, itlb, and dtlb misses |
---|
228 | wire [`TLU_THRD_NUM-1:0] imiss_thread_g; |
---|
229 | wire [`TLU_THRD_NUM-1:0] immu_miss_thread_g; |
---|
230 | wire [`TLU_THRD_NUM-1:0] dmmu_miss_thread_g; |
---|
231 | wire [`TLU_THRD_NUM-1:0] fpu_cmplt_thread; |
---|
232 | // |
---|
233 | // clock rename |
---|
234 | wire clk; |
---|
235 | |
---|
236 | //============================================================================== |
---|
237 | // Code starts here |
---|
238 | //============================================================================== |
---|
239 | // reset |
---|
240 | |
---|
241 | dffrl_async dffrl_local_rst_l( |
---|
242 | .din (grst_l), |
---|
243 | .clk (clk), |
---|
244 | .rst_l(arst_l), |
---|
245 | .q (local_rst_l), |
---|
246 | .se (se), |
---|
247 | .si (), |
---|
248 | .so () |
---|
249 | ); |
---|
250 | |
---|
251 | assign local_rst = ~local_rst_l; |
---|
252 | // assign pib_rst_l = local_rst_l; |
---|
253 | // assign local_rst = ~tlu_rst_l; |
---|
254 | // |
---|
255 | // rename clock |
---|
256 | assign clk = rclk; |
---|
257 | |
---|
258 | // |
---|
259 | // privilege action trap due to user access of pic register when |
---|
260 | // PRIV bit is set in pcr |
---|
261 | // modified for timing fixes |
---|
262 | /* |
---|
263 | assign pib_priv_act_trap = (pic_npriv_rw_g ) & |
---|
264 | ((pcr0[`PIB_PCR_PRIV] & tlu_thread_inst_vld_g[0]) & |
---|
265 | ~tlu_pstate_priv[0]) | |
---|
266 | ((pcr1[`PIB_PCR_PRIV] & tlu_thread_inst_vld_g[1]) & |
---|
267 | ~tlu_pstate_priv[1]) | |
---|
268 | ((pcr2[`PIB_PCR_PRIV] & tlu_thread_inst_vld_g[2]) & |
---|
269 | ~tlu_pstate_priv[2]) | |
---|
270 | ((pcr3[`PIB_PCR_PRIV] & tlu_thread_inst_vld_g[3]) & |
---|
271 | ~tlu_pstate_priv[3]); |
---|
272 | */ |
---|
273 | assign pib_priv_act_trap_m[0] = pic_npriv_rw_m & pcr0[`PIB_PCR_PRIV]; |
---|
274 | assign pib_priv_act_trap_m[1] = pic_npriv_rw_m & pcr1[`PIB_PCR_PRIV]; |
---|
275 | assign pib_priv_act_trap_m[2] = pic_npriv_rw_m & pcr2[`PIB_PCR_PRIV]; |
---|
276 | assign pib_priv_act_trap_m[3] = pic_npriv_rw_m & pcr3[`PIB_PCR_PRIV]; |
---|
277 | |
---|
278 | // |
---|
279 | // staging the exu_tlu_wsr_data_w signal for timing |
---|
280 | // |
---|
281 | dff_s #(`TLU_ASR_DATA_WIDTH) dff_tlu_wsr_data_w ( |
---|
282 | .din (exu_tlu_wsr_data_m[`TLU_ASR_DATA_WIDTH-1:0]), |
---|
283 | .q (tlu_wsr_data_w[`TLU_ASR_DATA_WIDTH-1:0]), |
---|
284 | .clk (clk), |
---|
285 | .se (se), |
---|
286 | .si (), |
---|
287 | .so () |
---|
288 | ); |
---|
289 | // |
---|
290 | //================================ |
---|
291 | // address decode for PCR and PICs |
---|
292 | //================================ |
---|
293 | // added and modified for timing |
---|
294 | // assign pib_sraddr_d[`TLU_ASR_ADDR_WIDTH-1:0] = |
---|
295 | // ifu_tlu_sraddr_d[`TLU_ASR_ADDR_WIDTH-1:0]; |
---|
296 | |
---|
297 | dff_s #(`TLU_ASR_ADDR_WIDTH) dff_pib_sraddr_e ( |
---|
298 | .din (ifu_tlu_sraddr_d[`TLU_ASR_ADDR_WIDTH-1:0]), |
---|
299 | .q (pib_sraddr_e[`TLU_ASR_ADDR_WIDTH-1:0]), |
---|
300 | .clk (clk), |
---|
301 | .se (se), |
---|
302 | .si (), |
---|
303 | .so () |
---|
304 | ); |
---|
305 | |
---|
306 | dffr_s dffr_tlu_rsr_inst_e ( |
---|
307 | .din (ifu_tlu_rsr_inst_d), |
---|
308 | .q (tlu_rsr_inst_e), |
---|
309 | .rst (local_rst), |
---|
310 | .clk (clk), |
---|
311 | .se (se), |
---|
312 | .si (), |
---|
313 | .so () |
---|
314 | ); |
---|
315 | // |
---|
316 | // modified for timing |
---|
317 | /* |
---|
318 | dffr_s dffr_tlu_wsr_inst_e ( |
---|
319 | .din (ifu_tlu_wsr_inst_d), |
---|
320 | .q (tlu_wsr_inst_e), |
---|
321 | .rst (local_rst), |
---|
322 | .clk (clk), |
---|
323 | .se (se), |
---|
324 | .si (), |
---|
325 | .so () |
---|
326 | ); |
---|
327 | */ |
---|
328 | assign tlu_wsr_inst_e = lsu_tlu_wsr_inst_e; |
---|
329 | // |
---|
330 | assign pcr_rw_e = |
---|
331 | (pib_sraddr_e[`TLU_ASR_ADDR_WIDTH-1:0] == `PCR_ASR_ADDR); |
---|
332 | assign pic_priv_rw_e = |
---|
333 | (pib_sraddr_e[`TLU_ASR_ADDR_WIDTH-1:0] == `PIC_ASR_PRIV_ADDR); |
---|
334 | assign pic_npriv_rw_e = |
---|
335 | (pib_sraddr_e[`TLU_ASR_ADDR_WIDTH-1:0] == `PIC_ASR_NPRIV_ADDR) & |
---|
336 | (tlu_rsr_inst_e | tlu_wsr_inst_e); |
---|
337 | // |
---|
338 | // staging of the ASR decoded controls |
---|
339 | // |
---|
340 | // staging from d to e stage |
---|
341 | // deleted for timing |
---|
342 | /* |
---|
343 | dff_s dff_pcr_rw_d_e ( |
---|
344 | .din (pcr_rw_d), |
---|
345 | .q (pcr_rw_e), |
---|
346 | .clk (clk), |
---|
347 | .se (se), |
---|
348 | .si (), |
---|
349 | .so () |
---|
350 | ); |
---|
351 | |
---|
352 | dff_s dff_pic_priv_rw_d_e ( |
---|
353 | .din (pic_priv_rw_d), |
---|
354 | .q (pic_priv_rw_e), |
---|
355 | .clk (clk), |
---|
356 | .se (se), |
---|
357 | .si (), |
---|
358 | .so () |
---|
359 | ); |
---|
360 | |
---|
361 | dff_s dff_pic_npriv_rw_d_e ( |
---|
362 | .din (pic_npriv_rw_d), |
---|
363 | .q (pic_npriv_rw_e), |
---|
364 | .clk (clk), |
---|
365 | .se (se), |
---|
366 | .si (), |
---|
367 | .so () |
---|
368 | ); |
---|
369 | */ |
---|
370 | // |
---|
371 | // staging from e to m stage |
---|
372 | dff_s dff_pcr_rw_e_m ( |
---|
373 | .din (pcr_rw_e), |
---|
374 | .q (pcr_rw_m), |
---|
375 | .clk (clk), |
---|
376 | .se (se), |
---|
377 | .si (), |
---|
378 | .so () |
---|
379 | ); |
---|
380 | |
---|
381 | dff_s dff_pic_priv_rw_e_m ( |
---|
382 | .din (pic_priv_rw_e), |
---|
383 | .q (pic_priv_rw_m), |
---|
384 | .clk (clk), |
---|
385 | .se (se), |
---|
386 | .si (), |
---|
387 | .so () |
---|
388 | ); |
---|
389 | |
---|
390 | dff_s dff_pic_npriv_rw_e_m ( |
---|
391 | .din (pic_npriv_rw_e), |
---|
392 | .q (pic_npriv_rw_m), |
---|
393 | .clk (clk), |
---|
394 | .se (se), |
---|
395 | .si (), |
---|
396 | .so () |
---|
397 | ); |
---|
398 | |
---|
399 | dff_s dff_imiss_e_m ( |
---|
400 | .din (ifu_tlu_imiss_e), |
---|
401 | .q (imiss_m), |
---|
402 | .clk (clk), |
---|
403 | .se (se), |
---|
404 | .si (), |
---|
405 | .so () |
---|
406 | ); |
---|
407 | // |
---|
408 | // staging from m to g stage |
---|
409 | dff_s dff_pcr_rw_m_g ( |
---|
410 | .din (pcr_rw_m), |
---|
411 | .q (pcr_rw_g), |
---|
412 | .clk (clk), |
---|
413 | .se (se), |
---|
414 | .si (), |
---|
415 | .so () |
---|
416 | ); |
---|
417 | |
---|
418 | dff_s dff_pic_priv_rw_m_g ( |
---|
419 | .din (pic_priv_rw_m), |
---|
420 | .q (pic_priv_rw_g), |
---|
421 | .clk (clk), |
---|
422 | .se (se), |
---|
423 | .si (), |
---|
424 | .so () |
---|
425 | ); |
---|
426 | |
---|
427 | dff_s dff_pic_npriv_rw_m_g ( |
---|
428 | .din (pic_npriv_rw_m), |
---|
429 | .q (pic_npriv_rw_g), |
---|
430 | .clk (clk), |
---|
431 | .se (se), |
---|
432 | .si (), |
---|
433 | .so () |
---|
434 | ); |
---|
435 | |
---|
436 | dff_s dff_imiss_m_g ( |
---|
437 | .din (imiss_m), |
---|
438 | .q (imiss_g), |
---|
439 | .clk (clk), |
---|
440 | .se (se), |
---|
441 | .si (), |
---|
442 | .so () |
---|
443 | ); |
---|
444 | |
---|
445 | dff_s dff_immu_miss_m_g ( |
---|
446 | .din (ifu_tlu_immu_miss_m), |
---|
447 | .q (immu_miss_g), |
---|
448 | .clk (clk), |
---|
449 | .se (se), |
---|
450 | .si (), |
---|
451 | .so () |
---|
452 | ); |
---|
453 | |
---|
454 | // |
---|
455 | //========================= |
---|
456 | // update for PCR registers |
---|
457 | //========================= |
---|
458 | // |
---|
459 | assign wsr_thread_inst_g[0] = |
---|
460 | tlu_wsr_inst_nq_g & ~ifu_tlu_flush_fd_w & tlu_thread_wsel_g[0]; |
---|
461 | assign wsr_thread_inst_g[1] = |
---|
462 | tlu_wsr_inst_nq_g & ~ifu_tlu_flush_fd_w & tlu_thread_wsel_g[1]; |
---|
463 | assign wsr_thread_inst_g[2] = |
---|
464 | tlu_wsr_inst_nq_g & ~ifu_tlu_flush_fd_w & tlu_thread_wsel_g[2]; |
---|
465 | assign wsr_thread_inst_g[3] = |
---|
466 | tlu_wsr_inst_nq_g & ~ifu_tlu_flush_fd_w & tlu_thread_wsel_g[3]; |
---|
467 | // |
---|
468 | // extracting the relevant bits from the wsr data bus |
---|
469 | assign pcr_wdata_in = |
---|
470 | {tlu_wsr_data_w[`WSR_PCR_CH_OVF:`WSR_PCR_CL_OVF], |
---|
471 | tlu_wsr_data_w[`WSR_PCR_SL_HI:`WSR_PCR_SL_LO], |
---|
472 | tlu_wsr_data_w[`WSR_PCR_UT:`WSR_PCR_PRIV]}; |
---|
473 | // |
---|
474 | // thread 0 |
---|
475 | assign wsr_pcr_sel[0] = wsr_thread_inst_g[0] & pcr_rw_g; |
---|
476 | |
---|
477 | assign update_picl_ovf[0] = |
---|
478 | (wsr_thread_inst_g[0] & pcr_rw_g) | |
---|
479 | (picl_cnt_wrap[0] ^ picl_cnt0[`PIB_PIC_CNT_WIDTH-1]); |
---|
480 | |
---|
481 | assign update_pich_ovf[0] = |
---|
482 | (wsr_thread_inst_g[0] & pcr_rw_g) | |
---|
483 | (pich_cnt_wrap[0] ^ pich_cnt0[`PIB_PIC_CNT_WIDTH-1]); |
---|
484 | // |
---|
485 | // modified for bug 2291 |
---|
486 | dffre_s #(`PIB_PCR_WIDTH-2) dffre_pcr0 ( |
---|
487 | // .din (tlu_wsr_data_w[`PIB_PCR_WIDTH-1:0]), |
---|
488 | .din (pcr_wdata_in[`PIB_PCR_WIDTH-3:0]), |
---|
489 | .q (pcr0[`PIB_PCR_WIDTH-3:0]), |
---|
490 | .rst (local_rst), |
---|
491 | .en (wsr_pcr_sel[0]), |
---|
492 | .clk (clk), |
---|
493 | .se (se), |
---|
494 | .si (), |
---|
495 | .so () |
---|
496 | ); |
---|
497 | |
---|
498 | mux2ds mux_pcr0_picl_ovf ( |
---|
499 | .in0(pcr_wdata_in[`PIB_PCR_CL_OVF]), |
---|
500 | .in1(picl_cnt_wrap[0] ^ picl_cnt0[`PIB_PIC_CNT_WIDTH-1]), |
---|
501 | .sel0(wsr_pcr_sel[0]), |
---|
502 | .sel1(~wsr_pcr_sel[0]), |
---|
503 | .dout(picl_ovf_wdata_in[0]) |
---|
504 | ); |
---|
505 | |
---|
506 | // added for the new bug 2588 |
---|
507 | dffre_s dffre_pcr0_picl_ovf ( |
---|
508 | .din (picl_ovf_wdata_in[0]), |
---|
509 | .q (pcr0[`PIB_PCR_CL_OVF]), |
---|
510 | .clk (clk), |
---|
511 | .en (update_picl_ovf[0]), |
---|
512 | .rst (local_rst), |
---|
513 | .se (se), |
---|
514 | .si (), |
---|
515 | .so () |
---|
516 | ); |
---|
517 | |
---|
518 | mux2ds mux_pcr0_pich_ovf ( |
---|
519 | .in0(pcr_wdata_in[`PIB_PCR_CH_OVF]), |
---|
520 | .in1(pich_cnt_wrap[0] ^ pich_cnt0[`PIB_PIC_CNT_WIDTH-1]), |
---|
521 | .sel0(wsr_pcr_sel[0]), |
---|
522 | .sel1(~wsr_pcr_sel[0]), |
---|
523 | .dout(pich_ovf_wdata_in[0]) |
---|
524 | ); |
---|
525 | |
---|
526 | dffre_s dffre_pcr0_pich_ovf ( |
---|
527 | .din (pich_ovf_wdata_in[0]), |
---|
528 | .q (pcr0[`PIB_PCR_CH_OVF]), |
---|
529 | .clk (clk), |
---|
530 | .en (update_pich_ovf[0]), |
---|
531 | .rst (local_rst), |
---|
532 | .se (se), |
---|
533 | .si (), |
---|
534 | .so () |
---|
535 | ); |
---|
536 | // |
---|
537 | // thread 1 |
---|
538 | |
---|
539 | assign wsr_pcr_sel[1] = wsr_thread_inst_g[1] & pcr_rw_g; |
---|
540 | |
---|
541 | assign update_picl_ovf[1] = |
---|
542 | (wsr_thread_inst_g[1] & pcr_rw_g) | |
---|
543 | (picl_cnt_wrap[1] ^ picl_cnt1[`PIB_PIC_CNT_WIDTH-1]); |
---|
544 | |
---|
545 | assign update_pich_ovf[1] = |
---|
546 | (wsr_thread_inst_g[1] & pcr_rw_g) | |
---|
547 | (pich_cnt_wrap[1] ^ pich_cnt1[`PIB_PIC_CNT_WIDTH-1]); |
---|
548 | |
---|
549 | dffre_s #(`PIB_PCR_WIDTH-2) dffre_pcr1 ( |
---|
550 | // .din (tlu_wsr_data_w[`PIB_PCR_WIDTH-1:0]), |
---|
551 | .din (pcr_wdata_in[`PIB_PCR_WIDTH-3:0]), |
---|
552 | .q (pcr1[`PIB_PCR_WIDTH-3:0]), |
---|
553 | .rst (local_rst), |
---|
554 | .en (wsr_pcr_sel[1]), |
---|
555 | .clk (clk), |
---|
556 | .se (se), |
---|
557 | .si (), |
---|
558 | .so () |
---|
559 | ); |
---|
560 | |
---|
561 | mux2ds mux_pcr1_picl_ovf ( |
---|
562 | .in0(pcr_wdata_in[`PIB_PCR_CL_OVF]), |
---|
563 | .in1(picl_cnt_wrap[1] ^ picl_cnt1[`PIB_PIC_CNT_WIDTH-1]), |
---|
564 | .sel0(wsr_pcr_sel[1]), |
---|
565 | .sel1(~wsr_pcr_sel[1]), |
---|
566 | .dout(picl_ovf_wdata_in[1]) |
---|
567 | ); |
---|
568 | // added for the new bug 2588 |
---|
569 | dffre_s dffre_pcr1_picl_ovf ( |
---|
570 | .din (picl_ovf_wdata_in[1]), |
---|
571 | .q (pcr1[`PIB_PCR_CL_OVF]), |
---|
572 | .clk (clk), |
---|
573 | .en (update_picl_ovf[1]), |
---|
574 | .rst (local_rst), |
---|
575 | .se (se), |
---|
576 | .si (), |
---|
577 | .so () |
---|
578 | ); |
---|
579 | |
---|
580 | mux2ds mux_pcr1_pich_ovf ( |
---|
581 | .in0(pcr_wdata_in[`PIB_PCR_CH_OVF]), |
---|
582 | .in1(pich_cnt_wrap[1] ^ pich_cnt1[`PIB_PIC_CNT_WIDTH-1]), |
---|
583 | .sel0(wsr_pcr_sel[1]), |
---|
584 | .sel1(~wsr_pcr_sel[1]), |
---|
585 | .dout(pich_ovf_wdata_in[1]) |
---|
586 | ); |
---|
587 | |
---|
588 | dffre_s dffre_pcr1_pich_ovf ( |
---|
589 | .din (pich_ovf_wdata_in[1]), |
---|
590 | .q (pcr1[`PIB_PCR_CH_OVF]), |
---|
591 | .clk (clk), |
---|
592 | .en (update_pich_ovf[1]), |
---|
593 | .rst (local_rst), |
---|
594 | .se (se), |
---|
595 | .si (), |
---|
596 | .so () |
---|
597 | ); |
---|
598 | // |
---|
599 | // thread 2 |
---|
600 | |
---|
601 | assign wsr_pcr_sel[2] = wsr_thread_inst_g[2] & pcr_rw_g; |
---|
602 | |
---|
603 | assign update_picl_ovf[2] = |
---|
604 | (wsr_thread_inst_g[2] & pcr_rw_g) | |
---|
605 | (picl_cnt_wrap[2] ^ picl_cnt2[`PIB_PIC_CNT_WIDTH-1]); |
---|
606 | |
---|
607 | assign update_pich_ovf[2] = |
---|
608 | (wsr_thread_inst_g[2] & pcr_rw_g) | |
---|
609 | (pich_cnt_wrap[2] ^ pich_cnt2[`PIB_PIC_CNT_WIDTH-1]); |
---|
610 | |
---|
611 | dffre_s #(`PIB_PCR_WIDTH-2) dffre_pcr2 ( |
---|
612 | // .din (tlu_wsr_data_w[`PIB_PCR_WIDTH-1:0]), |
---|
613 | .din (pcr_wdata_in[`PIB_PCR_WIDTH-3:0]), |
---|
614 | .q (pcr2[`PIB_PCR_WIDTH-3:0]), |
---|
615 | .rst (local_rst), |
---|
616 | .en (wsr_pcr_sel[2]), |
---|
617 | .clk (clk), |
---|
618 | .se (se), |
---|
619 | .si (), |
---|
620 | .so () |
---|
621 | ); |
---|
622 | |
---|
623 | mux2ds mux_pcr2_picl_ovf ( |
---|
624 | .in0(pcr_wdata_in[`PIB_PCR_CL_OVF]), |
---|
625 | .in1(picl_cnt_wrap[2] ^ picl_cnt2[`PIB_PIC_CNT_WIDTH-1]), |
---|
626 | .sel0(wsr_pcr_sel[2]), |
---|
627 | .sel1(~wsr_pcr_sel[2]), |
---|
628 | .dout(picl_ovf_wdata_in[2]) |
---|
629 | ); |
---|
630 | |
---|
631 | // added for the new bug 2588 |
---|
632 | dffre_s dffre_pcr2_picl_ovf ( |
---|
633 | .din (picl_ovf_wdata_in[2]), |
---|
634 | .q (pcr2[`PIB_PCR_CL_OVF]), |
---|
635 | .clk (clk), |
---|
636 | .en (update_picl_ovf[2]), |
---|
637 | .rst (local_rst), |
---|
638 | .se (se), |
---|
639 | .si (), |
---|
640 | .so () |
---|
641 | ); |
---|
642 | |
---|
643 | mux2ds mux_pcr2_pich_ovf ( |
---|
644 | .in0(pcr_wdata_in[`PIB_PCR_CH_OVF]), |
---|
645 | .in1(pich_cnt_wrap[2] ^ pich_cnt2[`PIB_PIC_CNT_WIDTH-1]), |
---|
646 | .sel0(wsr_pcr_sel[2]), |
---|
647 | .sel1(~wsr_pcr_sel[2]), |
---|
648 | .dout(pich_ovf_wdata_in[2]) |
---|
649 | ); |
---|
650 | |
---|
651 | dffre_s dffre_pcr2_pich_ovf ( |
---|
652 | .din (pich_ovf_wdata_in[2]), |
---|
653 | .q (pcr2[`PIB_PCR_CH_OVF]), |
---|
654 | .clk (clk), |
---|
655 | .en (update_pich_ovf[2]), |
---|
656 | .rst (local_rst), |
---|
657 | .se (se), |
---|
658 | .si (), |
---|
659 | .so () |
---|
660 | ); |
---|
661 | // |
---|
662 | // thread 3 |
---|
663 | |
---|
664 | assign wsr_pcr_sel[3] = wsr_thread_inst_g[3] & pcr_rw_g; |
---|
665 | |
---|
666 | assign update_picl_ovf[3] = |
---|
667 | (wsr_thread_inst_g[3] & pcr_rw_g) | |
---|
668 | (picl_cnt_wrap[3] ^ picl_cnt3[`PIB_PIC_CNT_WIDTH-1]); |
---|
669 | |
---|
670 | assign update_pich_ovf[3] = |
---|
671 | (wsr_thread_inst_g[3] & pcr_rw_g) | |
---|
672 | (pich_cnt_wrap[3] ^ pich_cnt3[`PIB_PIC_CNT_WIDTH-1]); |
---|
673 | |
---|
674 | dffre_s #(`PIB_PCR_WIDTH-2) dffre_pcr3 ( |
---|
675 | // .din (tlu_wsr_data_w[`PIB_PCR_WIDTH-1:0]), |
---|
676 | .din (pcr_wdata_in[`PIB_PCR_WIDTH-3:0]), |
---|
677 | .q (pcr3[`PIB_PCR_WIDTH-3:0]), |
---|
678 | .rst (local_rst), |
---|
679 | .en (wsr_pcr_sel[3]), |
---|
680 | .clk (clk), |
---|
681 | .se (se), |
---|
682 | .si (), |
---|
683 | .so () |
---|
684 | ); |
---|
685 | |
---|
686 | mux2ds mux_pcr3_picl_ovf ( |
---|
687 | .in0(pcr_wdata_in[`PIB_PCR_CL_OVF]), |
---|
688 | .in1(picl_cnt_wrap[3] ^ picl_cnt3[`PIB_PIC_CNT_WIDTH-1]), |
---|
689 | .sel0(wsr_pcr_sel[3]), |
---|
690 | .sel1(~wsr_pcr_sel[3]), |
---|
691 | .dout(picl_ovf_wdata_in[3]) |
---|
692 | ); |
---|
693 | |
---|
694 | // added for the new bug 2588 |
---|
695 | dffre_s dffre_pcr3_picl_ovf ( |
---|
696 | .din (picl_ovf_wdata_in[3]), |
---|
697 | .q (pcr3[`PIB_PCR_CL_OVF]), |
---|
698 | .clk (clk), |
---|
699 | .en (update_picl_ovf[3]), |
---|
700 | .rst (local_rst), |
---|
701 | .se (se), |
---|
702 | .si (), |
---|
703 | .so () |
---|
704 | ); |
---|
705 | |
---|
706 | mux2ds mux_pcr3_pich_ovf ( |
---|
707 | .in0(pcr_wdata_in[`PIB_PCR_CH_OVF]), |
---|
708 | .in1(pich_cnt_wrap[3] ^ pich_cnt3[`PIB_PIC_CNT_WIDTH-1]), |
---|
709 | .sel0(wsr_pcr_sel[3]), |
---|
710 | .sel1(~wsr_pcr_sel[3]), |
---|
711 | .dout(pich_ovf_wdata_in[3]) |
---|
712 | ); |
---|
713 | |
---|
714 | dffre_s dffre_pcr3_pich_ovf ( |
---|
715 | .din (pich_ovf_wdata_in[3]), |
---|
716 | .q (pcr3[`PIB_PCR_CH_OVF]), |
---|
717 | .clk (clk), |
---|
718 | .en (update_pich_ovf[3]), |
---|
719 | .rst (local_rst), |
---|
720 | .se (se), |
---|
721 | .si (), |
---|
722 | .so () |
---|
723 | ); |
---|
724 | |
---|
725 | // |
---|
726 | //==================== |
---|
727 | // threading of events |
---|
728 | //==================== |
---|
729 | // |
---|
730 | // icache misses |
---|
731 | assign imiss_thread_g[0] = imiss_g & tlu_thread_wsel_g[0]; |
---|
732 | assign imiss_thread_g[1] = imiss_g & tlu_thread_wsel_g[1]; |
---|
733 | assign imiss_thread_g[2] = imiss_g & tlu_thread_wsel_g[2]; |
---|
734 | assign imiss_thread_g[3] = imiss_g & tlu_thread_wsel_g[3]; |
---|
735 | // |
---|
736 | // itlb misses |
---|
737 | assign immu_miss_thread_g[0] = immu_miss_g & tlu_thread_wsel_g[0]; |
---|
738 | assign immu_miss_thread_g[1] = immu_miss_g & tlu_thread_wsel_g[1]; |
---|
739 | assign immu_miss_thread_g[2] = immu_miss_g & tlu_thread_wsel_g[2]; |
---|
740 | assign immu_miss_thread_g[3] = immu_miss_g & tlu_thread_wsel_g[3]; |
---|
741 | // |
---|
742 | // dtlb misses |
---|
743 | assign dmmu_miss_thread_g[0] = lsu_tlu_dmmu_miss_g & tlu_thread_wsel_g[0]; |
---|
744 | assign dmmu_miss_thread_g[1] = lsu_tlu_dmmu_miss_g & tlu_thread_wsel_g[1]; |
---|
745 | assign dmmu_miss_thread_g[2] = lsu_tlu_dmmu_miss_g & tlu_thread_wsel_g[2]; |
---|
746 | assign dmmu_miss_thread_g[3] = lsu_tlu_dmmu_miss_g & tlu_thread_wsel_g[3]; |
---|
747 | // |
---|
748 | // itlb misses |
---|
749 | assign fpu_cmplt_thread[0] = |
---|
750 | ffu_tlu_fpu_cmplt & (~ffu_tlu_fpu_tid[0] & ~ffu_tlu_fpu_tid[1]); |
---|
751 | assign fpu_cmplt_thread[1] = |
---|
752 | ffu_tlu_fpu_cmplt & (ffu_tlu_fpu_tid[0] & ~ffu_tlu_fpu_tid[1]); |
---|
753 | assign fpu_cmplt_thread[2] = |
---|
754 | ffu_tlu_fpu_cmplt & (~ffu_tlu_fpu_tid[0] & ffu_tlu_fpu_tid[1]); |
---|
755 | assign fpu_cmplt_thread[3] = |
---|
756 | ffu_tlu_fpu_cmplt & (ffu_tlu_fpu_tid[0] & ffu_tlu_fpu_tid[1]); |
---|
757 | |
---|
758 | //==================== |
---|
759 | // assigning of events |
---|
760 | //==================== |
---|
761 | // |
---|
762 | // thread 0 |
---|
763 | assign picl_event0[`PICL_MASK_SB_FULL] = lsu_tlu_stb_full_w2[0]; |
---|
764 | assign picl_event0[`PICL_MASK_FP_INST] = fpu_cmplt_thread[0]; |
---|
765 | assign picl_event0[`PICL_MASK_IC_MISS] = imiss_thread_g[0]; |
---|
766 | assign picl_event0[`PICL_MASK_DC_MISS] = lsu_tlu_dcache_miss_w2[0]; |
---|
767 | assign picl_event0[`PICL_MASK_ITLB_MISS] = immu_miss_thread_g[0]; |
---|
768 | assign picl_event0[`PICL_MASK_DTLB_MISS] = dmmu_miss_thread_g[0]; |
---|
769 | assign picl_event0[`PICL_MASK_L2_IMISS] = ifu_tlu_l2imiss[0]; |
---|
770 | assign picl_event0[`PICL_MASK_L2_DMISS] = lsu_tlu_l2_dmiss[0]; |
---|
771 | // |
---|
772 | // thread 1 |
---|
773 | assign picl_event1[`PICL_MASK_SB_FULL] = lsu_tlu_stb_full_w2[1]; |
---|
774 | assign picl_event1[`PICL_MASK_FP_INST] = fpu_cmplt_thread[1]; |
---|
775 | assign picl_event1[`PICL_MASK_IC_MISS] = imiss_thread_g[1]; |
---|
776 | assign picl_event1[`PICL_MASK_DC_MISS] = lsu_tlu_dcache_miss_w2[1]; |
---|
777 | assign picl_event1[`PICL_MASK_ITLB_MISS] = immu_miss_thread_g[1]; |
---|
778 | assign picl_event1[`PICL_MASK_DTLB_MISS] = dmmu_miss_thread_g[1]; |
---|
779 | assign picl_event1[`PICL_MASK_L2_IMISS] = ifu_tlu_l2imiss[1]; |
---|
780 | assign picl_event1[`PICL_MASK_L2_DMISS] = lsu_tlu_l2_dmiss[1]; |
---|
781 | // |
---|
782 | // thread 2 |
---|
783 | assign picl_event2[`PICL_MASK_SB_FULL] = lsu_tlu_stb_full_w2[2]; |
---|
784 | assign picl_event2[`PICL_MASK_FP_INST] = fpu_cmplt_thread[2]; |
---|
785 | assign picl_event2[`PICL_MASK_IC_MISS] = imiss_thread_g[2]; |
---|
786 | assign picl_event2[`PICL_MASK_DC_MISS] = lsu_tlu_dcache_miss_w2[2]; |
---|
787 | assign picl_event2[`PICL_MASK_ITLB_MISS] = immu_miss_thread_g[2]; |
---|
788 | assign picl_event2[`PICL_MASK_DTLB_MISS] = dmmu_miss_thread_g[2]; |
---|
789 | assign picl_event2[`PICL_MASK_L2_IMISS] = ifu_tlu_l2imiss[2]; |
---|
790 | assign picl_event2[`PICL_MASK_L2_DMISS] = lsu_tlu_l2_dmiss[2]; |
---|
791 | // |
---|
792 | // thread 3 |
---|
793 | assign picl_event3[`PICL_MASK_SB_FULL] = lsu_tlu_stb_full_w2[3]; |
---|
794 | assign picl_event3[`PICL_MASK_FP_INST] = fpu_cmplt_thread[3]; |
---|
795 | assign picl_event3[`PICL_MASK_IC_MISS] = imiss_thread_g[3]; |
---|
796 | assign picl_event3[`PICL_MASK_DC_MISS] = lsu_tlu_dcache_miss_w2[3]; |
---|
797 | assign picl_event3[`PICL_MASK_ITLB_MISS] = immu_miss_thread_g[3]; |
---|
798 | assign picl_event3[`PICL_MASK_DTLB_MISS] = dmmu_miss_thread_g[3]; |
---|
799 | assign picl_event3[`PICL_MASK_L2_IMISS] = ifu_tlu_l2imiss[3]; |
---|
800 | assign picl_event3[`PICL_MASK_L2_DMISS] = lsu_tlu_l2_dmiss[3]; |
---|
801 | |
---|
802 | //====================== |
---|
803 | // decode for PIC events |
---|
804 | //====================== |
---|
805 | // |
---|
806 | // thread 0 |
---|
807 | |
---|
808 | assign pic_cnt_en[0] = |
---|
809 | (~tlu_hpstate_priv[0] & ~tlu_pstate_priv[0] & pcr0[`PIB_PCR_UT]) | |
---|
810 | (~tlu_hpstate_enb[0] & tlu_hpstate_priv[0] & pcr0[`PIB_PCR_ST]) | |
---|
811 | (tlu_hpstate_enb[0] & tlu_pstate_priv[0] & ~tlu_hpstate_priv[0] & |
---|
812 | pcr0[`PIB_PCR_ST]); |
---|
813 | // |
---|
814 | // picl mask decodes |
---|
815 | assign picl_mask0[`PICL_MASK_SB_FULL] = |
---|
816 | ((pcr0[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_SB_FULL_CNT) & |
---|
817 | pic_cnt_en[0]); |
---|
818 | assign picl_mask0[`PICL_MASK_FP_INST] = |
---|
819 | ((pcr0[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_FP_INST_CNT) & |
---|
820 | pic_cnt_en[0]); |
---|
821 | assign picl_mask0[`PICL_MASK_IC_MISS] = |
---|
822 | ((pcr0[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_IC_MISS_CNT) & |
---|
823 | pic_cnt_en[0]); |
---|
824 | assign picl_mask0[`PICL_MASK_DC_MISS] = |
---|
825 | ((pcr0[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_DC_MISS_CNT) & |
---|
826 | pic_cnt_en[0]); |
---|
827 | assign picl_mask0[`PICL_MASK_ITLB_MISS] = |
---|
828 | ((pcr0[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_ITLB_MISS_CNT) & |
---|
829 | pic_cnt_en[0]); |
---|
830 | assign picl_mask0[`PICL_MASK_DTLB_MISS] = |
---|
831 | ((pcr0[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_DTLB_MISS_CNT) & |
---|
832 | pic_cnt_en[0]); |
---|
833 | assign picl_mask0[`PICL_MASK_L2_IMISS] = |
---|
834 | ((pcr0[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_L2_IMISS_CNT) & |
---|
835 | pic_cnt_en[0]); |
---|
836 | assign picl_mask0[`PICL_MASK_L2_DMISS] = |
---|
837 | ((pcr0[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_L2_DMISS_CNT) & |
---|
838 | pic_cnt_en[0]); |
---|
839 | // |
---|
840 | // thread 1 |
---|
841 | |
---|
842 | assign pic_cnt_en[1] = |
---|
843 | (~tlu_hpstate_priv[1] & ~tlu_pstate_priv[1] & pcr1[`PIB_PCR_UT]) | |
---|
844 | (~tlu_hpstate_enb[1] & tlu_hpstate_priv[1] & pcr1[`PIB_PCR_ST]) | |
---|
845 | (tlu_hpstate_enb[1] & tlu_pstate_priv[1] & ~tlu_hpstate_priv[1] & |
---|
846 | pcr1[`PIB_PCR_ST]); |
---|
847 | // |
---|
848 | // picl mask decodes |
---|
849 | assign picl_mask1[`PICL_MASK_SB_FULL] = |
---|
850 | ((pcr1[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_SB_FULL_CNT) & |
---|
851 | pic_cnt_en[1]); |
---|
852 | assign picl_mask1[`PICL_MASK_FP_INST] = |
---|
853 | ((pcr1[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_FP_INST_CNT) & |
---|
854 | pic_cnt_en[1]); |
---|
855 | assign picl_mask1[`PICL_MASK_IC_MISS] = |
---|
856 | ((pcr1[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_IC_MISS_CNT) & |
---|
857 | pic_cnt_en[1]); |
---|
858 | assign picl_mask1[`PICL_MASK_DC_MISS] = |
---|
859 | ((pcr1[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_DC_MISS_CNT) & |
---|
860 | pic_cnt_en[1]); |
---|
861 | assign picl_mask1[`PICL_MASK_ITLB_MISS] = |
---|
862 | ((pcr1[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_ITLB_MISS_CNT) & |
---|
863 | pic_cnt_en[1]); |
---|
864 | assign picl_mask1[`PICL_MASK_DTLB_MISS] = |
---|
865 | ((pcr1[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_DTLB_MISS_CNT) & |
---|
866 | pic_cnt_en[1]); |
---|
867 | assign picl_mask1[`PICL_MASK_L2_IMISS] = |
---|
868 | ((pcr1[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_L2_IMISS_CNT) & |
---|
869 | pic_cnt_en[1]); |
---|
870 | assign picl_mask1[`PICL_MASK_L2_DMISS] = |
---|
871 | ((pcr1[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_L2_DMISS_CNT) & |
---|
872 | pic_cnt_en[1]); |
---|
873 | // |
---|
874 | // thread 2 |
---|
875 | |
---|
876 | assign pic_cnt_en[2] = |
---|
877 | (~tlu_hpstate_priv[2] & ~tlu_pstate_priv[2] & pcr2[`PIB_PCR_UT]) | |
---|
878 | (~tlu_hpstate_enb[2] & tlu_hpstate_priv[2] & pcr2[`PIB_PCR_ST]) | |
---|
879 | (tlu_hpstate_enb[2] & tlu_pstate_priv[2] & ~tlu_hpstate_priv[2] & |
---|
880 | pcr2[`PIB_PCR_ST]); |
---|
881 | // |
---|
882 | // picl mask decodes |
---|
883 | assign picl_mask2[`PICL_MASK_SB_FULL] = |
---|
884 | ((pcr2[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_SB_FULL_CNT) & |
---|
885 | pic_cnt_en[2]); |
---|
886 | assign picl_mask2[`PICL_MASK_FP_INST] = |
---|
887 | ((pcr2[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_FP_INST_CNT) & |
---|
888 | pic_cnt_en[2]); |
---|
889 | assign picl_mask2[`PICL_MASK_IC_MISS] = |
---|
890 | ((pcr2[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_IC_MISS_CNT) & |
---|
891 | pic_cnt_en[2]); |
---|
892 | assign picl_mask2[`PICL_MASK_DC_MISS] = |
---|
893 | ((pcr2[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_DC_MISS_CNT) & |
---|
894 | pic_cnt_en[2]); |
---|
895 | assign picl_mask2[`PICL_MASK_ITLB_MISS] = |
---|
896 | ((pcr2[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_ITLB_MISS_CNT) & |
---|
897 | pic_cnt_en[2]); |
---|
898 | assign picl_mask2[`PICL_MASK_DTLB_MISS] = |
---|
899 | ((pcr2[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_DTLB_MISS_CNT) & |
---|
900 | pic_cnt_en[2]); |
---|
901 | assign picl_mask2[`PICL_MASK_L2_IMISS] = |
---|
902 | ((pcr2[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_L2_IMISS_CNT) & |
---|
903 | pic_cnt_en[2]); |
---|
904 | assign picl_mask2[`PICL_MASK_L2_DMISS] = |
---|
905 | ((pcr2[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_L2_DMISS_CNT) & |
---|
906 | pic_cnt_en[2]); |
---|
907 | // |
---|
908 | // thread 3 |
---|
909 | |
---|
910 | assign pic_cnt_en[3] = |
---|
911 | (~tlu_hpstate_priv[3] & ~tlu_pstate_priv[3] & pcr3[`PIB_PCR_UT]) | |
---|
912 | (~tlu_hpstate_enb[3] & tlu_hpstate_priv[3] & pcr3[`PIB_PCR_ST]) | |
---|
913 | (tlu_hpstate_enb[3] & tlu_pstate_priv[3] & ~tlu_hpstate_priv[3] & |
---|
914 | pcr3[`PIB_PCR_ST]); |
---|
915 | // |
---|
916 | // added for timing |
---|
917 | dff_s #(`TLU_THRD_NUM) dff_pic_cnt_en_w2 ( |
---|
918 | .din (pic_cnt_en[`TLU_THRD_NUM-1:0]), |
---|
919 | .q (pic_cnt_en_w2[`TLU_THRD_NUM-1:0]), |
---|
920 | .clk (clk), |
---|
921 | .se (se), |
---|
922 | .si (), |
---|
923 | .so () |
---|
924 | ); |
---|
925 | |
---|
926 | // |
---|
927 | // picl mask decodes |
---|
928 | assign picl_mask3[`PICL_MASK_SB_FULL] = |
---|
929 | ((pcr3[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_SB_FULL_CNT) & |
---|
930 | pic_cnt_en[3]); |
---|
931 | assign picl_mask3[`PICL_MASK_FP_INST] = |
---|
932 | ((pcr3[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_FP_INST_CNT) & |
---|
933 | pic_cnt_en[3]); |
---|
934 | assign picl_mask3[`PICL_MASK_IC_MISS] = |
---|
935 | ((pcr3[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_IC_MISS_CNT) & |
---|
936 | pic_cnt_en[3]); |
---|
937 | assign picl_mask3[`PICL_MASK_DC_MISS] = |
---|
938 | ((pcr3[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_DC_MISS_CNT) & |
---|
939 | pic_cnt_en[3]); |
---|
940 | assign picl_mask3[`PICL_MASK_ITLB_MISS] = |
---|
941 | ((pcr3[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_ITLB_MISS_CNT) & |
---|
942 | pic_cnt_en[3]); |
---|
943 | assign picl_mask3[`PICL_MASK_DTLB_MISS] = |
---|
944 | ((pcr3[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_DTLB_MISS_CNT) & |
---|
945 | pic_cnt_en[3]); |
---|
946 | assign picl_mask3[`PICL_MASK_L2_IMISS] = |
---|
947 | ((pcr3[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_L2_IMISS_CNT) & |
---|
948 | pic_cnt_en[3]); |
---|
949 | assign picl_mask3[`PICL_MASK_L2_DMISS] = |
---|
950 | ((pcr3[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO] == `PIB_L2_DMISS_CNT) & |
---|
951 | pic_cnt_en[3]); |
---|
952 | |
---|
953 | //================================================================== |
---|
954 | // update the picls - could be sperated into a dp block if needed |
---|
955 | //================================================================== |
---|
956 | // added for bug 2919 |
---|
957 | // rrobin scheduler to choose thread to update |
---|
958 | dffr_s #(2) dffr_pic_update_sel_ctr ( |
---|
959 | .din (pic_update_sel_incr[1:0]), |
---|
960 | .q (pic_update_sel_ctr[1:0]), |
---|
961 | .rst (local_rst), |
---|
962 | .clk (clk), |
---|
963 | .se (se), |
---|
964 | .si (), |
---|
965 | .so () |
---|
966 | ); |
---|
967 | |
---|
968 | assign pic_update_sel_incr[1:0] = |
---|
969 | pic_update_sel_ctr[1:0] + 2'b01; |
---|
970 | |
---|
971 | assign pic_update_ctl[0] = |
---|
972 | ~|(pic_update_sel_incr[1:0]); |
---|
973 | assign pic_update_ctl[1] = |
---|
974 | ~pic_update_sel_incr[1] & pic_update_sel_incr[0]; |
---|
975 | assign pic_update_ctl[2] = |
---|
976 | pic_update_sel_incr[1] & ~pic_update_sel_incr[0]; |
---|
977 | assign pic_update_ctl[3] = |
---|
978 | &(pic_update_sel_incr[1:0]); |
---|
979 | // |
---|
980 | // EVQs for PICL |
---|
981 | // |
---|
982 | // masking events for increment for picl evq update |
---|
983 | assign incr_evq_din[0] = |
---|
984 | (|(picl_mask0[`PICL_MASK_WIDTH-1:0] & |
---|
985 | picl_event0[`PICL_MASK_WIDTH-1:0])); |
---|
986 | assign incr_evq_din[1] = |
---|
987 | (|(picl_mask1[`PICL_MASK_WIDTH-1:0] & |
---|
988 | picl_event1[`PICL_MASK_WIDTH-1:0])); |
---|
989 | assign incr_evq_din[2] = |
---|
990 | (|(picl_mask2[`PICL_MASK_WIDTH-1:0] & |
---|
991 | picl_event2[`PICL_MASK_WIDTH-1:0])); |
---|
992 | assign incr_evq_din[3] = |
---|
993 | (|(picl_mask3[`PICL_MASK_WIDTH-1:0] & |
---|
994 | picl_event3[`PICL_MASK_WIDTH-1:0])); |
---|
995 | // |
---|
996 | // added due to timing |
---|
997 | dff_s #(`TLU_THRD_NUM) dff_incr_evq ( |
---|
998 | .din (incr_evq_din[`TLU_THRD_NUM-1:0]), |
---|
999 | .q (incr_evq[`TLU_THRD_NUM-1:0]), |
---|
1000 | .clk (clk), |
---|
1001 | .se (se), |
---|
1002 | .si (), |
---|
1003 | .so () |
---|
1004 | ); |
---|
1005 | // |
---|
1006 | // constructing controls to update the picl_evq |
---|
1007 | assign update_evq_sel[0] = (local_rst | pic_update_ctl[0] | incr_evq[0]); |
---|
1008 | assign update_evq_sel[1] = (local_rst | pic_update_ctl[1] | incr_evq[1]); |
---|
1009 | assign update_evq_sel[2] = (local_rst | pic_update_ctl[2] | incr_evq[2]); |
---|
1010 | assign update_evq_sel[3] = (local_rst | pic_update_ctl[3] | incr_evq[3]); |
---|
1011 | // |
---|
1012 | // increment evq count for each thread |
---|
1013 | // thread 0 |
---|
1014 | tlu_addern_32 #(`PIB_EVQ_CNT_WIDTH,1) picl_evq0_adder ( |
---|
1015 | .din (picl_evq0[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1016 | .incr (1'b1), |
---|
1017 | .sum (picl_evq0_sum[`PIB_EVQ_CNT_WIDTH-1:0]) |
---|
1018 | ) ; |
---|
1019 | |
---|
1020 | mux2ds #(`PIB_EVQ_CNT_WIDTH) mux_update_evq0_data ( |
---|
1021 | .in0 ({`PIB_EVQ_CNT_WIDTH{1'b0}}), |
---|
1022 | .in1 (picl_evq0_sum[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1023 | .sel0 (local_rst | pic_update_ctl[0]), |
---|
1024 | .sel1 (~(local_rst | pic_update_ctl[0])), |
---|
1025 | .dout (update_evq0_data[`PIB_EVQ_CNT_WIDTH-1:0]) |
---|
1026 | ); |
---|
1027 | |
---|
1028 | dffe_s #(`PIB_EVQ_CNT_WIDTH) dff_picl_evq0 ( |
---|
1029 | .din (update_evq0_data[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1030 | .q (picl_evq0[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1031 | .clk (clk), |
---|
1032 | .en (update_evq_sel[0]), |
---|
1033 | .se (se), |
---|
1034 | .si (), |
---|
1035 | .so () |
---|
1036 | ); |
---|
1037 | // |
---|
1038 | // thread 1 |
---|
1039 | tlu_addern_32 #(`PIB_EVQ_CNT_WIDTH,1) picl_evq1_adder ( |
---|
1040 | .din (picl_evq1[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1041 | .incr (1'b1), |
---|
1042 | .sum (picl_evq1_sum[`PIB_EVQ_CNT_WIDTH-1:0]) |
---|
1043 | ) ; |
---|
1044 | |
---|
1045 | mux2ds #(`PIB_EVQ_CNT_WIDTH) mux_update_evq1_data ( |
---|
1046 | .in0 ({`PIB_EVQ_CNT_WIDTH{1'b0}}), |
---|
1047 | .in1 (picl_evq1_sum[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1048 | .sel0 (local_rst | pic_update_ctl[1]), |
---|
1049 | .sel1 (~(local_rst | pic_update_ctl[1])), |
---|
1050 | .dout (update_evq1_data[`PIB_EVQ_CNT_WIDTH-1:0]) |
---|
1051 | ); |
---|
1052 | |
---|
1053 | dffe_s #(`PIB_EVQ_CNT_WIDTH) dff_picl_evq1 ( |
---|
1054 | .din (update_evq1_data[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1055 | .q (picl_evq1[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1056 | .clk (clk), |
---|
1057 | .en (update_evq_sel[1]), |
---|
1058 | .se (se), |
---|
1059 | .si (), |
---|
1060 | .so () |
---|
1061 | ); |
---|
1062 | // |
---|
1063 | // thread 2 |
---|
1064 | tlu_addern_32 #(`PIB_EVQ_CNT_WIDTH,1) picl_evq2_adder ( |
---|
1065 | .din (picl_evq2[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1066 | .incr (1'b1), |
---|
1067 | .sum (picl_evq2_sum[`PIB_EVQ_CNT_WIDTH-1:0]) |
---|
1068 | ) ; |
---|
1069 | |
---|
1070 | mux2ds #(`PIB_EVQ_CNT_WIDTH) mux_update_evq2_data ( |
---|
1071 | .in0 ({`PIB_EVQ_CNT_WIDTH{1'b0}}), |
---|
1072 | .in1 (picl_evq2_sum[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1073 | .sel0 (local_rst | pic_update_ctl[2]), |
---|
1074 | .sel1 (~(local_rst | pic_update_ctl[2])), |
---|
1075 | .dout (update_evq2_data[`PIB_EVQ_CNT_WIDTH-1:0]) |
---|
1076 | ); |
---|
1077 | |
---|
1078 | dffe_s #(`PIB_EVQ_CNT_WIDTH) dff_picl_evq2 ( |
---|
1079 | .din (update_evq2_data[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1080 | .q (picl_evq2[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1081 | .clk (clk), |
---|
1082 | .en (update_evq_sel[2]), |
---|
1083 | .se (se), |
---|
1084 | .si (), |
---|
1085 | .so () |
---|
1086 | ); |
---|
1087 | // |
---|
1088 | // thread 3 |
---|
1089 | tlu_addern_32 #(`PIB_EVQ_CNT_WIDTH,1) picl_evq3_adder ( |
---|
1090 | .din (picl_evq3[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1091 | .incr (1'b1), |
---|
1092 | .sum (picl_evq3_sum[`PIB_EVQ_CNT_WIDTH-1:0]) |
---|
1093 | ) ; |
---|
1094 | |
---|
1095 | mux2ds #(`PIB_EVQ_CNT_WIDTH) mux_update_evq3_data ( |
---|
1096 | .in0 ({`PIB_EVQ_CNT_WIDTH{1'b0}}), |
---|
1097 | .in1 (picl_evq3_sum[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1098 | .sel0 (local_rst | pic_update_ctl[3]), |
---|
1099 | .sel1 (~(local_rst | pic_update_ctl[3])), |
---|
1100 | .dout (update_evq3_data[`PIB_EVQ_CNT_WIDTH-1:0]) |
---|
1101 | ); |
---|
1102 | |
---|
1103 | dffe_s #(`PIB_EVQ_CNT_WIDTH) dff_picl_evq3 ( |
---|
1104 | .din (update_evq3_data[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1105 | .q (picl_evq3[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1106 | .clk (clk), |
---|
1107 | .en (update_evq_sel[3]), |
---|
1108 | .se (se), |
---|
1109 | .si (), |
---|
1110 | .so () |
---|
1111 | ); |
---|
1112 | // |
---|
1113 | // selelcting the thread for incrementing for picl |
---|
1114 | // |
---|
1115 | mux4ds #(`PIB_PIC_CNT_WIDTH) mux_picl_cnt_din ( |
---|
1116 | .in0 (picl_cnt0[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1117 | .in1 (picl_cnt1[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1118 | .in2 (picl_cnt2[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1119 | .in3 (picl_cnt3[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1120 | .sel0 (pic_update_ctl[0]), |
---|
1121 | .sel1 (pic_update_ctl[1]), |
---|
1122 | .sel2 (pic_update_ctl[2]), |
---|
1123 | .sel3 (pic_update_ctl[3]), |
---|
1124 | .dout (picl_cnt_din[`PIB_PIC_CNT_WIDTH-1:0]) |
---|
1125 | ); |
---|
1126 | // |
---|
1127 | // selecting the correct input for incrementing the picl |
---|
1128 | // thread0 |
---|
1129 | mux2ds #(`PIB_EVQ_CNT_WIDTH) mux_picl_evq0_din ( |
---|
1130 | .in0 (picl_evq0_sum[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1131 | .in1 (picl_evq0[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1132 | .sel0 (incr_evq[0]), |
---|
1133 | .sel1 (~incr_evq[0]), |
---|
1134 | .dout (picl_evq0_din[`PIB_EVQ_CNT_WIDTH-1:0]) |
---|
1135 | ); |
---|
1136 | // |
---|
1137 | // thread1 |
---|
1138 | mux2ds #(`PIB_EVQ_CNT_WIDTH) mux_picl_evq1_din ( |
---|
1139 | .in0 (picl_evq1_sum[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1140 | .in1 (picl_evq1[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1141 | .sel0 (incr_evq[1]), |
---|
1142 | .sel1 (~incr_evq[1]), |
---|
1143 | .dout (picl_evq1_din[`PIB_EVQ_CNT_WIDTH-1:0]) |
---|
1144 | ); |
---|
1145 | // |
---|
1146 | // thread2 |
---|
1147 | mux2ds #(`PIB_EVQ_CNT_WIDTH) mux_picl_evq2_din ( |
---|
1148 | .in0 (picl_evq2_sum[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1149 | .in1 (picl_evq2[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1150 | .sel0 (incr_evq[2]), |
---|
1151 | .sel1 (~incr_evq[2]), |
---|
1152 | .dout (picl_evq2_din[`PIB_EVQ_CNT_WIDTH-1:0]) |
---|
1153 | ); |
---|
1154 | // |
---|
1155 | // thread3 |
---|
1156 | mux2ds #(`PIB_EVQ_CNT_WIDTH) mux_picl_evq3_din ( |
---|
1157 | .in0 (picl_evq3_sum[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1158 | .in1 (picl_evq3[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1159 | .sel0 (incr_evq[3]), |
---|
1160 | .sel1 (~incr_evq[3]), |
---|
1161 | .dout (picl_evq3_din[`PIB_EVQ_CNT_WIDTH-1:0]) |
---|
1162 | ); |
---|
1163 | |
---|
1164 | // |
---|
1165 | mux4ds #(`PIB_EVQ_CNT_WIDTH) mux_picl_evq_din ( |
---|
1166 | .in0 (picl_evq0_din[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1167 | .in1 (picl_evq1_din[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1168 | .in2 (picl_evq2_din[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1169 | .in3 (picl_evq3_din[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1170 | .sel0 (pic_update_ctl[0]), |
---|
1171 | .sel1 (pic_update_ctl[1]), |
---|
1172 | .sel2 (pic_update_ctl[2]), |
---|
1173 | .sel3 (pic_update_ctl[3]), |
---|
1174 | .dout (picl_evq_din[`PIB_EVQ_CNT_WIDTH-1:0]) |
---|
1175 | ); |
---|
1176 | // |
---|
1177 | // picl incrementor - shared between four threads |
---|
1178 | // |
---|
1179 | tlu_addern_32 #(`PIB_PIC_CNT_WIDTH,`PIB_EVQ_CNT_WIDTH) picl_adder ( |
---|
1180 | .din (picl_cnt_din[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1181 | .incr (picl_evq_din[`PIB_EVQ_CNT_WIDTH-1:0]), |
---|
1182 | .sum (picl_cnt_sum[`PIB_PIC_CNT_WIDTH-1:0]) |
---|
1183 | ) ; |
---|
1184 | // |
---|
1185 | // construction mux selects for picl update |
---|
1186 | |
---|
1187 | assign wsr_pic_sel[0] = wsr_thread_inst_g[0] & (pic_npriv_rw_g | pic_priv_rw_g); |
---|
1188 | assign wsr_pic_sel[1] = wsr_thread_inst_g[1] & (pic_npriv_rw_g | pic_priv_rw_g); |
---|
1189 | assign wsr_pic_sel[2] = wsr_thread_inst_g[2] & (pic_npriv_rw_g | pic_priv_rw_g); |
---|
1190 | assign wsr_pic_sel[3] = wsr_thread_inst_g[3] & (pic_npriv_rw_g | pic_priv_rw_g); |
---|
1191 | |
---|
1192 | assign update_picl_sel[0] = (local_rst | pic_update_ctl[0] | wsr_pic_sel[0]); |
---|
1193 | assign update_picl_sel[1] = (local_rst | pic_update_ctl[1] | wsr_pic_sel[1]); |
---|
1194 | assign update_picl_sel[2] = (local_rst | pic_update_ctl[2] | wsr_pic_sel[2]); |
---|
1195 | assign update_picl_sel[3] = (local_rst | pic_update_ctl[3] | wsr_pic_sel[3]); |
---|
1196 | |
---|
1197 | // constructing the selects to choose to update the pich wrap - added for bug 2588 |
---|
1198 | assign update_picl_wrap_en[0] = |
---|
1199 | update_picl_sel[0] | wsr_pcr_sel[0]; |
---|
1200 | assign update_picl_wrap_en[1] = |
---|
1201 | update_picl_sel[1] | wsr_pcr_sel[1]; |
---|
1202 | assign update_picl_wrap_en[2] = |
---|
1203 | update_picl_sel[2] | wsr_pcr_sel[2]; |
---|
1204 | assign update_picl_wrap_en[3] = |
---|
1205 | update_picl_sel[3] | wsr_pcr_sel[3]; |
---|
1206 | // |
---|
1207 | // extracting the wsr_data information to update the picls |
---|
1208 | // |
---|
1209 | assign picl_wsr_data = {1'b0, tlu_wsr_data_w[`PIB_PICL_CNT_HI:`PIB_PICL_CNT_LO]}; |
---|
1210 | // |
---|
1211 | // selecting the data for picl update |
---|
1212 | // thread 0 |
---|
1213 | mux3ds #(`PIB_PIC_CNT_WIDTH) mux_update_picl0_data ( |
---|
1214 | .in0 ({`PIB_PIC_CNT_WIDTH{1'b0}}), |
---|
1215 | .in1 (picl_wsr_data[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1216 | .in2 (picl_cnt_sum[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1217 | .sel0 (local_rst), |
---|
1218 | .sel1 (wsr_pic_sel[0] & ~local_rst), |
---|
1219 | .sel2 (~(wsr_pic_sel[0] | local_rst)), |
---|
1220 | .dout (update_picl0_data[`PIB_PIC_CNT_WIDTH-1:0]) |
---|
1221 | ); |
---|
1222 | |
---|
1223 | dffe_s #(`PIB_PIC_CNT_WIDTH) dff_picl_cnt0 ( |
---|
1224 | .din (update_picl0_data[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1225 | .q (picl_cnt0[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1226 | .clk (clk), |
---|
1227 | .en (update_picl_sel[0]), |
---|
1228 | .se (se), |
---|
1229 | .si (), |
---|
1230 | .so () |
---|
1231 | ); |
---|
1232 | // |
---|
1233 | // thread 1 |
---|
1234 | mux3ds #(`PIB_PIC_CNT_WIDTH) mux_update_picl1_data ( |
---|
1235 | .in0 ({`PIB_PIC_CNT_WIDTH{1'b0}}), |
---|
1236 | .in1 (picl_wsr_data[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1237 | .in2 (picl_cnt_sum[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1238 | .sel0 (local_rst), |
---|
1239 | .sel1 (wsr_pic_sel[1] & ~local_rst), |
---|
1240 | .sel2 (~(wsr_pic_sel[1] | local_rst)), |
---|
1241 | .dout (update_picl1_data[`PIB_PIC_CNT_WIDTH-1:0]) |
---|
1242 | ); |
---|
1243 | |
---|
1244 | dffe_s #(`PIB_PIC_CNT_WIDTH) dff_picl_cnt1 ( |
---|
1245 | .din (update_picl1_data[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1246 | .q (picl_cnt1[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1247 | .clk (clk), |
---|
1248 | .en (update_picl_sel[1]), |
---|
1249 | .se (se), |
---|
1250 | .si (), |
---|
1251 | .so () |
---|
1252 | ); |
---|
1253 | // |
---|
1254 | // thread 2 |
---|
1255 | mux3ds #(`PIB_PIC_CNT_WIDTH) mux_update_picl2_data ( |
---|
1256 | .in0 ({`PIB_PIC_CNT_WIDTH{1'b0}}), |
---|
1257 | .in1 (picl_wsr_data[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1258 | .in2 (picl_cnt_sum[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1259 | .sel0 (local_rst), |
---|
1260 | .sel1 (wsr_pic_sel[2] & ~local_rst), |
---|
1261 | .sel2 (~(wsr_pic_sel[2] | local_rst)), |
---|
1262 | .dout (update_picl2_data[`PIB_PIC_CNT_WIDTH-1:0]) |
---|
1263 | ); |
---|
1264 | |
---|
1265 | dffe_s #(`PIB_PIC_CNT_WIDTH) dff_picl_cnt2 ( |
---|
1266 | .din (update_picl2_data[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1267 | .q (picl_cnt2[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1268 | .clk (clk), |
---|
1269 | .en (update_picl_sel[2]), |
---|
1270 | .se (se), |
---|
1271 | .si (), |
---|
1272 | .so () |
---|
1273 | ); |
---|
1274 | // |
---|
1275 | // thread 3 |
---|
1276 | mux3ds #(`PIB_PIC_CNT_WIDTH) mux_update_picl3_data ( |
---|
1277 | .in0 ({`PIB_PIC_CNT_WIDTH{1'b0}}), |
---|
1278 | .in1 (picl_wsr_data[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1279 | .in2 (picl_cnt_sum[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1280 | .sel0 (local_rst), |
---|
1281 | .sel1 (wsr_pic_sel[3] & ~local_rst), |
---|
1282 | .sel2 (~(wsr_pic_sel[3] | local_rst)), |
---|
1283 | .dout (update_picl3_data[`PIB_PIC_CNT_WIDTH-1:0]) |
---|
1284 | ); |
---|
1285 | |
---|
1286 | dffe_s #(`PIB_PIC_CNT_WIDTH) dff_picl_cnt3 ( |
---|
1287 | .din (update_picl3_data[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1288 | .q (picl_cnt3[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1289 | .clk (clk), |
---|
1290 | .en (update_picl_sel[3]), |
---|
1291 | .se (se), |
---|
1292 | .si (), |
---|
1293 | .so () |
---|
1294 | ); |
---|
1295 | |
---|
1296 | //================================================================== |
---|
1297 | // update the pichs - could be sperated into a dp block if needed |
---|
1298 | //================================================================== |
---|
1299 | // |
---|
1300 | dffr_s #(`TLU_THRD_NUM) dffr_inst_vld_w2 ( |
---|
1301 | .din (tlu_thread_inst_vld_g[`TLU_THRD_NUM-1:0]), |
---|
1302 | .q (inst_vld_w2[`TLU_THRD_NUM-1:0]), |
---|
1303 | .clk (clk), |
---|
1304 | .rst (local_rst), |
---|
1305 | .se (se), |
---|
1306 | .si (), |
---|
1307 | .so () |
---|
1308 | ); |
---|
1309 | // |
---|
1310 | // added for bug 4395 |
---|
1311 | dffr_s dffr_tcc_inst_w2 ( |
---|
1312 | .din (tlu_tcc_inst_w), |
---|
1313 | .q (tcc_inst_w2), |
---|
1314 | .clk (clk), |
---|
1315 | .rst (local_rst), |
---|
1316 | .se (se), |
---|
1317 | .si (), |
---|
1318 | .so () |
---|
1319 | ); |
---|
1320 | // |
---|
1321 | // modified for bug 4478 |
---|
1322 | assign incr_pich[0] = pic_cnt_en_w2[0] & inst_vld_w2[0] & |
---|
1323 | (~tlu_full_flush_pipe_w2 | tcc_inst_w2); |
---|
1324 | assign incr_pich[1] = pic_cnt_en_w2[1] & inst_vld_w2[1] & |
---|
1325 | (~tlu_full_flush_pipe_w2 | tcc_inst_w2); |
---|
1326 | assign incr_pich[2] = pic_cnt_en_w2[2] & inst_vld_w2[2] & |
---|
1327 | (~tlu_full_flush_pipe_w2 | tcc_inst_w2); |
---|
1328 | assign incr_pich[3] = pic_cnt_en_w2[3] & inst_vld_w2[3] & |
---|
1329 | (~tlu_full_flush_pipe_w2 | tcc_inst_w2); |
---|
1330 | |
---|
1331 | assign pich_mux_sel[0] = pic_cnt_en_w2[0] & inst_vld_w2[0]; |
---|
1332 | assign pich_mux_sel[1] = pic_cnt_en_w2[1] & inst_vld_w2[1]; |
---|
1333 | assign pich_mux_sel[2] = pic_cnt_en_w2[2] & inst_vld_w2[2]; |
---|
1334 | assign pich_mux_sel[3] = pic_cnt_en_w2[3] & inst_vld_w2[3]; |
---|
1335 | |
---|
1336 | // added for to make inst count overflow trap precise. |
---|
1337 | // added for bug 4314 |
---|
1338 | assign pich_wrap_flg[0] = |
---|
1339 | (pich_cnt_wrap[0] ^ pich_cnt0[`PIB_PIC_CNT_WIDTH-1]) & pic_cnt_en_w2[0]; |
---|
1340 | assign pich_wrap_flg[1] = |
---|
1341 | (pich_cnt_wrap[1] ^ pich_cnt1[`PIB_PIC_CNT_WIDTH-1]) & pic_cnt_en_w2[1]; |
---|
1342 | assign pich_wrap_flg[2] = |
---|
1343 | (pich_cnt_wrap[2] ^ pich_cnt2[`PIB_PIC_CNT_WIDTH-1]) & pic_cnt_en_w2[2]; |
---|
1344 | assign pich_wrap_flg[3] = |
---|
1345 | (pich_cnt_wrap[3] ^ pich_cnt3[`PIB_PIC_CNT_WIDTH-1]) & pic_cnt_en_w2[3]; |
---|
1346 | |
---|
1347 | // modified for bug 4270 |
---|
1348 | // pic experiment |
---|
1349 | assign pich_fourbelow_din[0] = |
---|
1350 | (&pich_cnt0[`PIB_PIC_CNT_WIDTH-2:2]) & pic_cnt_en_w2[0]; |
---|
1351 | assign pich_fourbelow_din[1] = |
---|
1352 | (&pich_cnt1[`PIB_PIC_CNT_WIDTH-2:2]) & pic_cnt_en_w2[1]; |
---|
1353 | assign pich_fourbelow_din[2] = |
---|
1354 | (&pich_cnt2[`PIB_PIC_CNT_WIDTH-2:2]) & pic_cnt_en_w2[2]; |
---|
1355 | assign pich_fourbelow_din[3] = |
---|
1356 | (&pich_cnt3[`PIB_PIC_CNT_WIDTH-2:2]) & pic_cnt_en_w2[3]; |
---|
1357 | // |
---|
1358 | dff_s #(`TLU_THRD_NUM) dff_pich_fourbelow_flg ( |
---|
1359 | .din (pich_fourbelow_din[`TLU_THRD_NUM-1:0]), |
---|
1360 | .q (pich_fourbelow_flg[`TLU_THRD_NUM-1:0]), |
---|
1361 | .clk (clk), |
---|
1362 | .se (se), |
---|
1363 | .si (), |
---|
1364 | .so () |
---|
1365 | ); |
---|
1366 | |
---|
1367 | // modified for bug 4270 |
---|
1368 | assign pich_onebelow_flg[0] = |
---|
1369 | (pich_fourbelow_flg[0] & pich_cnt0[1] & pich_cnt0[0]) & pic_cnt_en_w2[0]; |
---|
1370 | assign pich_onebelow_flg[1] = |
---|
1371 | (pich_fourbelow_flg[1] & pich_cnt1[1] & pich_cnt1[0]) & pic_cnt_en_w2[1]; |
---|
1372 | assign pich_onebelow_flg[2] = |
---|
1373 | (pich_fourbelow_flg[2] & pich_cnt2[1] & pich_cnt2[0]) & pic_cnt_en_w2[2]; |
---|
1374 | assign pich_onebelow_flg[3] = |
---|
1375 | (pich_fourbelow_flg[3] & pich_cnt3[1] & pich_cnt3[0]) & pic_cnt_en_w2[3]; |
---|
1376 | // |
---|
1377 | assign pich_twobelow_flg[0] = |
---|
1378 | (pich_fourbelow_flg[0] & pich_cnt0[1] & ~pich_cnt0[0]) & pic_cnt_en_w2[0]; |
---|
1379 | assign pich_twobelow_flg[1] = |
---|
1380 | (pich_fourbelow_flg[1] & pich_cnt1[1] & ~pich_cnt1[0]) & pic_cnt_en_w2[1]; |
---|
1381 | assign pich_twobelow_flg[2] = |
---|
1382 | (pich_fourbelow_flg[2] & pich_cnt2[1] & ~pich_cnt2[0]) & pic_cnt_en_w2[2]; |
---|
1383 | assign pich_twobelow_flg[3] = |
---|
1384 | (pich_fourbelow_flg[3] & pich_cnt3[1] & ~pich_cnt3[0]) & pic_cnt_en_w2[3]; |
---|
1385 | // |
---|
1386 | /* |
---|
1387 | assign pich_threebelow_flg[0] = |
---|
1388 | (pich_fourbelow_flg[0] & ~pich_cnt0[1] & pich_cnt0[0]) & pic_cnt_en_w2[0]; |
---|
1389 | assign pich_threebelow_flg[1] = |
---|
1390 | (pich_fourbelow_flg[1] & ~pich_cnt1[1] & pich_cnt1[0]) & pic_cnt_en_w2[1]; |
---|
1391 | assign pich_threebelow_flg[2] = |
---|
1392 | (pich_fourbelow_flg[2] & ~pich_cnt2[1] & pich_cnt2[0]) & pic_cnt_en_w2[2]; |
---|
1393 | assign pich_threebelow_flg[3] = |
---|
1394 | (pich_fourbelow_flg[3] & ~pich_cnt3[1] & pich_cnt3[0]) & pic_cnt_en_w2[3]; |
---|
1395 | */ |
---|
1396 | // |
---|
1397 | // added for bug 4836 |
---|
1398 | assign pic_twobelow_e[0] = |
---|
1399 | pich_mux_sel[0]? (pich_fourbelow_flg[0] & ~pich_cnt0[1] & pich_cnt0[0]): |
---|
1400 | (pich_fourbelow_flg[0] & pich_cnt0[1] & ~pich_cnt0[0]); |
---|
1401 | assign pic_twobelow_e[1] = |
---|
1402 | pich_mux_sel[1]? (pich_fourbelow_flg[1] & ~pich_cnt1[1] & pich_cnt1[0]): |
---|
1403 | (pich_fourbelow_flg[1] & pich_cnt1[1] & ~pich_cnt1[0]); |
---|
1404 | assign pic_twobelow_e[2] = |
---|
1405 | pich_mux_sel[2]? (pich_fourbelow_flg[2] & ~pich_cnt2[1] & pich_cnt2[0]): |
---|
1406 | (pich_fourbelow_flg[2] & pich_cnt2[1] & ~pich_cnt2[0]); |
---|
1407 | assign pic_twobelow_e[3] = |
---|
1408 | pich_mux_sel[3]? (pich_fourbelow_flg[3] & ~pich_cnt3[1] & pich_cnt3[0]): |
---|
1409 | (pich_fourbelow_flg[3] & pich_cnt3[1] & ~pich_cnt3[0]); |
---|
1410 | |
---|
1411 | assign tlu_pic_twobelow_e = |
---|
1412 | (thread_rsel_e[0]) ? pic_twobelow_e[0]: |
---|
1413 | (thread_rsel_e[1]) ? pic_twobelow_e[1]: |
---|
1414 | (thread_rsel_e[2]) ? pic_twobelow_e[2]: |
---|
1415 | pic_twobelow_e[3]; |
---|
1416 | // |
---|
1417 | assign pic_onebelow_e[0] = |
---|
1418 | pich_mux_sel[0]? (pich_fourbelow_flg[0] & pich_cnt0[1] & ~pich_cnt0[0]): |
---|
1419 | (pich_fourbelow_flg[0] & pich_cnt0[1] & pich_cnt0[0]); |
---|
1420 | assign pic_onebelow_e[1] = |
---|
1421 | pich_mux_sel[1]? (pich_fourbelow_flg[1] & pich_cnt1[1] & ~pich_cnt1[0]): |
---|
1422 | (pich_fourbelow_flg[1] & pich_cnt1[1] & pich_cnt1[0]); |
---|
1423 | assign pic_onebelow_e[2] = |
---|
1424 | pich_mux_sel[2]? (pich_fourbelow_flg[2] & pich_cnt2[1] & ~pich_cnt2[0]): |
---|
1425 | (pich_fourbelow_flg[2] & pich_cnt2[1] & pich_cnt2[0]); |
---|
1426 | assign pic_onebelow_e[3] = |
---|
1427 | pich_mux_sel[3]? (pich_fourbelow_flg[3] & pich_cnt3[1] & ~pich_cnt3[0]): |
---|
1428 | (pich_fourbelow_flg[3] & pich_cnt3[1] & pich_cnt3[0]); |
---|
1429 | |
---|
1430 | assign tlu_pic_onebelow_e = |
---|
1431 | (thread_rsel_e[0]) ? pic_onebelow_e[0]: |
---|
1432 | (thread_rsel_e[1]) ? pic_onebelow_e[1]: |
---|
1433 | (thread_rsel_e[2]) ? pic_onebelow_e[2]: |
---|
1434 | pic_onebelow_e[3]; |
---|
1435 | // |
---|
1436 | assign pic_wrap_e[0] = |
---|
1437 | pich_mux_sel[0]? (pich_fourbelow_flg[0] & pich_cnt0[1] & pich_cnt0[0]): |
---|
1438 | (pich_cnt_wrap[0] ^ pich_cnt0[`PIB_PIC_CNT_WIDTH-1]); |
---|
1439 | assign pic_wrap_e[1] = |
---|
1440 | pich_mux_sel[1]? (pich_fourbelow_flg[1] & pich_cnt1[1] & pich_cnt1[0]): |
---|
1441 | (pich_cnt_wrap[1] ^ pich_cnt1[`PIB_PIC_CNT_WIDTH-1]); |
---|
1442 | assign pic_wrap_e[2] = |
---|
1443 | pich_mux_sel[2]? (pich_fourbelow_flg[2] & pich_cnt2[1] & pich_cnt2[0]): |
---|
1444 | (pich_cnt_wrap[2] ^ pich_cnt2[`PIB_PIC_CNT_WIDTH-1]); |
---|
1445 | assign pic_wrap_e[3] = |
---|
1446 | pich_mux_sel[3]? (pich_fourbelow_flg[3] & pich_cnt3[1] & pich_cnt3[0]): |
---|
1447 | (pich_cnt_wrap[3] ^ pich_cnt3[`PIB_PIC_CNT_WIDTH-1]); |
---|
1448 | |
---|
1449 | assign tlu_pic_wrap_e = |
---|
1450 | (thread_rsel_e[0]) ? pic_wrap_e[0]: |
---|
1451 | (thread_rsel_e[1]) ? pic_wrap_e[1]: |
---|
1452 | (thread_rsel_e[2]) ? pic_wrap_e[2]: |
---|
1453 | pic_wrap_e[3]; |
---|
1454 | // |
---|
1455 | // |
---|
1456 | // modified for bug 5436: Niagara 2.0 |
---|
1457 | assign tlu_pcr_ut[0] = pcr0[`PIB_PCR_UT]; |
---|
1458 | assign tlu_pcr_ut[1] = pcr1[`PIB_PCR_UT]; |
---|
1459 | assign tlu_pcr_ut[2] = pcr2[`PIB_PCR_UT]; |
---|
1460 | assign tlu_pcr_ut[3] = pcr3[`PIB_PCR_UT]; |
---|
1461 | // |
---|
1462 | assign tlu_pcr_st[0] = pcr0[`PIB_PCR_ST]; |
---|
1463 | assign tlu_pcr_st[1] = pcr1[`PIB_PCR_ST]; |
---|
1464 | assign tlu_pcr_st[2] = pcr2[`PIB_PCR_ST]; |
---|
1465 | assign tlu_pcr_st[3] = pcr3[`PIB_PCR_ST]; |
---|
1466 | |
---|
1467 | assign tlu_pcr_ut_e = |
---|
1468 | (thread_rsel_e[0]) ? pcr0[`PIB_PCR_UT]: |
---|
1469 | (thread_rsel_e[1]) ? pcr1[`PIB_PCR_UT]: |
---|
1470 | (thread_rsel_e[2]) ? pcr2[`PIB_PCR_UT]: |
---|
1471 | pcr3[`PIB_PCR_UT]; |
---|
1472 | |
---|
1473 | assign tlu_pcr_st_e = |
---|
1474 | (thread_rsel_e[0]) ? pcr0[`PIB_PCR_ST]: |
---|
1475 | (thread_rsel_e[1]) ? pcr1[`PIB_PCR_ST]: |
---|
1476 | (thread_rsel_e[2]) ? pcr2[`PIB_PCR_ST]: |
---|
1477 | pcr3[`PIB_PCR_ST]; |
---|
1478 | |
---|
1479 | |
---|
1480 | // reporting over-flow trap - needed to be precise, therefore |
---|
1481 | // bypassing tlb-miss traps |
---|
1482 | // |
---|
1483 | // selelcting the thread for incrementing for pich |
---|
1484 | // added for bug2332 |
---|
1485 | // |
---|
1486 | // one-hot mux change |
---|
1487 | assign pich_cnt_din[`PIB_PIC_CNT_WIDTH-1:0] = |
---|
1488 | (pich_mux_sel[1])? pich_cnt1[`PIB_PIC_CNT_WIDTH-1:0]: |
---|
1489 | (pich_mux_sel[2])? pich_cnt2[`PIB_PIC_CNT_WIDTH-1:0]: |
---|
1490 | (pich_mux_sel[3])? pich_cnt3[`PIB_PIC_CNT_WIDTH-1:0]: |
---|
1491 | pich_cnt0[`PIB_PIC_CNT_WIDTH-1:0]; |
---|
1492 | /* |
---|
1493 | assign incr_pich_onehot = ~(|incr_pich[3:1]) | rst_tri_en; |
---|
1494 | mux4ds #(`PIB_PIC_CNT_WIDTH) mux_pich_cnt_din ( |
---|
1495 | .in0 (pich_cnt0[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1496 | .in1 (pich_cnt1[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1497 | .in2 (pich_cnt2[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1498 | .in3 (pich_cnt3[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1499 | .sel0 (incr_pich_onehot), |
---|
1500 | .sel1 (incr_pich[1] & ~rst_tri_en), |
---|
1501 | .sel2 (incr_pich[2] & ~rst_tri_en), |
---|
1502 | .sel3 (incr_pich[3] & ~rst_tri_en), |
---|
1503 | .dout (pich_cnt_din[`PIB_PIC_CNT_WIDTH-1:0]) |
---|
1504 | ); |
---|
1505 | */ |
---|
1506 | // |
---|
1507 | // pich incrementor - shared between four threads |
---|
1508 | // |
---|
1509 | tlu_addern_32 #(`PIB_PIC_CNT_WIDTH,1) pich_adder ( |
---|
1510 | .din (pich_cnt_din[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1511 | .incr (1'b1), |
---|
1512 | .sum (pich_cnt_sum[`PIB_PIC_CNT_WIDTH-1:0]) |
---|
1513 | ) ; |
---|
1514 | // |
---|
1515 | // extracting the wsr_data information to update the picls |
---|
1516 | // |
---|
1517 | assign pich_wsr_data = {1'b0, tlu_wsr_data_w[`PIB_PICH_CNT_HI:`PIB_PICH_CNT_LO]}; |
---|
1518 | |
---|
1519 | // constructing the selects to choose to update the pich |
---|
1520 | assign update_pich_sel[0] = (local_rst | incr_pich[0] | wsr_pic_sel[0]); |
---|
1521 | assign update_pich_sel[1] = (local_rst | incr_pich[1] | wsr_pic_sel[1]); |
---|
1522 | assign update_pich_sel[2] = (local_rst | incr_pich[2] | wsr_pic_sel[2]); |
---|
1523 | assign update_pich_sel[3] = (local_rst | incr_pich[3] | wsr_pic_sel[3]); |
---|
1524 | |
---|
1525 | // constructing the selects to choose to update the pich wrap |
---|
1526 | assign update_pich_wrap_en[0] = |
---|
1527 | update_pich_sel[0] | wsr_pcr_sel[0]; |
---|
1528 | assign update_pich_wrap_en[1] = |
---|
1529 | update_pich_sel[1] | wsr_pcr_sel[1]; |
---|
1530 | assign update_pich_wrap_en[2] = |
---|
1531 | update_pich_sel[2] | wsr_pcr_sel[2]; |
---|
1532 | assign update_pich_wrap_en[3] = |
---|
1533 | update_pich_sel[3] | wsr_pcr_sel[3]; |
---|
1534 | // |
---|
1535 | // selecting the data for pich update |
---|
1536 | // thread 0 |
---|
1537 | mux3ds #(`PIB_PIC_CNT_WIDTH) mux_update_pich0_data ( |
---|
1538 | .in0 ({`PIB_PIC_CNT_WIDTH{1'b0}}), |
---|
1539 | .in1 (pich_wsr_data[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1540 | .in2 (pich_cnt_sum[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1541 | .sel0 (local_rst), |
---|
1542 | .sel1 (wsr_pic_sel[0] & ~local_rst), |
---|
1543 | .sel2 (~(wsr_pic_sel[0] | local_rst)), |
---|
1544 | .dout (update_pich0_data[`PIB_PIC_CNT_WIDTH-1:0]) |
---|
1545 | ); |
---|
1546 | |
---|
1547 | dffe_s #(`PIB_PIC_CNT_WIDTH) dff_pich_cnt0 ( |
---|
1548 | .din (update_pich0_data[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1549 | .q (pich_cnt0[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1550 | .clk (clk), |
---|
1551 | .en (update_pich_sel[0]), |
---|
1552 | .se (se), |
---|
1553 | .si (), |
---|
1554 | .so () |
---|
1555 | ); |
---|
1556 | // |
---|
1557 | // thread 1 |
---|
1558 | mux3ds #(`PIB_PIC_CNT_WIDTH) mux_update_pich1_data ( |
---|
1559 | .in0 ({`PIB_PIC_CNT_WIDTH{1'b0}}), |
---|
1560 | .in1 (pich_wsr_data[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1561 | .in2 (pich_cnt_sum[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1562 | .sel0 (local_rst), |
---|
1563 | .sel1 (wsr_pic_sel[1] & ~local_rst), |
---|
1564 | .sel2 (~(wsr_pic_sel[1] | local_rst)), |
---|
1565 | .dout (update_pich1_data[`PIB_PIC_CNT_WIDTH-1:0]) |
---|
1566 | ); |
---|
1567 | |
---|
1568 | dffe_s #(`PIB_PIC_CNT_WIDTH) dff_pich_cnt1 ( |
---|
1569 | .din (update_pich1_data[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1570 | .q (pich_cnt1[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1571 | .clk (clk), |
---|
1572 | .en (update_pich_sel[1]), |
---|
1573 | .se (se), |
---|
1574 | .si (), |
---|
1575 | .so () |
---|
1576 | ); |
---|
1577 | // |
---|
1578 | // thread 2 |
---|
1579 | mux3ds #(`PIB_PIC_CNT_WIDTH) mux_update_pich2_data ( |
---|
1580 | .in0 ({`PIB_PIC_CNT_WIDTH{1'b0}}), |
---|
1581 | .in1 (pich_wsr_data[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1582 | .in2 (pich_cnt_sum[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1583 | .sel0 (local_rst), |
---|
1584 | .sel1 (wsr_pic_sel[2] & ~local_rst), |
---|
1585 | .sel2 (~(wsr_pic_sel[2] | local_rst)), |
---|
1586 | .dout (update_pich2_data[`PIB_PIC_CNT_WIDTH-1:0]) |
---|
1587 | ); |
---|
1588 | |
---|
1589 | dffe_s #(`PIB_PIC_CNT_WIDTH) dff_pich_cnt2 ( |
---|
1590 | .din (update_pich2_data[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1591 | .q (pich_cnt2[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1592 | .clk (clk), |
---|
1593 | .en (update_pich_sel[2]), |
---|
1594 | .se (se), |
---|
1595 | .si (), |
---|
1596 | .so () |
---|
1597 | ); |
---|
1598 | // |
---|
1599 | // thread 3 |
---|
1600 | mux3ds #(`PIB_PIC_CNT_WIDTH) mux_update_pich3_data ( |
---|
1601 | .in0 ({`PIB_PIC_CNT_WIDTH{1'b0}}), |
---|
1602 | .in1 (pich_wsr_data[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1603 | .in2 (pich_cnt_sum[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1604 | .sel0 (local_rst), |
---|
1605 | .sel1 (wsr_pic_sel[3] & ~local_rst), |
---|
1606 | .sel2 (~(wsr_pic_sel[3] | local_rst)), |
---|
1607 | .dout (update_pich3_data[`PIB_PIC_CNT_WIDTH-1:0]) |
---|
1608 | ); |
---|
1609 | |
---|
1610 | dffe_s #(`PIB_PIC_CNT_WIDTH) dff_pich_cnt3 ( |
---|
1611 | .din (update_pich3_data[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1612 | .q (pich_cnt3[`PIB_PIC_CNT_WIDTH-1:0]), |
---|
1613 | .clk (clk), |
---|
1614 | .en (update_pich_sel[3]), |
---|
1615 | .se (se), |
---|
1616 | .si (), |
---|
1617 | .so () |
---|
1618 | ); |
---|
1619 | |
---|
1620 | //========================== |
---|
1621 | // reading the PCRs and PICs |
---|
1622 | //========================== |
---|
1623 | // decoding the thread information for rsr instruction from IFU |
---|
1624 | // modified due to timing |
---|
1625 | /* |
---|
1626 | assign thread_rsel_e[0] = ~(|ifu_tlu_thrid_e[1:0]); |
---|
1627 | assign thread_rsel_e[1] = ~ifu_tlu_thrid_e[1] & ifu_tlu_thrid_e[0]; |
---|
1628 | assign thread_rsel_e[2] = ifu_tlu_thrid_e[1] & ~ifu_tlu_thrid_e[0]; |
---|
1629 | assign thread_rsel_e[3] = (&ifu_tlu_thrid_e[1:0]); |
---|
1630 | */ |
---|
1631 | assign thread_rsel_d[0] = ~(|ifu_tlu_thrid_d[1:0]); |
---|
1632 | assign thread_rsel_d[1] = ~ifu_tlu_thrid_d[1] & ifu_tlu_thrid_d[0]; |
---|
1633 | assign thread_rsel_d[2] = ifu_tlu_thrid_d[1] & ~ifu_tlu_thrid_d[0]; |
---|
1634 | // assign thread_rsel_d[3] = (&ifu_tlu_thrid_d[1:0]); |
---|
1635 | // |
---|
1636 | dff_s #(`TLU_THRD_NUM-1) dff_thread_rsel_e ( |
---|
1637 | .din (thread_rsel_d[`TLU_THRD_NUM-2:0]), |
---|
1638 | .q (thread_rsel_e[`TLU_THRD_NUM-2:0]), |
---|
1639 | .clk (clk), |
---|
1640 | .se (se), |
---|
1641 | .si (), |
---|
1642 | .so () |
---|
1643 | ); |
---|
1644 | // selecting the correct pic for rdpr |
---|
1645 | // modified to avoid rte failure |
---|
1646 | assign pic_rdata_e[`TLU_ASR_DATA_WIDTH-1:0] = |
---|
1647 | (thread_rsel_e[0])? |
---|
1648 | {pich_cnt0[`PIB_PIC_CNT_WIDTH-2:0], picl_cnt0[`PIB_PIC_CNT_WIDTH-2:0]}: |
---|
1649 | (thread_rsel_e[1])? |
---|
1650 | {pich_cnt1[`PIB_PIC_CNT_WIDTH-2:0], picl_cnt1[`PIB_PIC_CNT_WIDTH-2:0]}: |
---|
1651 | (thread_rsel_e[2])? |
---|
1652 | {pich_cnt2[`PIB_PIC_CNT_WIDTH-2:0], picl_cnt2[`PIB_PIC_CNT_WIDTH-2:0]}: |
---|
1653 | {pich_cnt3[`PIB_PIC_CNT_WIDTH-2:0], picl_cnt3[`PIB_PIC_CNT_WIDTH-2:0]}; |
---|
1654 | /* |
---|
1655 | mux4ds #(`TLU_ASR_DATA_WIDTH) mux_pic_rdata ( |
---|
1656 | .in0 ({pich_cnt0[`PIB_PIC_CNT_WIDTH-2:0], picl_cnt0[`PIB_PIC_CNT_WIDTH-2:0]}), |
---|
1657 | .in1 ({pich_cnt1[`PIB_PIC_CNT_WIDTH-2:0], picl_cnt1[`PIB_PIC_CNT_WIDTH-2:0]}), |
---|
1658 | .in2 ({pich_cnt2[`PIB_PIC_CNT_WIDTH-2:0], picl_cnt2[`PIB_PIC_CNT_WIDTH-2:0]}), |
---|
1659 | .in3 ({pich_cnt3[`PIB_PIC_CNT_WIDTH-2:0], picl_cnt3[`PIB_PIC_CNT_WIDTH-2:0]}), |
---|
1660 | .sel0 (thread_rsel_e[0]), |
---|
1661 | .sel1 (thread_rsel_e[1]), |
---|
1662 | .sel2 (thread_rsel_e[2]), |
---|
1663 | .sel3 (thread_rsel_e[3]), |
---|
1664 | .dout (pic_rdata_e[`TLU_ASR_DATA_WIDTH-1:0]) |
---|
1665 | ); |
---|
1666 | |
---|
1667 | // selecting the correct pcr for rdpr |
---|
1668 | // modified for bug 2391 |
---|
1669 | mux4ds #(`TLU_ASR_DATA_WIDTH) mux_pcr_rdata ( |
---|
1670 | .in0 ({58'b0,pcr0[`PIB_PCR_WIDTH-1:0]}), |
---|
1671 | .in1 ({58'b0,pcr1[`PIB_PCR_WIDTH-1:0]}), |
---|
1672 | .in2 ({58'b0,pcr2[`PIB_PCR_WIDTH-1:0]}), |
---|
1673 | .in3 ({58'b0,pcr3[`PIB_PCR_WIDTH-1:0]}), |
---|
1674 | .sel0 (thread_rsel_e[0]), |
---|
1675 | .sel1 (thread_rsel_e[1]), |
---|
1676 | .sel2 (thread_rsel_e[2]), |
---|
1677 | .sel3 (thread_rsel_e[3]), |
---|
1678 | .dout (pcr_rdata_e[`TLU_ASR_DATA_WIDTH-1:0]) |
---|
1679 | ); |
---|
1680 | |
---|
1681 | mux4ds #(`PIB_PCR_WIDTH) mux_pcr_rdata ( |
---|
1682 | .in0 (pcr0[`PIB_PCR_WIDTH-1:0]), |
---|
1683 | .in1 (pcr1[`PIB_PCR_WIDTH-1:0]), |
---|
1684 | .in2 (pcr2[`PIB_PCR_WIDTH-1:0]), |
---|
1685 | .in3 (pcr3[`PIB_PCR_WIDTH-1:0]), |
---|
1686 | .sel0 (thread_rsel_e[0]), |
---|
1687 | .sel1 (thread_rsel_e[1]), |
---|
1688 | .sel2 (thread_rsel_e[2]), |
---|
1689 | .sel3 (thread_rsel_e[3]), |
---|
1690 | .dout (pcr_reg_rdata_e[`PIB_PCR_WIDTH-1:0]) |
---|
1691 | ); |
---|
1692 | */ |
---|
1693 | |
---|
1694 | assign pcr_reg_rdata_e[`PIB_PCR_WIDTH-1:0] = |
---|
1695 | (thread_rsel_e[0])? pcr0[`PIB_PCR_WIDTH-1:0]: |
---|
1696 | (thread_rsel_e[1])? pcr1[`PIB_PCR_WIDTH-1:0]: |
---|
1697 | (thread_rsel_e[2])? pcr2[`PIB_PCR_WIDTH-1:0]: |
---|
1698 | pcr3[`PIB_PCR_WIDTH-1:0]; |
---|
1699 | |
---|
1700 | assign pcr_rdata_e[`TLU_ASR_DATA_WIDTH-1:0] = |
---|
1701 | {54'b0, // rsvd bits |
---|
1702 | pcr_reg_rdata_e[`PIB_PCR_CH_OVF:`PIB_PCR_CL_OVF], |
---|
1703 | 1'b0, // rsvd bit |
---|
1704 | pcr_reg_rdata_e[`PIB_PCR_SL_HI:`PIB_PCR_SL_LO], |
---|
1705 | 1'b0, // rsvd bit |
---|
1706 | pcr_reg_rdata_e[`PIB_PCR_UT:`PIB_PCR_PRIV]}; |
---|
1707 | |
---|
1708 | // constructing the mux select for the output mux for rsr inst |
---|
1709 | assign rsr_data_sel_e[0] = pcr_rw_e; |
---|
1710 | assign rsr_data_sel_e[1] = ~pcr_rw_e; |
---|
1711 | |
---|
1712 | // modified due to timing |
---|
1713 | // assign rsr_data_sel_e[1] = ~pcr_rw_e & (pic_npriv_rw_e | pic_priv_rw_e); |
---|
1714 | // assign rsr_data_sel_e[2] = ~(|rsr_data_sel_e[1:0]); |
---|
1715 | /* |
---|
1716 | mux3ds #(`TLU_ASR_DATA_WIDTH) mux_exu_rsr_data_e ( |
---|
1717 | .in0(pcr_rdata_e[`TLU_ASR_DATA_WIDTH-1:0]), |
---|
1718 | .in1(pic_rdata_e[`TLU_ASR_DATA_WIDTH-1:0]), |
---|
1719 | .in2(tlu_pib_rsr_data_e[`TLU_ASR_DATA_WIDTH-1:0]), |
---|
1720 | .sel0(rsr_data_sel_e[0]), |
---|
1721 | .sel1(rsr_data_sel_e[1]), |
---|
1722 | .sel2(rsr_data_sel_e[2]), |
---|
1723 | .dout(tlu_exu_rsr_data_e[`TLU_ASR_DATA_WIDTH-1:0]) |
---|
1724 | ); |
---|
1725 | */ |
---|
1726 | mux2ds #(`TLU_ASR_DATA_WIDTH) mux_tlu_pib_rsr_data_e ( |
---|
1727 | .in0(pcr_rdata_e[`TLU_ASR_DATA_WIDTH-1:0]), |
---|
1728 | .in1(pic_rdata_e[`TLU_ASR_DATA_WIDTH-1:0]), |
---|
1729 | .sel0(rsr_data_sel_e[0]), |
---|
1730 | .sel1(rsr_data_sel_e[1]), |
---|
1731 | .dout(tlu_pib_rsr_data_e[`TLU_ASR_DATA_WIDTH-1:0]) |
---|
1732 | ); |
---|
1733 | //========================== |
---|
1734 | // over_flow trap |
---|
1735 | //========================== |
---|
1736 | // staged the wrap bit for comparison |
---|
1737 | // |
---|
1738 | // thread 0 - modified for bug 3937 |
---|
1739 | mux2ds mux_picl_cnt_wrap_datain_0 ( |
---|
1740 | .in0(picl_cnt0[`PIB_PIC_CNT_WIDTH-1] ^ pcr_wdata_in[`PIB_PCR_CL_OVF]), |
---|
1741 | .in1(picl_cnt0[`PIB_PIC_CNT_WIDTH-1]), |
---|
1742 | .sel0(wsr_pcr_sel[0]), |
---|
1743 | .sel1(~wsr_pcr_sel[0]), |
---|
1744 | .dout(picl_cnt_wrap_datain[0]) |
---|
1745 | ); |
---|
1746 | |
---|
1747 | mux2ds mux_pich_cnt_wrap_datain_0 ( |
---|
1748 | .in0(pich_cnt0[`PIB_PIC_CNT_WIDTH-1] ^ pcr_wdata_in[`PIB_PCR_CH_OVF]), |
---|
1749 | .in1(pich_cnt0[`PIB_PIC_CNT_WIDTH-1]), |
---|
1750 | .sel0(wsr_pcr_sel[0]), |
---|
1751 | .sel1(~wsr_pcr_sel[0]), |
---|
1752 | .dout(pich_cnt_wrap_datain[0]) |
---|
1753 | ); |
---|
1754 | /* |
---|
1755 | assign picl_cnt_wrap_datain[0] = |
---|
1756 | (picl_cnt0[`PIB_PIC_CNT_WIDTH-1] ^ pcr_wdata_in[`PIB_PCR_CL_OVF]); |
---|
1757 | |
---|
1758 | assign pich_cnt_wrap_datain[0] = |
---|
1759 | (pich_cnt0[`PIB_PIC_CNT_WIDTH-1] ^ pcr_wdata_in[`PIB_PCR_CH_OVF]); |
---|
1760 | */ |
---|
1761 | |
---|
1762 | dffre_s dffre_picl0_wrap ( |
---|
1763 | .din (picl_cnt_wrap_datain[0]), |
---|
1764 | .q (picl_cnt_wrap[0]), |
---|
1765 | .clk (clk), |
---|
1766 | .en (update_picl_wrap_en[0]), |
---|
1767 | .rst (local_rst | wsr_pic_sel[0]), |
---|
1768 | .se (se), |
---|
1769 | .si (), |
---|
1770 | .so () |
---|
1771 | ); |
---|
1772 | |
---|
1773 | dffre_s dffre_pich0_wrap ( |
---|
1774 | .din (pich_cnt_wrap_datain[0]), |
---|
1775 | .q (pich_cnt_wrap[0]), |
---|
1776 | .clk (clk), |
---|
1777 | .en (update_pich_wrap_en[0]), |
---|
1778 | .rst (local_rst | wsr_pic_sel[0]), |
---|
1779 | .se (se), |
---|
1780 | .si (), |
---|
1781 | .so () |
---|
1782 | ); |
---|
1783 | // |
---|
1784 | // thread 1 - modified for bug 3937 |
---|
1785 | mux2ds mux_picl_cnt_wrap_datain_1 ( |
---|
1786 | .in0(picl_cnt1[`PIB_PIC_CNT_WIDTH-1] ^ pcr_wdata_in[`PIB_PCR_CL_OVF]), |
---|
1787 | .in1(picl_cnt1[`PIB_PIC_CNT_WIDTH-1]), |
---|
1788 | .sel0(wsr_pcr_sel[1]), |
---|
1789 | .sel1(~wsr_pcr_sel[1]), |
---|
1790 | .dout(picl_cnt_wrap_datain[1]) |
---|
1791 | ); |
---|
1792 | |
---|
1793 | mux2ds mux_pich_cnt_wrap_datain_1 ( |
---|
1794 | .in0(pich_cnt1[`PIB_PIC_CNT_WIDTH-1] ^ pcr_wdata_in[`PIB_PCR_CH_OVF]), |
---|
1795 | .in1(pich_cnt1[`PIB_PIC_CNT_WIDTH-1]), |
---|
1796 | .sel0(wsr_pcr_sel[1]), |
---|
1797 | .sel1(~wsr_pcr_sel[1]), |
---|
1798 | .dout(pich_cnt_wrap_datain[1]) |
---|
1799 | ); |
---|
1800 | /* |
---|
1801 | assign picl_cnt_wrap_datain[1] = |
---|
1802 | (picl_cnt1[`PIB_PIC_CNT_WIDTH-1] ^ pcr_wdata_in[`PIB_PCR_CL_OVF]); |
---|
1803 | |
---|
1804 | assign pich_cnt_wrap_datain[1] = |
---|
1805 | (pich_cnt1[`PIB_PIC_CNT_WIDTH-1] ^ pcr_wdata_in[`PIB_PCR_CH_OVF]); |
---|
1806 | */ |
---|
1807 | |
---|
1808 | dffre_s dffre_picl1_wrap ( |
---|
1809 | .din (picl_cnt_wrap_datain[1]), |
---|
1810 | .q (picl_cnt_wrap[1]), |
---|
1811 | .clk (clk), |
---|
1812 | .en (update_picl_wrap_en[1]), |
---|
1813 | .rst (local_rst | wsr_pic_sel[1]), |
---|
1814 | .se (se), |
---|
1815 | .si (), |
---|
1816 | .so () |
---|
1817 | ); |
---|
1818 | |
---|
1819 | dffre_s dffre_pich1_wrap ( |
---|
1820 | .din (pich_cnt_wrap_datain[1]), |
---|
1821 | .q (pich_cnt_wrap[1]), |
---|
1822 | .clk (clk), |
---|
1823 | .en (update_pich_wrap_en[1]), |
---|
1824 | .rst (local_rst | wsr_pic_sel[1]), |
---|
1825 | .se (se), |
---|
1826 | .si (), |
---|
1827 | .so () |
---|
1828 | ); |
---|
1829 | // |
---|
1830 | // thread 2 - modified for bug 3937 |
---|
1831 | mux2ds mux_picl_cnt_wrap_datain_2 ( |
---|
1832 | .in0(picl_cnt2[`PIB_PIC_CNT_WIDTH-1] ^ pcr_wdata_in[`PIB_PCR_CL_OVF]), |
---|
1833 | .in1(picl_cnt2[`PIB_PIC_CNT_WIDTH-1]), |
---|
1834 | .sel0(wsr_pcr_sel[2]), |
---|
1835 | .sel1(~wsr_pcr_sel[2]), |
---|
1836 | .dout(picl_cnt_wrap_datain[2]) |
---|
1837 | ); |
---|
1838 | |
---|
1839 | mux2ds mux_pich_cnt_wrap_datain_2 ( |
---|
1840 | .in0(pich_cnt2[`PIB_PIC_CNT_WIDTH-1] ^ pcr_wdata_in[`PIB_PCR_CH_OVF]), |
---|
1841 | .in1(pich_cnt2[`PIB_PIC_CNT_WIDTH-1]), |
---|
1842 | .sel0(wsr_pcr_sel[2]), |
---|
1843 | .sel1(~wsr_pcr_sel[2]), |
---|
1844 | .dout(pich_cnt_wrap_datain[2]) |
---|
1845 | ); |
---|
1846 | /* |
---|
1847 | assign picl_cnt_wrap_datain[2] = |
---|
1848 | (picl_cnt2[`PIB_PIC_CNT_WIDTH-1] ^ pcr_wdata_in[`PIB_PCR_CL_OVF]); |
---|
1849 | |
---|
1850 | assign pich_cnt_wrap_datain[2] = |
---|
1851 | (pich_cnt2[`PIB_PIC_CNT_WIDTH-1] ^ pcr_wdata_in[`PIB_PCR_CH_OVF]); |
---|
1852 | */ |
---|
1853 | |
---|
1854 | dffre_s dffre_picl2_wrap ( |
---|
1855 | .din (picl_cnt_wrap_datain[2]), |
---|
1856 | .q (picl_cnt_wrap[2]), |
---|
1857 | .clk (clk), |
---|
1858 | .en (update_picl_wrap_en[2]), |
---|
1859 | .rst (local_rst | wsr_pic_sel[2]), |
---|
1860 | .se (se), |
---|
1861 | .si (), |
---|
1862 | .so () |
---|
1863 | ); |
---|
1864 | |
---|
1865 | dffre_s dffre_pich2_wrap ( |
---|
1866 | .din (pich_cnt_wrap_datain[2]), |
---|
1867 | .q (pich_cnt_wrap[2]), |
---|
1868 | .clk (clk), |
---|
1869 | .en (update_pich_wrap_en[2]), |
---|
1870 | .rst (local_rst | wsr_pic_sel[2]), |
---|
1871 | .se (se), |
---|
1872 | .si (), |
---|
1873 | .so () |
---|
1874 | ); |
---|
1875 | // |
---|
1876 | // thread 3 - modified for bug 3937 |
---|
1877 | mux2ds mux_picl_cnt_wrap_datain_3 ( |
---|
1878 | .in0(picl_cnt3[`PIB_PIC_CNT_WIDTH-1] ^ pcr_wdata_in[`PIB_PCR_CL_OVF]), |
---|
1879 | .in1(picl_cnt3[`PIB_PIC_CNT_WIDTH-1]), |
---|
1880 | .sel0(wsr_pcr_sel[3]), |
---|
1881 | .sel1(~wsr_pcr_sel[3]), |
---|
1882 | .dout(picl_cnt_wrap_datain[3]) |
---|
1883 | ); |
---|
1884 | |
---|
1885 | mux2ds mux_pich_cnt_wrap_datain_3 ( |
---|
1886 | .in0(pich_cnt3[`PIB_PIC_CNT_WIDTH-1] ^ pcr_wdata_in[`PIB_PCR_CH_OVF]), |
---|
1887 | .in1(pich_cnt3[`PIB_PIC_CNT_WIDTH-1]), |
---|
1888 | .sel0(wsr_pcr_sel[3]), |
---|
1889 | .sel1(~wsr_pcr_sel[3]), |
---|
1890 | .dout(pich_cnt_wrap_datain[3]) |
---|
1891 | ); |
---|
1892 | /* |
---|
1893 | assign picl_cnt_wrap_datain[3] = |
---|
1894 | (picl_cnt3[`PIB_PIC_CNT_WIDTH-1] ^ pcr_wdata_in[`PIB_PCR_CL_OVF]); |
---|
1895 | |
---|
1896 | assign pich_cnt_wrap_datain[3] = |
---|
1897 | (pich_cnt3[`PIB_PIC_CNT_WIDTH-1] ^ pcr_wdata_in[`PIB_PCR_CH_OVF]); |
---|
1898 | */ |
---|
1899 | |
---|
1900 | dffre_s dffre_picl3_wrap ( |
---|
1901 | .din (picl_cnt_wrap_datain[3]), |
---|
1902 | .q (picl_cnt_wrap[3]), |
---|
1903 | .clk (clk), |
---|
1904 | .en (update_picl_wrap_en[3]), |
---|
1905 | .rst (local_rst | wsr_pic_sel[3]), |
---|
1906 | .se (se), |
---|
1907 | .si (), |
---|
1908 | .so () |
---|
1909 | ); |
---|
1910 | |
---|
1911 | dffre_s dffre_pich3_wrap ( |
---|
1912 | .din (pich_cnt_wrap_datain[3]), |
---|
1913 | .q (pich_cnt_wrap[3]), |
---|
1914 | .clk (clk), |
---|
1915 | .en (update_pich_wrap_en[3]), |
---|
1916 | .rst (local_rst | wsr_pic_sel[3]), |
---|
1917 | .se (se), |
---|
1918 | .si (), |
---|
1919 | .so () |
---|
1920 | ); |
---|
1921 | // |
---|
1922 | // generating the over-flow (0->1) to be set in sftint[15] |
---|
1923 | assign pib_picl_wrap[0] = |
---|
1924 | ((picl_cnt_wrap[0] ^ picl_cnt0[`PIB_PIC_CNT_WIDTH-1]) & incr_evq[0]); |
---|
1925 | assign pib_picl_wrap[1] = |
---|
1926 | ((picl_cnt_wrap[1] ^ picl_cnt1[`PIB_PIC_CNT_WIDTH-1]) & incr_evq[1]); |
---|
1927 | assign pib_picl_wrap[2] = |
---|
1928 | ((picl_cnt_wrap[2] ^ picl_cnt2[`PIB_PIC_CNT_WIDTH-1]) & incr_evq[2]); |
---|
1929 | assign pib_picl_wrap[3] = |
---|
1930 | ((picl_cnt_wrap[3] ^ picl_cnt3[`PIB_PIC_CNT_WIDTH-1]) & incr_evq[3]); |
---|
1931 | // |
---|
1932 | endmodule |
---|