source: XOpenSparcT1/trunk/T1-CPU/tlu/tlu_misctl.v @ 6

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

versione iniziale opensparc

Line 
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T1 Processor File: tlu_misctl.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:    Block that contain most of miscellaneous
24//                      control and datapath components
25//                      to alleviate tdp and tcp congestions
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
39module  tlu_misctl (/*AUTOARG*/
40    // outputs
41    tlu_exu_cwp_m, tlu_exu_ccr_m, tlu_lsu_asi_m, tlu_cwp_no_change_m, 
42    tlu_sscan_misctl_data, tlu_ifu_trappc_w2, tlu_ifu_trapnpc_w2, 
43    tlu_pc_new_w, tlu_npc_new_w, so, 
44    // PIC experiment
45    tlu_exu_pic_onebelow_m, tlu_exu_pic_twobelow_m, 
46    // inputs
47    ctu_sscan_tid, ifu_tlu_pc_m, exu_tlu_cwp0, exu_tlu_cwp1, exu_tlu_cwp2, 
48    exu_tlu_cwp3, tlu_final_ttype_w2, tsa_wr_tid, tlu_true_pc_sel_w, 
49    tsa1_wr_vld, tsa_ttype_en, tsa_rd_vld_e, tsa0_rdata_cwp, tsa0_rdata_pstate,
50    tsa0_rdata_asi, tsa0_rdata_ccr, tsa0_rdata_gl, tsa0_rdata_pc, tsa1_rdata_ttype, 
51    tsa1_rdata_npc, tsa1_rdata_htstate, tlu_thrd_rsel_e, tlu_final_offset_w1, 
52    tlu_partial_trap_pc_w1,  tlu_restore_pc_w1, tlu_restore_npc_w1, 
53    ifu_npc_w, tlu_restore_pc_sel_w1, tlu_pic_cnt_en_m, tlu_pic_onebelow_e,
54    tlu_pic_twobelow_e, tlu_rst, si, se, rclk);
55    // pich_threebelow_flg, pich_twobelow_flg, pich_onebelow_flg,
56
57//=================================================
58// output
59//=================================================
60output [`TSA_CCR_WIDTH-1:0] tlu_exu_ccr_m; // restored ccr
61output [`TSA_CWP_WIDTH-1:0] tlu_exu_cwp_m; // restored cwp
62output [`TLU_ASI_STATE_WIDTH-1:0] tlu_lsu_asi_m; // restored asi
63output tlu_cwp_no_change_m; // cwp change indicator
64//
65// sscan output
66output [`MISCTL_SSCAN_WIDTH-1:0] tlu_sscan_misctl_data;
67//
68// trap pc and npc
69output [48:0] tlu_ifu_trappc_w2, tlu_ifu_trapnpc_w2; 
70output [48:0] tlu_pc_new_w, tlu_npc_new_w; 
71// global nets
72output so;
73// PIC experiment
74output       tlu_exu_pic_onebelow_m; // local traps send to exu
75output       tlu_exu_pic_twobelow_m; // local traps send to exu
76
77//=================================================
78// input
79//=================================================
80// sscan related inputs
81input [`TLU_THRD_NUM-1:0] ctu_sscan_tid;
82input [`TSA_TTYPE_WIDTH-1:0] tlu_final_ttype_w2;
83input [1:0] tsa_wr_tid; 
84input tsa1_wr_vld, tsa_rd_vld_e; 
85input tsa_ttype_en; 
86//
87// current cwp value from exu
88input [2:0]  exu_tlu_cwp0;  // cwp - thread0
89input [2:0]  exu_tlu_cwp1;  // cwp - thread1
90input [2:0]  exu_tlu_cwp2;  // cwp - thread2
91input [2:0]  exu_tlu_cwp3;  // cwp - thread3
92//
93// componets from trap stack arrays (tsas)
94input [`TSA_CWP_WIDTH-1:0] tsa0_rdata_cwp;
95input [`TSA_PSTATE_WIDTH-1:0] tsa0_rdata_pstate;
96input [`TSA_CCR_WIDTH-1:0] tsa0_rdata_ccr;
97input [`TLU_ASI_STATE_WIDTH-1:0] tsa0_rdata_asi;
98input [`TSA_GLOBAL_WIDTH-1:0] tsa0_rdata_gl;
99input [46:0] tsa0_rdata_pc;
100input [`TSA_TTYPE_WIDTH-1:0] tsa1_rdata_ttype;
101input [46:0] tsa1_rdata_npc;
102input [`TSA_HTSTATE_WIDTH-1:0] tsa1_rdata_htstate;
103//
104// trap pc calculations signals
105input [48:0] ifu_tlu_pc_m;        // pc
106// input [48:0] ifu_tlu_npc_m;   // npc
107input [`TSA_TTYPE_WIDTH-1:0] tlu_final_offset_w1;
108input [33:0] tlu_partial_trap_pc_w1;
109input [48:0] tlu_restore_pc_w1;
110input [48:0] tlu_restore_npc_w1;
111// input [48:0] ifu_pc_w;
112input [48:0] ifu_npc_w;
113input tlu_restore_pc_sel_w1; 
114//
115// modified due to timing fix
116input [2:0] tlu_true_pc_sel_w;
117// input tlu_retry_inst_m;
118// input tlu_done_inst_m;
119// input tlu_dnrtry_inst_m_l;
120//
121input [`TLU_THRD_NUM-1:0] tlu_thrd_rsel_e;
122// global nets
123input si, se;
124//
125//clk
126input rclk;
127//
128// PIC trap experiment
129// input [`TLU_THRD_NUM-1:0] tlu_thread_inst_vld_w2; // valid inst for a thread
130// input [`TLU_THRD_NUM-1:0] pich_threebelow_flg;
131// input [`TLU_THRD_NUM-1:0] pich_twobelow_flg;
132// input [`TLU_THRD_NUM-1:0] pich_onebelow_flg;
133input tlu_pic_onebelow_e;
134input tlu_pic_twobelow_e;
135input tlu_pic_cnt_en_m;
136input tlu_rst;
137
138//=================================================
139// local wires
140//=================================================
141// local clock
142wire clk;
143//
144// staged thread id
145wire [`TLU_THRD_NUM-1:0] thrd_sel_m;
146wire [`TLU_THRD_NUM-1:0] tsa_wsel_thrd_w2;
147//
148// staged tsa_controls
149wire tsa_rd_vld_m; // tsa_rd_vld_e, 
150//
151// components from tsas
152// tsa0
153wire [`TLU_ASI_STATE_WIDTH-1:0] tsa0_asi_m;
154wire [`TSA_CWP_WIDTH-1:0] tsa0_cwp_m;
155wire [`TSA_CCR_WIDTH-1:0] tsa0_ccr_m;
156wire [`TSA_PSTATE_WIDTH-1:0] tsa0_pstate_m;
157wire [`TSA_GLOBAL_WIDTH-1:0] tsa0_gl_m;
158wire [46:0] tsa0_pc_m;
159// tsa1
160wire [`TSA_TTYPE_WIDTH-1:0]   tsa1_ttype_m;
161wire [`TSA_HTSTATE_WIDTH-1:0] tsa1_htstate_m;
162wire [46:0] tsa1_npc_m;
163//
164// modified for timing
165// wire [48:0] pc_new_m, npc_new_m;
166wire [48:0] pc_new_w, npc_new_w, ifu_pc_w;
167wire [46:0] tsa0_pc_w, tsa1_npc_w;
168//
169// sscan related signals
170wire [`TLU_THRD_NUM-1:0] sscan_tid_sel; 
171wire [`TLU_THRD_NUM-1:0] sscan_ttype_en;
172wire [`TLU_THRD_NUM-1:0] sscan_tt_rd_sel;
173wire [`TLU_THRD_NUM-1:0] sscan_tt_wr_sel;
174wire [`TSA_TTYPE_WIDTH-1:0] sscan_tt0_data;
175wire [`TSA_TTYPE_WIDTH-1:0] sscan_tt1_data;
176wire [`TSA_TTYPE_WIDTH-1:0] sscan_tt2_data;
177wire [`TSA_TTYPE_WIDTH-1:0] sscan_tt3_data;
178wire [`TSA_TTYPE_WIDTH-1:0] sscan_tt0_din;
179wire [`TSA_TTYPE_WIDTH-1:0] sscan_tt1_din;
180wire [`TSA_TTYPE_WIDTH-1:0] sscan_tt2_din;
181wire [`TSA_TTYPE_WIDTH-1:0] sscan_tt3_din;
182wire [`MISCTL_SSCAN_WIDTH-1:0] misctl_sscan_test_data;
183//
184// cwp logic
185wire cwp_no_change_m;
186wire [`TSA_CWP_WIDTH-1:0] cwp_xor_m, trap_old_cwp_m; 
187wire [48:0] normal_trap_pc_w1, normal_trap_npc_w1; 
188wire [48:0] trap_pc_w1, trap_npc_w1; 
189wire [48:0] trap_pc_w2, trap_npc_w2; 
190//
191// PIC experiment
192wire tlu_pic_onebelow_m, tlu_pic_twobelow_m; 
193// wire [`TLU_THRD_NUM-1:0] pic_onebelow_e, pic_twobelow_e;
194wire local_rst;
195//
196//=========================================================================================
197// local clock
198//=========================================================================================
199
200assign clk = rclk; 
201
202//=========================================================================================
203//      TSA data capture
204//=========================================================================================
205
206dff_s #(`TSA_CCR_WIDTH) dff_tsa0_ccr_m (
207    .din (tsa0_rdata_ccr[`TSA_CCR_WIDTH-1:0]),
208    .q   (tsa0_ccr_m[`TSA_CCR_WIDTH-1:0]),
209    .clk (clk),
210    .se  (se),
211    .si  (),
212    .so  ()
213);
214
215dff_s #(`TSA_CWP_WIDTH) dff_tsa0_cwp_m (
216    .din (tsa0_rdata_cwp[`TSA_CWP_WIDTH-1:0]),
217    .q   (tsa0_cwp_m[`TSA_CWP_WIDTH-1:0]),
218    .clk (clk),
219    .se  (se),
220    .si  (),
221    .so  ()
222);
223
224dff_s #(`TLU_ASI_STATE_WIDTH) dff_lsu_asi_m (
225    .din (tsa0_rdata_asi[`TLU_ASI_STATE_WIDTH-1:0]),
226    .q   (tsa0_asi_m[`TLU_ASI_STATE_WIDTH-1:0]),
227    .clk (clk),
228    .se  (se),
229    .si  (),
230    .so  ()
231    );
232
233dff_s #(`TSA_PSTATE_WIDTH) dff_tsa0_pstate_m (
234    .din (tsa0_rdata_pstate[`TSA_CCR_WIDTH-1:0]),
235    .q   (tsa0_pstate_m[`TSA_PSTATE_WIDTH-1:0]),
236    .clk (clk),
237    .se  (se),
238    .si  (),
239    .so  ()
240);
241
242dff_s #(`TSA_GLOBAL_WIDTH) dff_tsa0_gl_m (
243    .din (tsa0_rdata_gl[`TSA_GLOBAL_WIDTH-1:0]),
244    .q   (tsa0_gl_m[`TSA_GLOBAL_WIDTH-1:0]),
245    .clk (clk),
246    .se  (se),
247    .si  (),
248    .so  ()
249);
250
251dff_s #(47) dff_tsa0_pc_m (
252    .din (tsa0_rdata_pc[46:0]),
253    .q   (tsa0_pc_m[46:0]),
254    .clk (clk),
255    .se  (se),
256    .si  (),
257    .so  ()
258);
259
260dff_s #(`TSA_TTYPE_WIDTH) dff_tsa1_ttype_m (
261    .din (tsa1_rdata_ttype[`TSA_TTYPE_WIDTH-1:0]), 
262        .q   (tsa1_ttype_m[`TSA_TTYPE_WIDTH-1:0]),
263    .clk (clk),
264    .se  (se),
265    .si  (),
266    .so  ()
267);
268
269dff_s #(`TSA_HTSTATE_WIDTH) dff_tsa1_htstate_m (
270    .din (tsa1_rdata_htstate[`TSA_HTSTATE_WIDTH-1:0]), 
271        .q   (tsa1_htstate_m[`TSA_HTSTATE_WIDTH-1:0]),
272    .clk (clk),
273    .se  (se),
274    .si  (),
275    .so  ()
276);
277
278dff_s #(47) dff_tsa1_npc_m (
279    .din (tsa1_rdata_npc[46:0]),
280    .q   (tsa1_npc_m[46:0]),
281    .clk (clk),
282    .se  (se),
283    .si  (),
284    .so  ()
285);
286//
287//=========================================================================================
288//      CWP/CCR restoration
289//=========================================================================================
290
291assign tlu_exu_ccr_m[`TSA_CCR_WIDTH-1:0] = 
292           tsa0_ccr_m[`TSA_CCR_WIDTH-1:0];
293assign tlu_exu_cwp_m[`TSA_CWP_WIDTH-1:0] = 
294           tsa0_cwp_m[`TSA_CWP_WIDTH-1:0];
295assign tlu_lsu_asi_m[`TLU_ASI_STATE_WIDTH-1:0] = 
296           tsa0_asi_m[`TLU_ASI_STATE_WIDTH-1:0];
297
298// modified/added for timing violations
299// moved the logic from exu to tlu due to timing violations
300
301dff_s #(`TLU_THRD_NUM) dff_thrd_sel_m (
302    .din (tlu_thrd_rsel_e[`TLU_THRD_NUM-1:0]),
303        .q   (thrd_sel_m[`TLU_THRD_NUM-1:0]),
304    .clk (clk),
305    .se  (se),
306    .si  (),
307    .so  ()
308);
309
310mux4ds #(`TSA_CWP_WIDTH) mux_trap_old_cwp_m(
311    .in0(exu_tlu_cwp0[`TSA_CWP_WIDTH-1:0]),
312    .in1(exu_tlu_cwp1[`TSA_CWP_WIDTH-1:0]), 
313    .in2(exu_tlu_cwp2[`TSA_CWP_WIDTH-1:0]),
314    .in3(exu_tlu_cwp3[`TSA_CWP_WIDTH-1:0]),
315    .sel0(thrd_sel_m[0]),
316    .sel1(thrd_sel_m[1]),
317    .sel2(thrd_sel_m[2]),
318    .sel3(thrd_sel_m[3]),
319    .dout(trap_old_cwp_m[`TSA_CWP_WIDTH-1:0])
320);
321
322assign cwp_xor_m[`TSA_CWP_WIDTH-1:0] = 
323           trap_old_cwp_m[`TSA_CWP_WIDTH-1:0] ^ tlu_exu_cwp_m[`TSA_CWP_WIDTH-1:0];
324
325assign cwp_no_change_m = ~|(cwp_xor_m[`TSA_CWP_WIDTH-1:0]); 
326
327assign tlu_cwp_no_change_m = cwp_no_change_m;
328
329//=========================================================================================
330//      Generate TTYPE SSCAN data
331//=========================================================================================
332//
333// staging the tsa_rd_vld signal
334// moved to tlu_tcl for timing
335/*
336dff_s dff_tsa_rd_vld_e (
337    .din (tsa_rd_vld),
338        .q   (tsa_rd_vld_e),
339    .clk (clk),
340    .se  (se),
341    .si  (),
342    .so  ()
343);
344*/
345
346dff_s dff_tsa_rd_vld_m (
347    .din (tsa_rd_vld_e),
348        .q   (tsa_rd_vld_m),
349    .clk (clk),
350    .se  (se),
351    .si  (),
352    .so  ()
353);
354
355assign  tsa_wsel_thrd_w2[0] = ~tsa_wr_tid[1] & ~tsa_wr_tid[0];
356assign  tsa_wsel_thrd_w2[1] = ~tsa_wr_tid[1] &  tsa_wr_tid[0];
357assign  tsa_wsel_thrd_w2[2]=   tsa_wr_tid[1] & ~tsa_wr_tid[0];
358assign  tsa_wsel_thrd_w2[3] =  tsa_wr_tid[1] &  tsa_wr_tid[0];
359
360// generating write indicators of ttype to the tsa
361assign sscan_tt_wr_sel[0] = 
362           tsa_ttype_en & tsa1_wr_vld & tsa_wsel_thrd_w2[0]; 
363assign sscan_tt_wr_sel[1] = 
364           tsa_ttype_en & tsa1_wr_vld & tsa_wsel_thrd_w2[1]; 
365assign sscan_tt_wr_sel[2] = 
366           tsa_ttype_en & tsa1_wr_vld & tsa_wsel_thrd_w2[2]; 
367assign sscan_tt_wr_sel[3] = 
368           tsa_ttype_en & tsa1_wr_vld & tsa_wsel_thrd_w2[3];
369//
370// generating read indicators of ttype from the tsa
371assign sscan_tt_rd_sel[0] = 
372           tsa_rd_vld_m & thrd_sel_m[0]; 
373assign sscan_tt_rd_sel[1] = 
374           tsa_rd_vld_m & thrd_sel_m[1]; 
375assign sscan_tt_rd_sel[2] = 
376           tsa_rd_vld_m & thrd_sel_m[2]; 
377assign sscan_tt_rd_sel[3] = 
378           tsa_rd_vld_m & thrd_sel_m[3]; 
379
380assign sscan_ttype_en[0] = 
381           sscan_tt_rd_sel[0] | sscan_tt_wr_sel[0]; 
382assign sscan_ttype_en[1] = 
383           sscan_tt_rd_sel[1] | sscan_tt_wr_sel[1]; 
384assign sscan_ttype_en[2] = 
385           sscan_tt_rd_sel[2] | sscan_tt_wr_sel[2]; 
386assign sscan_ttype_en[3] = 
387           sscan_tt_rd_sel[3] | sscan_tt_wr_sel[3]; 
388//
389assign sscan_tt0_din[`TSA_TTYPE_WIDTH-1:0] = 
390           (sscan_tt_wr_sel[0]) ? 
391            tlu_final_ttype_w2[`TSA_TTYPE_WIDTH-1:0] :
392            tsa1_ttype_m[`TSA_TTYPE_WIDTH-1:0]; 
393assign sscan_tt1_din[`TSA_TTYPE_WIDTH-1:0] = 
394           (sscan_tt_wr_sel[1]) ? 
395            tlu_final_ttype_w2[`TSA_TTYPE_WIDTH-1:0] :
396            tsa1_ttype_m[`TSA_TTYPE_WIDTH-1:0]; 
397assign sscan_tt2_din[`TSA_TTYPE_WIDTH-1:0] = 
398           (sscan_tt_wr_sel[2]) ? 
399            tlu_final_ttype_w2[`TSA_TTYPE_WIDTH-1:0] :
400            tsa1_ttype_m[`TSA_TTYPE_WIDTH-1:0]; 
401assign sscan_tt3_din[`TSA_TTYPE_WIDTH-1:0] = 
402           (sscan_tt_wr_sel[3]) ? 
403            tlu_final_ttype_w2[`TSA_TTYPE_WIDTH-1:0] :
404            tsa1_ttype_m[`TSA_TTYPE_WIDTH-1:0]; 
405//
406dffe_s #(`TSA_TTYPE_WIDTH) dffe_sscan_tt0_data (
407    .din (sscan_tt0_din[`TSA_TTYPE_WIDTH-1:0]), 
408    .q   (sscan_tt0_data[`TSA_TTYPE_WIDTH-1:0]),
409    .en  (sscan_ttype_en[0]), 
410    .clk (clk),
411    .se  (se),
412    .si  (),
413    .so  ()
414);
415
416dffe_s #(`TSA_TTYPE_WIDTH) dffe_sscan_tt1_data (
417    .din (sscan_tt1_din[`TSA_TTYPE_WIDTH-1:0]), 
418    .q   (sscan_tt1_data[`TSA_TTYPE_WIDTH-1:0]),
419    .en  (sscan_ttype_en[1]), 
420    .clk (clk),
421    .se  (se),
422    .si  (),
423    .so  ()
424);
425
426dffe_s #(`TSA_TTYPE_WIDTH) dffe_sscan_tt2_data (
427    .din (sscan_tt2_din[`TSA_TTYPE_WIDTH-1:0]), 
428    .q   (sscan_tt2_data[`TSA_TTYPE_WIDTH-1:0]),
429    .en  (sscan_ttype_en[2]), 
430    .clk (clk),
431    .se  (se),
432    .si  (),
433    .so  ()
434);
435
436dffe_s #(`TSA_TTYPE_WIDTH) dffe_sscan_tt3_data (
437    .din (sscan_tt3_din[`TSA_TTYPE_WIDTH-1:0]), 
438    .q   (sscan_tt3_data[`TSA_TTYPE_WIDTH-1:0]),
439    .en  (sscan_ttype_en[3]), 
440    .clk (clk),
441    .se  (se),
442    .si  (),
443    .so  ()
444);
445
446assign sscan_tid_sel[`TLU_THRD_NUM-1:0] = 
447           ctu_sscan_tid[`TLU_THRD_NUM-1:0]; 
448
449mux4ds #(`MISCTL_SSCAN_WIDTH) mx_sscan_test_data (
450       .in0  (sscan_tt0_data[`TSA_TTYPE_WIDTH-1:0]),
451       .in1  (sscan_tt1_data[`TSA_TTYPE_WIDTH-1:0]),
452       .in2  (sscan_tt2_data[`TSA_TTYPE_WIDTH-1:0]),
453       .in3  (sscan_tt3_data[`TSA_TTYPE_WIDTH-1:0]),
454       .sel0 (sscan_tid_sel[0]),
455       .sel1 (sscan_tid_sel[1]),
456       .sel2 (sscan_tid_sel[2]),
457       .sel3 (sscan_tid_sel[3]),
458       .dout (misctl_sscan_test_data[`MISCTL_SSCAN_WIDTH-1:0])
459); 
460
461assign tlu_sscan_misctl_data[`MISCTL_SSCAN_WIDTH-1:0] = 
462           misctl_sscan_test_data[`MISCTL_SSCAN_WIDTH-1:0]; 
463//
464// code moved from tlu_tcl - trap pc delivery logic
465//
466assign  normal_trap_pc_w1[48:0] = 
467            {1'b0, tlu_partial_trap_pc_w1[33:0],
468             tlu_final_offset_w1[`TSA_TTYPE_WIDTH-1:0], 5'b00000};
469assign  normal_trap_npc_w1[48:0] = 
470            {1'b0, tlu_partial_trap_pc_w1[33:0],
471             tlu_final_offset_w1[`TSA_TTYPE_WIDTH-1:0], 5'b00100};
472//
473// code moved from tlu_tdp
474mux2ds #(49) mx_trap_pc_w1 (
475       .in0  (normal_trap_pc_w1[48:0]), 
476       .in1  (tlu_restore_pc_w1[48:0]),
477       .sel0 (~tlu_restore_pc_sel_w1), 
478       .sel1 (tlu_restore_pc_sel_w1),
479       .dout (trap_pc_w1[48:0])
480);           
481//
482dff_s #(49) dff_trap_pc_w2 (
483    .din (trap_pc_w1[48:0]),   
484    .q   (trap_pc_w2[48:0]),
485    .clk (clk),
486    .se  (se),       
487    .si  (),         
488    .so  ()
489);
490
491assign tlu_ifu_trappc_w2[48:0] = trap_pc_w2[48:0];
492
493mux2ds #(49) mx_trap_npc_w1 (
494       .in0  (normal_trap_npc_w1[48:0]), 
495       .in1  (tlu_restore_npc_w1[48:0]),
496       .sel0 (~tlu_restore_pc_sel_w1), 
497       .sel1 (tlu_restore_pc_sel_w1),
498       .dout (trap_npc_w1[48:0])
499);           
500//
501dff_s #(49) dff_trap_npc_w2 (
502    .din (trap_npc_w1[48:0]),   
503    .q   (trap_npc_w2[48:0]),
504    .clk (clk),
505    .se  (se),       
506    .si  (),         
507    .so  ()
508);
509
510assign tlu_ifu_trapnpc_w2[48:0] = trap_npc_w2[48:0];
511
512//--------------------------------------------------------------------------------
513// Recovery PC and NPC selection
514//--------------------------------------------------------------------------------
515// On done, npc will become pc.
516// modified for timing
517//
518dff_s #(47) dff_tsa0_pc_w (
519    .din (tsa0_pc_m[46:0]),     
520    .q   (tsa0_pc_w[46:0]),
521    .clk (clk),
522    .se  (se),       
523    .si  (),         
524    .so  ()
525);
526
527dff_s #(49) dff_ifu_pc_w (
528    .din (ifu_tlu_pc_m[48:0]), 
529    .q   (ifu_pc_w[48:0]),
530    .clk (clk),
531    .se  (se),       
532    .si  (),         
533    .so  ()
534);
535
536mux3ds #(49) mux_pc_new_w (
537       .in0  ({tsa0_pc_w[46:0], 2'b00}),       
538           .in1  ({tsa1_npc_w[46:0], 2'b00}),
539           .in2  (ifu_pc_w[48:0]),
540       .sel0 (tlu_true_pc_sel_w[0]),   
541           .sel1 (tlu_true_pc_sel_w[1]),
542           .sel2 (tlu_true_pc_sel_w[2]),
543       .dout (pc_new_w[48:0])
544); 
545
546assign tlu_pc_new_w[48:0] = pc_new_w[48:0];
547
548//
549// On done, npc will become pc.
550// On done, npc will stay npc. The valid to the IFU will
551// not be signaled along with npc for a done.
552// modified for timing
553dff_s #(47) dff_tsa1_npc_w (
554    .din (tsa1_npc_m[46:0]),   
555    .q   (tsa1_npc_w[46:0]),
556    .clk (clk),
557    .se  (se),       
558    .si  (),         
559    .so  ()
560);
561
562mux2ds #(49) mux_npc_new_w (
563       .in0  ({tsa1_npc_w[46:0],2'b00}),       
564       .in1  (ifu_npc_w[48:0]),
565       .sel0 (~tlu_true_pc_sel_w[2]),   
566       .sel1 (tlu_true_pc_sel_w[2]),
567       .dout (npc_new_w[48:0])
568); 
569
570assign tlu_npc_new_w[48:0] = npc_new_w[48:0];
571
572//--------------------------------------------------------------------------------
573// PIC trap experiment
574//--------------------------------------------------------------------------------
575
576// added for bug 4785
577assign local_rst = tlu_rst;
578
579dffr_s dffr_tlu_exu_pic_onebelow_m (
580   .din (tlu_pic_onebelow_e),
581   .q   (tlu_pic_onebelow_m),
582   .rst (local_rst),
583   .clk (clk),
584   .se  (se),       
585   .si  (),         
586   .so  ()
587);
588
589dffr_s dffr_tlu_exu_pic_twobelow_m (
590   .din (tlu_pic_twobelow_e),
591   .q   (tlu_pic_twobelow_m),
592   .rst (local_rst),
593   .clk (clk),
594   .se  (se),       
595   .si  (),         
596   .so  ()
597);
598
599assign tlu_exu_pic_onebelow_m = 
600           tlu_pic_onebelow_m & tlu_pic_cnt_en_m;
601
602assign tlu_exu_pic_twobelow_m = 
603           tlu_pic_twobelow_m & tlu_pic_cnt_en_m;
604
605/*
606assign pic_onebelow_e[0] =
607       tlu_thread_inst_vld_w2[0]? pich_twobelow_flg[0]: pich_onebelow_flg[0];
608assign pic_onebelow_e[1] =
609       tlu_thread_inst_vld_w2[1]? pich_twobelow_flg[1]: pich_onebelow_flg[1];
610assign pic_onebelow_e[2] =
611       tlu_thread_inst_vld_w2[2]? pich_twobelow_flg[2]: pich_onebelow_flg[2];
612assign pic_onebelow_e[3] =
613       tlu_thread_inst_vld_w2[3]? pich_twobelow_flg[3]: pich_onebelow_flg[3];
614
615assign tlu_pic_onebelow_e =
616           (tlu_thrd_rsel_e[0]) ? pic_onebelow_e[0]:
617           (tlu_thrd_rsel_e[1]) ? pic_onebelow_e[1]:
618           (tlu_thrd_rsel_e[2]) ? pic_onebelow_e[2]:
619            pic_onebelow_e[3];
620
621assign pic_twobelow_e[0] =
622       tlu_thread_inst_vld_w2[0]? pich_threebelow_flg[0]: pich_twobelow_flg[0];
623assign pic_twobelow_e[1] =
624       tlu_thread_inst_vld_w2[1]? pich_threebelow_flg[1]: pich_twobelow_flg[1];
625assign pic_twobelow_e[2] =
626       tlu_thread_inst_vld_w2[2]? pich_threebelow_flg[2]: pich_twobelow_flg[2];
627assign pic_twobelow_e[3] =
628       tlu_thread_inst_vld_w2[3]? pich_threebelow_flg[3]: pich_twobelow_flg[3];
629
630assign tlu_pic_twobelow_e =
631           (tlu_thrd_rsel_e[0]) ? pic_twobelow_e[0]:
632           (tlu_thrd_rsel_e[1]) ? pic_twobelow_e[1]:
633           (tlu_thrd_rsel_e[2]) ? pic_twobelow_e[2]:
634            pic_twobelow_e[3];
635*/
636
637endmodule
Note: See TracBrowser for help on using the repository browser.