OpenCores
URL https://opencores.org/ocsvn/s1_core/s1_core/trunk

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [hdl/] [rtl/] [sparc_core/] [tlu_misctl.v] - Blame information for rev 113

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.