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

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [hdl/] [rtl/] [sparc_core/] [tlu_hyperv.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_hyperv.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 the Hypervisor support
29
//                      additions
30
*/
31
////////////////////////////////////////////////////////////////////////
32
// Global header file includes
33
////////////////////////////////////////////////////////////////////////
34 113 albert.wat
`include        "sys.h" // system level definition file which contains the
35 95 fafa1971
                        // time scale definition
36
 
37 113 albert.wat
`include "tlu.h"
38 95 fafa1971
 
39
////////////////////////////////////////////////////////////////////////
40
// Local header file includes / local defines
41
////////////////////////////////////////////////////////////////////////
42
 
43
module  tlu_hyperv (/*AUTOARG*/
44
    // outputs
45
    tlu_htickcmp_rw_e, tlu_gl_rw_m, tlu_hpstate_din_sel0, tlu_hpstate_din_sel1,
46
    tlu_hpstate_din_sel2, tlu_hpstate_din_sel3, tlu_update_hpstate_l_w2,
47
    tlu_htickcmp_intdis, tlu_gl_lvl0, tlu_gl_lvl1, tlu_gl_lvl2, tlu_gl_lvl3,
48
    tlu_htstate_rw_d, tlu_wr_hintp_g, tlu_htstate_rw_g, tlu_set_hintp_sel_g,
49
    tlu_htba_en_l, tlu_scpd_wr_addr_g, tlu_scpd_wr_vld_g, tlu_scpd_rd_vld_m,
50
    tlu_scpd_rd_addr_m, tlu_hscpd_dacc_excpt_m, tlu_hyperv_rdpr_sel,
51
    tlu_exu_agp_swap, tlu_exu_agp, tlu_cpu_mondo_cmp, tlu_dev_mondo_cmp,
52
    tlu_resum_err_cmp, tlu_asi_queue_rd_vld_g, tlu_asi_queue_data_g, tlu_ld_data_vld_g,
53
    tlu_va_ill_g, tlu_asi_queue_rdata_g, tlu_qtail_dacc_excpt_m, tlu_asi_write_g, so,
54
    inc_ind_asi_wr_indr, inc_ind_asi_wr_inrr, inc_ind_asi_rd_invr, tlu_local_thrid_g,
55
    // inputs
56
    ifu_tlu_thrid_d, ifu_tlu_sraddr_d, tlu_wsr_data_w_global, tlu_tickcmp_sel,
57
    tlu_thrd_traps_w2, tlu_wsr_inst_nq_g, tlu_dnrtry0_inst_g, tlu_dnrtry1_inst_g,
58
    tlu_dnrtry2_inst_g, tlu_dnrtry3_inst_g, tlu_dnrtry_global_g, tlu_tick_ctl_din,
59
    tlu_pstate_priv, tlu_select_tba_w2, tlu_hpstate_priv, tlu_hpstate_enb,
60
    tlu_asi_state_e, ifu_lsu_alt_space_e, ifu_lsu_ld_inst_e, ifu_lsu_st_inst_e,
61
    lsu_tlu_early_flush_w, tlu_por_rstint_g, tlu_agp_tid_w2, // exu_lsu_ldst_va_e, 
62
    tlu_local_flush_w, ifu_tlu_flush_fd_w, tlu_inst_vld_m, tlu_lsu_int_ldxa_vld_w2,
63
    tlu_asi_data_nf_vld_w2, lsu_tlu_ldst_va_m, arst_l, grst_l, rst_tri_en,
64
    si, se, rclk);
65
 
66
//=================================================
67
// output
68
//=================================================
69
// mux select to tdp to access the hyper-privileged ASR registers
70
output tlu_htickcmp_rw_e;
71
output tlu_gl_rw_m;
72
// output tlu_gl_rw_g;
73
 
74
// global switch indicator - used to be in tlu_tcl
75
output [1:0] tlu_exu_agp;
76
// output [1:0] tlu_exu_agp_tid;  
77
output tlu_exu_agp_swap;
78
//
79
// global register outputs
80 113 albert.wat
output [`TSA_GLOBAL_WIDTH-1:0] tlu_gl_lvl0; // global register value t0 
81
output [`TSA_GLOBAL_WIDTH-1:0] tlu_gl_lvl1; // global register value t1 
82
output [`TSA_GLOBAL_WIDTH-1:0] tlu_gl_lvl2; // global register value t2 
83
output [`TSA_GLOBAL_WIDTH-1:0] tlu_gl_lvl3; // global register value t3 
84 95 fafa1971
 
85
// mux selects to choose source of data to store in the hpstate regs 
86
output [1:0] tlu_hpstate_din_sel0;
87
output [1:0] tlu_hpstate_din_sel1;
88
output [1:0] tlu_hpstate_din_sel2;
89
output [1:0] tlu_hpstate_din_sel3;
90
//
91
// mux selects to read out the ASR registers
92
// output [3:0] tlu_rdpr_mx5_sel; 
93
output [4:0] tlu_hyperv_rdpr_sel;
94
// signal indicating mx5 is used
95
// output       tlu_rdpr_mx5_active; 
96
//
97
// hpstate write enable
98
// modified for timing
99
// output [`TLU_THRD_NUM-1:0] tlu_update_hpstate_l_g;
100 113 albert.wat
output [`TLU_THRD_NUM-1:0] tlu_update_hpstate_l_w2;
101 95 fafa1971
//
102
// htick compare reg write enable 
103
// output [`TLU_THRD_NUM-1:0] htickcmp_intdis_en;
104
// htick compare interrupt disable
105
output tlu_htickcmp_intdis;
106
 
107
//  clock enable for hintp regs.
108
// output [`TLU_THRD_NUM-1:0] tlu_hintp_en_l_g;
109
// wr control for hintp regs.
110 113 albert.wat
output [`TLU_THRD_NUM-1:0] tlu_wr_hintp_g;
111 95 fafa1971
// set control for hintp regs.
112
// output [`TLU_THRD_NUM-1:0] tlu_set_hintp_g;
113 113 albert.wat
output [`TLU_THRD_NUM-1:0] tlu_set_hintp_sel_g;
114 95 fafa1971
//
115
// update enable for the htba registers 
116 113 albert.wat
output [`TLU_THRD_NUM-1:0] tlu_htba_en_l;
117 95 fafa1971
// 
118
// hypervisor lite indicator
119
// output [`TLU_THRD_NUM-1:0] tlu_hyper_lite;
120
// 
121
// hyper-privileged scratch-pad data access exception 
122
output tlu_hscpd_dacc_excpt_m;
123
//
124
// store instruction to alt space
125
output tlu_asi_write_g;
126 113 albert.wat
output [`TLU_THRD_NUM-1:0] inc_ind_asi_wr_indr;
127
output [`TLU_THRD_NUM-1:0] inc_ind_asi_wr_inrr;
128
output [`TLU_THRD_NUM-1:0] inc_ind_asi_rd_invr;
129
output [`TLU_THRD_NUM-1:0] tlu_local_thrid_g;
130 95 fafa1971
 
131
// read and write valids for the scratch-pad 
132
output tlu_scpd_rd_vld_m, tlu_scpd_wr_vld_g;
133 113 albert.wat
output [`SCPD_RW_ADDR_WIDTH-1:0] tlu_scpd_wr_addr_g;
134
output [`SCPD_RW_ADDR_WIDTH-1:0] tlu_scpd_rd_addr_m;
135 95 fafa1971
//
136
// decode of the htstate register write/read
137
output tlu_htstate_rw_d;
138
output tlu_htstate_rw_g;
139
// 
140
// select for rdpr read in tlu_tdp
141
// output tlu_htba_rsr_sel; 
142
// 
143
// 
144 113 albert.wat
output [`TLU_THRD_NUM-1:0] tlu_cpu_mondo_cmp;
145
output [`TLU_THRD_NUM-1:0] tlu_dev_mondo_cmp;
146
output [`TLU_THRD_NUM-1:0] tlu_resum_err_cmp;
147 95 fafa1971
output tlu_qtail_dacc_excpt_m;
148
//
149
// asi queue rdata output
150 113 albert.wat
output [`TLU_ASI_QUE_WIDTH-1:0] tlu_asi_queue_rdata_g;
151 95 fafa1971
output tlu_asi_queue_rd_vld_g;
152
output tlu_ld_data_vld_g;
153
// output tlu_scpd_rd_vld_g;
154
output tlu_va_ill_g;
155
// output tlu_va_all_zero_g;
156
output tlu_lsu_int_ldxa_vld_w2;
157
//
158
// global nets
159
output so;
160
 
161
//=================================================
162
// input
163
//=================================================
164
// non-thread specific por reset indicator
165
// modified for timing
166
// input [1:0] ifu_tlu_thrid_e; 
167
input [1:0] ifu_tlu_thrid_d;
168
// 
169
// staged write asr instruction
170
// modified for timing 
171
// input tlu_wsr_inst_g;
172
input tlu_wsr_inst_nq_g;
173
 
174
// non-threaded por instruciton 
175 113 albert.wat
input [`TLU_THRD_NUM-1:0] tlu_por_rstint_g;
176 95 fafa1971
// 
177
// addr of sr(st/pr)
178 113 albert.wat
input [`TLU_ASR_ADDR_WIDTH-1:0] ifu_tlu_sraddr_d;
179 95 fafa1971
//
180
// staged pr/st data from irf.
181 113 albert.wat
input [`TLU_GLOBAL_WIDTH-1:0] tlu_wsr_data_w_global;
182 95 fafa1971
 
183
// restored global value for done/retry instructions 
184 113 albert.wat
input [`TSA_GLOBAL_WIDTH-1:0] tlu_dnrtry_global_g;
185 95 fafa1971
 
186
// thread specific done and retry signals
187
input tlu_dnrtry0_inst_g, tlu_dnrtry1_inst_g;
188
input tlu_dnrtry2_inst_g, tlu_dnrtry3_inst_g;
189
// 
190
// thread specific trap assetion signals
191
// modified due to timing
192
// input tlu_thrd0_traps, tlu_thrd1_traps;
193
// input tlu_thrd2_traps, tlu_thrd3_traps;
194 113 albert.wat
input [`TLU_THRD_NUM-1:0] tlu_thrd_traps_w2;
195 95 fafa1971
// 
196
// indicating whether the trap is supervisor or hypervisor 
197
// added for bug 2889
198
// modified due to timing
199
// input tlu_select_tba_g; 
200
input tlu_select_tba_w2;
201
//
202
input tlu_tick_ctl_din;
203
// htick compare match
204
// input tlu_htick_match;       
205
//
206
// select src for tickcmp 
207 113 albert.wat
input [`TLU_THRD_NUM-1:0] tlu_tickcmp_sel;
208 95 fafa1971
// 
209
// pstate - supervisor privilege  
210 113 albert.wat
input [`TLU_THRD_NUM-1:0] tlu_pstate_priv;
211 95 fafa1971
// hpstate - hypervisor privilege  
212 113 albert.wat
input [`TLU_THRD_NUM-1:0] tlu_hpstate_priv;
213 95 fafa1971
// hpstate - hypervisor lite enb  
214 113 albert.wat
input [`TLU_THRD_NUM-1:0] tlu_hpstate_enb;
215 95 fafa1971
// thread id for the agp that needs swap
216
// modified for timing
217
// input [1:0] tlu_agp_tid_g;
218
input [1:0] tlu_agp_tid_w2;
219
// ASI addresses and valid bits for decode to 
220
// access the ASI registers
221
input       ifu_lsu_alt_space_e; // valid bit for the ASI data
222
input       ifu_lsu_ld_inst_e;  // read enable
223
input       ifu_lsu_st_inst_e;  // write enable
224
// replaced due to timing violations
225
// input            tlu_nlsu_flush_w;   // trap flush 
226
input       tlu_local_flush_w;   // trap flush 
227
input       ifu_tlu_flush_fd_w;   // trap flush 
228
input       lsu_tlu_early_flush_w;   // trap flush 
229
input       tlu_asi_data_nf_vld_w2;   // trap flush 
230
input       tlu_inst_vld_m;     // instruciton valid 
231
//
232
// asi to be read/written
233 113 albert.wat
input [`TLU_ASI_STATE_WIDTH-1:0] tlu_asi_state_e;
234 95 fafa1971
// input [`TLU_ASI_VA_WIDTH-1:0] exu_lsu_ldst_va_e;  
235 113 albert.wat
input [`TLU_ASI_VA_WIDTH-1:0] lsu_tlu_ldst_va_m;
236 95 fafa1971
// head and tail pointers
237 113 albert.wat
input [`TLU_ASI_QUE_WIDTH-1:0] tlu_asi_queue_data_g;
238 95 fafa1971
 
239
//reset
240
// input tlu_rst_l;  // unit reset
241
input grst_l ;  // unit reset
242
input arst_l ;  // unit reset
243
input rst_tri_en ;  // unit reset
244
//clk
245
input rclk;
246
//
247
// global nets
248
input si, se;
249
 
250
/*AUTOOUTPUT*/
251
//
252
// staged thread id
253
wire [1:0] thrid_e, thrid_m, thrid_g;
254
// decoded thread id
255 113 albert.wat
wire [`TLU_THRD_NUM-1:0] thread_sel_id_e;
256
wire [`TLU_THRD_NUM-1:0] thread_sel_id_m;
257
wire [`TLU_THRD_NUM-1:0] thread_sel_id_g;
258
wire [`TLU_THRD_NUM-1:0] thread_sel_id_w2;
259 95 fafa1971
// 
260
// flush due to "early traps"
261
wire        local_flush_all_w;   // trap flush 
262
wire        local_flush_all_w2;   // trap flush 
263
//
264
// por indicators generations 
265
wire por_rstint0_g, por_rstint1_g;
266
wire por_rstint2_g, por_rstint3_g;
267
//
268
// GL register definitions - one GL register/thread
269 113 albert.wat
wire [`TSA_GLOBAL_WIDTH-1:0] gl_lvl0, gl_lvl1, gl_lvl2, gl_lvl3;
270 95 fafa1971
// updated value of the GL registers 
271 113 albert.wat
wire [`TSA_GLOBAL_WIDTH-1:0] gl_lvl0_new, gl_lvl1_new;
272
wire [`TSA_GLOBAL_WIDTH-1:0] gl_lvl2_new, gl_lvl3_new;
273
wire [`TSA_GLOBAL_WIDTH-1:0] gl_lvl0_update_g, gl_lvl1_update_g;
274
wire [`TSA_GLOBAL_WIDTH-1:0] gl_lvl2_update_g, gl_lvl3_update_g;
275
wire [`TSA_GLOBAL_WIDTH-1:0] gl_lvl0_update_w2, gl_lvl1_update_w2;
276
wire [`TSA_GLOBAL_WIDTH-1:0] gl_lvl2_update_w2, gl_lvl3_update_w2;
277
wire [`TSA_GLOBAL_WIDTH-1:0] wsr_gl_lvl0_data, wsr_gl_lvl1_data;
278
wire [`TSA_GLOBAL_WIDTH-1:0] wsr_gl_lvl2_data, wsr_gl_lvl3_data;
279
wire [`TSA_GLOBAL_WIDTH-1:0] dnrtry_gl_lvl0_data, dnrtry_gl_lvl1_data;
280
wire [`TSA_GLOBAL_WIDTH-1:0] dnrtry_gl_lvl2_data, dnrtry_gl_lvl3_data;
281 95 fafa1971
// value to be incremented for the GL registers
282
// modified due to timing
283
// wire gl0_incr_sel, gl1_incr_sel, gl2_incr_sel, gl3_incr_sel; 
284
// wire[1:0] gl_lvl0_incr, gl_lvl1_incr, gl_lvl2_incr, gl_lvl3_incr; 
285
// indicators to signal gl is at certain pre-defined values 
286
// added for timing
287 113 albert.wat
wire [`TLU_THRD_NUM-1:0] gl_incr_sel_w2;
288
wire [`TLU_THRD_NUM-1:0] gl_update_sel_g;
289
wire [`TLU_THRD_NUM-1:0] gl_update_sel_w2;
290
wire [`TLU_THRD_NUM-1:0] gl_priv_max_sel_w2;
291 95 fafa1971
wire gl_lvl0_at_maxgl, gl_lvl1_at_maxgl;
292
wire gl_lvl2_at_maxgl, gl_lvl3_at_maxgl;
293
wire gl_lvl0_at_maxstl, gl_lvl1_at_maxstl;
294
wire gl_lvl2_at_maxstl, gl_lvl3_at_maxstl;
295
// gl write enables  
296
wire gl0_en, gl1_en, gl2_en, gl3_en;
297 113 albert.wat
wire [`TLU_THRD_NUM-1:0] dnrtry_inst_w2;
298 95 fafa1971
// maxgl control
299 113 albert.wat
wire [`TLU_THRD_NUM-1:0] maxstl_gl_dnrtry_sel;
300
wire [`TLU_THRD_NUM-1:0] maxstl_gl_wr_sel;
301
wire [`TLU_THRD_NUM-1:0] maxgl_gl_wr_sel;
302 95 fafa1971
// decoded thread info for agp swap
303
// wire [`TLU_THRD_NUM-1:0] agp_thrid;
304 113 albert.wat
wire [`TLU_THRD_NUM-1:0] agp_thrid_w2;
305 95 fafa1971
// modified for for timing fix
306
// wire agp_swap; 
307
// wire [1:0] agp_new; 
308
wire wsr_inst_g, wsr_inst_w2;
309
wire agp_swap_w2, agp_swap_w3;
310
wire [1:0] agp_new_w2, agp_new_w3;
311
//
312
// hyper-privileged ASR registers
313 113 albert.wat
wire [`TLU_THRD_NUM-1:0] tlu_wr_hintp_g;
314 95 fafa1971
wire htba_rw_d, hpstate_rw_d, htstate_rw_d, hintp_rw_d;
315
wire htickcmp_rw_d, gl_rw_d;
316
wire htba_rw_e, hpstate_rw_e, htstate_rw_e, hintp_rw_e;
317
wire htickcmp_rw_e, gl_rw_e;
318
wire htba_rw_m, hpstate_rw_m, htstate_rw_m, hintp_rw_m;
319
wire htickcmp_rw_m, gl_rw_m;
320
wire htba_rw_g, hpstate_rw_g, htstate_rw_g, hintp_rw_g;
321
wire htickcmp_rw_g, gl_rw_g;
322 113 albert.wat
wire [`TLU_THRD_NUM-1:0] htickcmp_intdis_en;
323 95 fafa1971
wire hpstate_rw_w2;
324
//
325
// hyper-lite mode indicator
326 113 albert.wat
wire [`TLU_THRD_NUM-1:0] tlu_hyper_lite;
327 95 fafa1971
// 
328
// contorls to update the hpstate registers
329
// wire update_hpstate0_g, update_hpstate1_g;
330
// wire update_hpstate2_g, update_hpstate3_g;
331 113 albert.wat
wire [`TLU_THRD_NUM-1:0] update_hpstate_g;
332
wire [`TLU_THRD_NUM-1:0] update_hpstate_w2;
333 95 fafa1971
//
334
// htick interrupt disable control
335
wire htick_intdis0, htick_intdis1;
336
wire htick_intdis2, htick_intdis3;
337
//
338
// local addr of sr(st/pr) 
339 113 albert.wat
wire [`TLU_ASR_ADDR_WIDTH-3:0] sraddr;
340 95 fafa1971
 
341
// ASI_QUEUE for hyper visor
342
// thread 0
343 113 albert.wat
wire [`TLU_ASI_QUE_WIDTH-1:0] cpu_mondo0_head;
344
wire [`TLU_ASI_QUE_WIDTH-1:0] cpu_mondo0_tail;
345
wire [`TLU_ASI_QUE_WIDTH-1:0] dev_mondo0_head;
346
wire [`TLU_ASI_QUE_WIDTH-1:0] dev_mondo0_tail;
347
wire [`TLU_ASI_QUE_WIDTH-1:0] resum_err0_head;
348
wire [`TLU_ASI_QUE_WIDTH-1:0] resum_err0_tail;
349
wire [`TLU_ASI_QUE_WIDTH-1:0] nresum_err0_head;
350
wire [`TLU_ASI_QUE_WIDTH-1:0] nresum_err0_tail;
351 95 fafa1971
// thread 1
352 113 albert.wat
wire [`TLU_ASI_QUE_WIDTH-1:0] cpu_mondo1_head;
353
wire [`TLU_ASI_QUE_WIDTH-1:0] cpu_mondo1_tail;
354
wire [`TLU_ASI_QUE_WIDTH-1:0] dev_mondo1_head;
355
wire [`TLU_ASI_QUE_WIDTH-1:0] dev_mondo1_tail;
356
wire [`TLU_ASI_QUE_WIDTH-1:0] resum_err1_head;
357
wire [`TLU_ASI_QUE_WIDTH-1:0] resum_err1_tail;
358
wire [`TLU_ASI_QUE_WIDTH-1:0] nresum_err1_head;
359
wire [`TLU_ASI_QUE_WIDTH-1:0] nresum_err1_tail;
360 95 fafa1971
// thread 2
361 113 albert.wat
wire [`TLU_ASI_QUE_WIDTH-1:0] cpu_mondo2_head;
362
wire [`TLU_ASI_QUE_WIDTH-1:0] cpu_mondo2_tail;
363
wire [`TLU_ASI_QUE_WIDTH-1:0] dev_mondo2_head;
364
wire [`TLU_ASI_QUE_WIDTH-1:0] dev_mondo2_tail;
365
wire [`TLU_ASI_QUE_WIDTH-1:0] resum_err2_head;
366
wire [`TLU_ASI_QUE_WIDTH-1:0] resum_err2_tail;
367
wire [`TLU_ASI_QUE_WIDTH-1:0] nresum_err2_head;
368
wire [`TLU_ASI_QUE_WIDTH-1:0] nresum_err2_tail;
369 95 fafa1971
// thread 3
370 113 albert.wat
wire [`TLU_ASI_QUE_WIDTH-1:0] cpu_mondo3_head;
371
wire [`TLU_ASI_QUE_WIDTH-1:0] cpu_mondo3_tail;
372
wire [`TLU_ASI_QUE_WIDTH-1:0] dev_mondo3_head;
373
wire [`TLU_ASI_QUE_WIDTH-1:0] dev_mondo3_tail;
374
wire [`TLU_ASI_QUE_WIDTH-1:0] resum_err3_head;
375
wire [`TLU_ASI_QUE_WIDTH-1:0] resum_err3_tail;
376
wire [`TLU_ASI_QUE_WIDTH-1:0] nresum_err3_head;
377
wire [`TLU_ASI_QUE_WIDTH-1:0] nresum_err3_tail;
378 95 fafa1971
//
379
// read asi data from the asi queues
380 113 albert.wat
wire [`TLU_ASI_QUE_WIDTH-1:0] cpu_mondo_hd_rdata;
381
wire [`TLU_ASI_QUE_WIDTH-1:0] cpu_mondo_ta_rdata;
382
wire [`TLU_ASI_QUE_WIDTH-1:0] dev_mondo_hd_rdata;
383
wire [`TLU_ASI_QUE_WIDTH-1:0] dev_mondo_ta_rdata;
384
wire [`TLU_ASI_QUE_WIDTH-1:0] resum_err_hd_rdata;
385
wire [`TLU_ASI_QUE_WIDTH-1:0] resum_err_ta_rdata;
386
wire [`TLU_ASI_QUE_WIDTH-1:0] nresum_err_hd_rdata;
387
wire [`TLU_ASI_QUE_WIDTH-1:0] nresum_err_ta_rdata;
388
wire [`TLU_ASI_QUE_WIDTH-1:0] asi_queue_rdata1_g;
389
wire [`TLU_ASI_QUE_WIDTH-1:0] asi_queue_rdata2_g;
390 95 fafa1971
wire asi_qrdata_mx_sel2;
391
//
392
// head and tail comparison results
393
// modified due to timing violations
394
// wire cpu_mondo_head_rw_e,  cpu_mondo_tail_rw_e;
395
// wire dev_mondo_head_rw_e,  dev_mondo_tail_rw_e;
396
// wire resum_err_head_rw_e,  resum_err_tail_rw_e;
397
// wire nresum_err_head_rw_e, nresum_err_tail_rw_e;
398
//
399
wire cpu_mondo_head_rw_m,  cpu_mondo_tail_rw_m;
400
wire dev_mondo_head_rw_m,  dev_mondo_tail_rw_m;
401
wire resum_err_head_rw_m,  resum_err_tail_rw_m;
402
wire nresum_err_head_rw_m, nresum_err_tail_rw_m;
403
//
404
wire cpu_mondo_head_rw_g,  cpu_mondo_tail_rw_g;
405
wire dev_mondo_head_rw_g,  dev_mondo_tail_rw_g;
406
wire resum_err_head_rw_g,  resum_err_tail_rw_g;
407
wire nresum_err_head_rw_g, nresum_err_tail_rw_g;
408
// creating one-hot selects
409
// wire cpu_mondo_hd_onehot_g, cpu_mondo_ta_onehot_g;
410
// wire dev_mondo_hd_onehot_g, dev_mondo_ta_onehot_g;
411
// wire resum_err_hd_onehot_g, resum_err_ta_onehot_g;
412
// wire nresum_err_hd_onehot_g, nresum_err_ta_onehot_g;
413
// read 
414 113 albert.wat
wire [`TLU_THRD_NUM-1:0] cpu_mondo_head_rd_g;
415 95 fafa1971
wire cpu_mondo_hd_rd_g;
416 113 albert.wat
wire [`TLU_THRD_NUM-1:0] cpu_mondo_tail_rd_g;
417 95 fafa1971
wire cpu_mondo_ta_rd_g;
418 113 albert.wat
wire [`TLU_THRD_NUM-1:0] dev_mondo_head_rd_g;
419 95 fafa1971
wire dev_mondo_hd_rd_g;
420 113 albert.wat
wire [`TLU_THRD_NUM-1:0] dev_mondo_tail_rd_g;
421 95 fafa1971
wire dev_mondo_ta_rd_g;
422 113 albert.wat
wire [`TLU_THRD_NUM-1:0] resum_err_head_rd_g;
423 95 fafa1971
wire resum_err_hd_rd_g;
424 113 albert.wat
wire [`TLU_THRD_NUM-1:0] resum_err_tail_rd_g;
425 95 fafa1971
wire resum_err_ta_rd_g;
426 113 albert.wat
wire [`TLU_THRD_NUM-1:0] nresum_err_head_rd_g;
427 95 fafa1971
wire nresum_err_hd_rd_g;
428 113 albert.wat
wire [`TLU_THRD_NUM-1:0] nresum_err_tail_rd_g;
429 95 fafa1971
wire nresum_err_ta_rd_g;
430
wire [3:0] asi_qrdata_mx1_sel;
431
wire [3:0] asi_qrdata_mx2_sel;
432
// write 
433 113 albert.wat
wire [`TLU_THRD_NUM-1:0] cpu_mondo_head_wr_g;
434
wire [`TLU_THRD_NUM-1:0] cpu_mondo_tail_wr_g;
435
wire [`TLU_THRD_NUM-1:0] dev_mondo_head_wr_g;
436
wire [`TLU_THRD_NUM-1:0] dev_mondo_tail_wr_g;
437
wire [`TLU_THRD_NUM-1:0] resum_err_head_wr_g;
438
wire [`TLU_THRD_NUM-1:0] resum_err_tail_wr_g;
439
wire [`TLU_THRD_NUM-1:0] nresum_err_head_wr_g;
440
wire [`TLU_THRD_NUM-1:0] nresum_err_tail_wr_g;
441 95 fafa1971
// 
442
// ASI va address
443
// modified due to timing fix
444
// wire [`TLU_ASI_VA_WIDTH-1:0] tlu_ldst_va_e;
445 113 albert.wat
wire [`TLU_ASI_VA_WIDTH-1:0] tlu_ldst_va_m;
446 95 fafa1971
//
447
// ASI read or write enables
448
wire asi_queue_write_e;
449
wire asi_queue_read_e;
450
wire asi_queue_write_pq_m;
451
wire asi_queue_read_pq_m;
452
wire asi_queue_write_m;
453
wire asi_queue_read_m;
454
wire asi_queue_write_uf_g;
455
// wire asi_queue_read_uf_g;
456
wire asi_queue_write_g;
457
wire asi_queue_read_g;
458
//
459
// decoded ASI addresses 
460
// ASI QUE
461
wire asi_queue_rw_e, asi_queue_rw_m, asi_queue_rw_g;
462
wire asi_inrr_rw_e, asi_inrr_rw_m, asi_inrr_rw_g;
463
wire asi_indr_rw_e, asi_indr_rw_m, asi_indr_rw_g;
464
wire asi_invr_rw_e, asi_invr_rw_m, asi_invr_rw_g;
465
// supervisor scratch-pad asi state
466
wire asi_scpd_rw_e, asi_scpd_rw_m;
467
// hypervisor scratch-pad asi state
468
wire asi_hscpd_rw_e, asi_hscpd_rw_m;
469
wire asi_scpd_rw_vld_m, asi_scpd_rw_vld_g;
470
// legal va addresses
471
// modified due to timing
472
// wire que_legal_va_e;
473
wire que_legal_va_m;
474
// modified due to timing
475
// illegal va range indicator
476
// wire que_ill_va_e, 
477
wire que_ill_va_m, que_ill_va_g;
478
// modified due to timing
479
// wire scpd_ill_va_e, 
480
wire scpd_ill_va_m, scpd_ill_va_g;
481
// alignment checking
482
wire va_not_baligned_m;
483
// no longer necessary
484
// wire va_all_zero_e, va_all_zero_m, va_all_zero_g;
485
// write operation to queue tails 
486
wire qtail_write_m;
487
//
488
// data_access_exception for hyper-privileged scratch-pad
489
wire hscpd_data_acc_excpt_m;
490
wire hscpd_data_acc_excpt_pq_m;
491
// write to hypervisor scratch-pad using 0x20 ASI state
492
wire hscpd_priv_asi_acc_m;
493
// access hypervisor scratchpad va addresses
494
wire hscpd_va_rw_m;
495
//
496
// relevant portion of the va address for the scratch-pad 
497
// modified due to timing fix
498
// wire [`TLU_ASI_SCPD_VA_HI:0]       scpd_addr_va_e;
499 113 albert.wat
wire [`SCPD_ASI_VA_ADDR_WIDTH-1:0] scpd_addr_va_m;
500
wire [`SCPD_ASI_VA_ADDR_WIDTH-1:0] scpd_addr_va_g;
501 95 fafa1971
//
502
// load instruction data valid
503
wire asi_ld_addr_vld_m, asi_ld_addr_vld_g;
504
 
505
// privilege or hyper-privileged address indicators
506
wire asr_hyperp, asr_priv;
507
//
508
// local reset
509
wire local_rst_l;
510
wire local_rst;
511
// local clk
512
wire clk;
513
 
514
////////////////////////////////////////////////////////////////////////
515
// local reset
516
////////////////////////////////////////////////////////////////////////
517
 
518
dffrl_async dffrl_local_rst_l(
519
    .din  (grst_l),
520
    .clk  (clk),
521
    .rst_l(arst_l),
522
    .q    (local_rst_l),
523
    .se   (se),
524 113 albert.wat
    `SIMPLY_RISC_SCANIN,
525 95 fafa1971
    .so   ()
526
);
527
 
528
assign local_rst = ~local_rst_l;
529
 
530
////////////////////////////////////////////////////////////////////////
531
// local clock
532
////////////////////////////////////////////////////////////////////////
533
 
534
assign clk = rclk;
535
 
536
////////////////////////////////////////////////////////////////////////
537
// Hyper-lite mode indicator
538
////////////////////////////////////////////////////////////////////////
539
 
540
assign tlu_hyper_lite[0] =
541
           tlu_hpstate_priv[0]| (~tlu_hpstate_enb[0] & tlu_pstate_priv[0]);
542
assign tlu_hyper_lite[1] =
543
           tlu_hpstate_priv[1]| (~tlu_hpstate_enb[1] & tlu_pstate_priv[1]);
544
assign tlu_hyper_lite[2] =
545
           tlu_hpstate_priv[2]| (~tlu_hpstate_enb[2] & tlu_pstate_priv[2]);
546
assign tlu_hyper_lite[3] =
547
           tlu_hpstate_priv[3]| (~tlu_hpstate_enb[3] & tlu_pstate_priv[3]);
548
 
549
////////////////////////////////////////////////////////////////////////
550
// Thread ID staging and decoding 
551
////////////////////////////////////////////////////////////////////////
552
//
553
assign  thread_sel_id_e[0] = ~thrid_e[1] & ~thrid_e[0];
554
assign  thread_sel_id_e[1] = ~thrid_e[1] &  thrid_e[0];
555
assign  thread_sel_id_e[2] =  thrid_e[1] & ~thrid_e[0];
556
assign  thread_sel_id_e[3] =  thrid_e[1] &  thrid_e[0];
557
 
558 113 albert.wat
dff_s #(`TLU_THRD_NUM) dff_thread_sel_id_m (
559
    .din (thread_sel_id_e[`TLU_THRD_NUM-1:0]),
560
    .q   (thread_sel_id_m[`TLU_THRD_NUM-1:0]),
561 95 fafa1971
    .clk (clk),
562
    .se  (se),
563 113 albert.wat
    `SIMPLY_RISC_SCANIN,
564 95 fafa1971
    .so  ()
565
);
566
 
567 113 albert.wat
dff_s #(`TLU_THRD_NUM) dff_thread_id_sel_g (
568
    .din (thread_sel_id_m[`TLU_THRD_NUM-1:0]),
569
    .q   (thread_sel_id_g[`TLU_THRD_NUM-1:0]),
570 95 fafa1971
    .clk (clk),
571
    .se  (se),
572 113 albert.wat
    `SIMPLY_RISC_SCANIN,
573 95 fafa1971
    .so  ()
574
);
575
 
576 113 albert.wat
dff_s #(`TLU_THRD_NUM) dff_thread_id_sel_w2 (
577
    .din (thread_sel_id_g[`TLU_THRD_NUM-1:0]),
578
    .q   (thread_sel_id_w2[`TLU_THRD_NUM-1:0]),
579 95 fafa1971
    .clk (clk),
580
    .se  (se),
581 113 albert.wat
    `SIMPLY_RISC_SCANIN,
582 95 fafa1971
    .so  ()
583
);
584
 
585 113 albert.wat
dff_s #(2) dff_thrid_e (
586 95 fafa1971
    .din (ifu_tlu_thrid_d[1:0]),
587
    .q   (thrid_e[1:0]),
588
    .clk (clk),
589
    .se  (se),
590 113 albert.wat
    `SIMPLY_RISC_SCANIN,
591 95 fafa1971
    .so  ()
592
);
593
 
594 113 albert.wat
dff_s #(2) dff_thrid_m (
595 95 fafa1971
    .din (thrid_e[1:0]),
596
    .q   (thrid_m[1:0]),
597
    .clk (clk),
598
    .se  (se),
599 113 albert.wat
    `SIMPLY_RISC_SCANIN,
600 95 fafa1971
    .so  ()
601
);
602
 
603 113 albert.wat
dff_s #(2) dff_thrid_g (
604 95 fafa1971
    .din (thrid_m[1:0]),
605
    .q   (thrid_g[1:0]),
606
    .clk (clk),
607
    .se  (se),
608 113 albert.wat
    `SIMPLY_RISC_SCANIN,
609 95 fafa1971
    .so  ()
610
);
611
//
612
// modified due to rte failure
613
assign tlu_local_thrid_g[0] = ~(|thrid_g[1:0]);
614
assign tlu_local_thrid_g[1] = ~thrid_g[1] &  thrid_g[0];
615
assign tlu_local_thrid_g[2] =  thrid_g[1] & ~thrid_g[0];
616
assign tlu_local_thrid_g[3] =  (&thrid_g[1:0]);
617
 
618
/*
619
assign tlu_local_thrid_g[`TLU_THRD_NUM-1:0] =
620
           thread_sel_id_g[`TLU_THRD_NUM-1:0];
621
*/
622
 
623
////////////////////////////////////////////////////////////////////////
624
// POR indicator generation 
625
////////////////////////////////////////////////////////////////////////
626
//
627
// modified for bug 1945
628
/*
629
assign  por_rstint0_g = tlu_por_rstint_g & thread_sel_id_g[0];
630
assign  por_rstint1_g = tlu_por_rstint_g & thread_sel_id_g[1];
631
assign  por_rstint2_g = tlu_por_rstint_g & thread_sel_id_g[2];
632
assign  por_rstint3_g = tlu_por_rstint_g & thread_sel_id_g[3];
633
*/
634
assign  por_rstint0_g = tlu_por_rstint_g[0];
635
assign  por_rstint1_g = tlu_por_rstint_g[1];
636
assign  por_rstint2_g = tlu_por_rstint_g[2];
637
assign  por_rstint3_g = tlu_por_rstint_g[3];
638
 
639
////////////////////////////////////////////////////////////////////////
640
// Hyper-privileged ASR decodes 
641
////////////////////////////////////////////////////////////////////////
642
//
643
// flush signal - modified for timing
644
// assign  local_flush_all_w = tlu_nlsu_flush_w | lsu_tlu_early_flush_w;
645
assign  local_flush_all_w =
646
            tlu_local_flush_w | lsu_tlu_early_flush_w | ifu_tlu_flush_fd_w;
647
 
648 113 albert.wat
dffr_s dffr_local_flush_all_w2 (
649 95 fafa1971
    .din (local_flush_all_w),
650
    .q   (local_flush_all_w2),
651
    .rst (local_rst),
652
    .clk (clk),
653
    .se  (se),
654 113 albert.wat
    `SIMPLY_RISC_SCANIN,
655 95 fafa1971
    .so ()
656
);
657
 
658
// added for timing
659
assign tlu_lsu_int_ldxa_vld_w2 =
660
           tlu_asi_data_nf_vld_w2 & ~local_flush_all_w2;
661
 
662 113 albert.wat
assign  asr_hyperp = ifu_tlu_sraddr_d[`TLU_ASR_ADDR_WIDTH-1];
663
assign  asr_priv   = ifu_tlu_sraddr_d[`TLU_ASR_ADDR_WIDTH-2];
664 95 fafa1971
 
665 113 albert.wat
assign  sraddr[`TLU_ASR_ADDR_WIDTH-3:0]  =
666
            ifu_tlu_sraddr_d[`TLU_ASR_ADDR_WIDTH-3:0];
667 95 fafa1971
 
668
// hypervisor tick compare - 0x1f - hyper-priviledged
669
assign htickcmp_rw_d = sraddr[4] & sraddr[3] & sraddr[2] & sraddr[1] & sraddr[0] &
670
                                   asr_hyperp;
671
//
672
// hypervisor processor state - 0x00 - hyper-priviledged
673
assign hpstate_rw_d = ~sraddr[4] & ~sraddr[3] & ~sraddr[2] & ~sraddr[1] & ~sraddr[0] &
674
                                   asr_hyperp;
675
// 
676
// hypervisor trap state - 0x01 - hyper-priviledged
677
assign htstate_rw_d = ~sraddr[4] & ~sraddr[3] & ~sraddr[2] & ~sraddr[1] & sraddr[0] &
678
                                   asr_hyperp;
679
 
680
assign tlu_htstate_rw_d = htstate_rw_d;
681
// 
682
// hypervisor interrupt pending - 0x03 - hyper-priviledged
683
assign hintp_rw_d = ~sraddr[4] & ~sraddr[3] & ~sraddr[2] & sraddr[1] & sraddr[0] &
684
                                 asr_hyperp;
685
// 
686
// hypervisor trap base address - 0x05 - hyper-priviledged
687
assign htba_rw_d = ~sraddr[4] & ~sraddr[3] & sraddr[2] & ~sraddr[1] & sraddr[0] &
688
                               asr_hyperp;
689
 
690
// global register - 0x10 - privileged
691
assign gl_rw_d = sraddr[4] & ~sraddr[3] & ~sraddr[2] & ~sraddr[1] & ~sraddr[0] &
692
                             asr_priv;
693
//
694
// staging of the ASR decoded controls
695
// staging from d to e stage
696 113 albert.wat
dff_s dff_htba_rw_d_e (
697 95 fafa1971
    .din (htba_rw_d),
698
    .q   (htba_rw_e),
699
    .clk (clk),
700
    .se  (se),
701 113 albert.wat
    `SIMPLY_RISC_SCANIN,
702 95 fafa1971
    .so  ()
703
);
704
 
705 113 albert.wat
dff_s dff_hpstate_rw_d_e (
706 95 fafa1971
    .din (hpstate_rw_d),
707
    .q   (hpstate_rw_e),
708
    .clk (clk),
709
    .se  (se),
710 113 albert.wat
    `SIMPLY_RISC_SCANIN,
711 95 fafa1971
    .so  ()
712
);
713
 
714 113 albert.wat
dff_s dff_htstate_rw_d_e (
715 95 fafa1971
    .din (htstate_rw_d),
716
    .q   (htstate_rw_e),
717
    .clk (clk),
718
    .se  (se),
719 113 albert.wat
    `SIMPLY_RISC_SCANIN,
720 95 fafa1971
    .so  ()
721
);
722
 
723 113 albert.wat
dff_s dff_hintp_rw_e (
724 95 fafa1971
    .din (hintp_rw_d),
725
    .q   (hintp_rw_e),
726
    .clk (clk),
727
    .se  (se),
728 113 albert.wat
    `SIMPLY_RISC_SCANIN,
729 95 fafa1971
    .so  ()
730
);
731
 
732 113 albert.wat
dff_s dff_htickcmp_rw_d_e (
733 95 fafa1971
    .din (htickcmp_rw_d),
734
    .q   (htickcmp_rw_e),
735
    .clk (clk),
736
    .se  (se),
737 113 albert.wat
    `SIMPLY_RISC_SCANIN,
738 95 fafa1971
    .so  ()
739
);
740
 
741 113 albert.wat
dff_s dff_gl_rw_d_e (
742 95 fafa1971
    .din (gl_rw_d),
743
    .q   (gl_rw_e),
744
    .clk (clk),
745
    .se  (se),
746 113 albert.wat
    `SIMPLY_RISC_SCANIN,
747 95 fafa1971
    .so  ()
748
);
749
 
750
// staging from e to m stage
751 113 albert.wat
dff_s dff_htba_rw_m_m (
752 95 fafa1971
    .din (htba_rw_e),
753
    .q   (htba_rw_m),
754
    .clk (clk),
755
    .se  (se),
756 113 albert.wat
    `SIMPLY_RISC_SCANIN,
757 95 fafa1971
    .so  ()
758
);
759
 
760 113 albert.wat
dff_s dff_hpstate_rw_m_m (
761 95 fafa1971
    .din (hpstate_rw_e),
762
    .q   (hpstate_rw_m),
763
    .clk (clk),
764
    .se  (se),
765 113 albert.wat
    `SIMPLY_RISC_SCANIN,
766 95 fafa1971
    .so  ()
767
);
768
 
769 113 albert.wat
dff_s dff_htstate_rw_m_m (
770 95 fafa1971
    .din (htstate_rw_e),
771
    .q   (htstate_rw_m),
772
    .clk (clk),
773
    .se  (se),
774 113 albert.wat
    `SIMPLY_RISC_SCANIN,
775 95 fafa1971
    .so  ()
776
);
777
 
778 113 albert.wat
dff_s dff_hintp_rw_m_m (
779 95 fafa1971
    .din (hintp_rw_e),
780
    .q   (hintp_rw_m),
781
    .clk (clk),
782
    .se  (se),
783 113 albert.wat
    `SIMPLY_RISC_SCANIN,
784 95 fafa1971
    .so  ()
785
);
786
 
787 113 albert.wat
dff_s dff_htickcmp_rw_m_m (
788 95 fafa1971
    .din (htickcmp_rw_e),
789
    .q   (htickcmp_rw_m),
790
    .clk (clk),
791
    .se  (se),
792 113 albert.wat
    `SIMPLY_RISC_SCANIN,
793 95 fafa1971
    .so  ()
794
);
795
 
796 113 albert.wat
dff_s dff_gl_rw_m_m (
797 95 fafa1971
    .din (gl_rw_e),
798
    .q   (gl_rw_m),
799
    .clk (clk),
800
    .se  (se),
801 113 albert.wat
    `SIMPLY_RISC_SCANIN,
802 95 fafa1971
    .so  ()
803
);
804
 
805
// staging from e to g stage
806 113 albert.wat
dff_s dff_gl_rw_m_g (
807 95 fafa1971
    .din (gl_rw_m),
808
    .q   (gl_rw_g),
809
    .clk (clk),
810
    .se  (se),
811 113 albert.wat
    `SIMPLY_RISC_SCANIN,
812 95 fafa1971
    .so  ()
813
);
814
 
815 113 albert.wat
dff_s dff_hpstate_rw_m_g (
816 95 fafa1971
    .din (hpstate_rw_m),
817
    .q   (hpstate_rw_g),
818
    .clk (clk),
819
    .se  (se),
820 113 albert.wat
    `SIMPLY_RISC_SCANIN,
821 95 fafa1971
    .so  ()
822
);
823
 
824 113 albert.wat
dff_s dff_htickcmp_rw_m_g (
825 95 fafa1971
    .din (htickcmp_rw_m),
826
    .q   (htickcmp_rw_g),
827
    .clk (clk),
828
    .se  (se),
829 113 albert.wat
    `SIMPLY_RISC_SCANIN,
830 95 fafa1971
    .so  ()
831
);
832
 
833 113 albert.wat
dff_s dff_htba_rw_m_g (
834 95 fafa1971
    .din (htba_rw_m),
835
    .q   (htba_rw_g),
836
    .clk (clk),
837
    .se  (se),
838 113 albert.wat
    `SIMPLY_RISC_SCANIN,
839 95 fafa1971
    .so  ()
840
);
841
 
842 113 albert.wat
dff_s dff_hintp_rw_g (
843 95 fafa1971
    .din (hintp_rw_m),
844
    .q   (hintp_rw_g),
845
    .clk (clk),
846
    .se  (se),
847 113 albert.wat
    `SIMPLY_RISC_SCANIN,
848 95 fafa1971
    .so  ()
849
);
850
 
851 113 albert.wat
dff_s dff_htstate_rw_m_g (
852 95 fafa1971
    .din (htstate_rw_m),
853
    .q   (htstate_rw_g),
854
    .clk (clk),
855
    .se  (se),
856 113 albert.wat
    `SIMPLY_RISC_SCANIN,
857 95 fafa1971
    .so  ()
858
);
859
//
860
// stage to w2
861 113 albert.wat
dff_s dff_hpstate_rw_m_w2 (
862 95 fafa1971
    .din (hpstate_rw_g),
863
    .q   (hpstate_rw_w2),
864
    .clk (clk),
865
    .se  (se),
866 113 albert.wat
    `SIMPLY_RISC_SCANIN,
867 95 fafa1971
    .so  ()
868
);
869
 
870
// constructing the mux select to access the 
871
// hyper-privileged ASR registers
872
//
873
assign tlu_htickcmp_rw_e = htickcmp_rw_e;
874
assign tlu_htstate_rw_g = htstate_rw_g;
875
// 
876
// using htba_rw_e as one of the selects for rdpr read in tlu_tdp
877
// assign tlu_htba_rsr_sel = htba_rw_e;
878
//
879
// construciton mux selects for tlu_rdpr_mx5 in tlu_tdp to read out
880
// the ASR information
881
//
882
assign  tlu_hyperv_rdpr_sel[0] = gl_rw_e;
883
assign  tlu_hyperv_rdpr_sel[1] = hintp_rw_e;
884
assign  tlu_hyperv_rdpr_sel[2] = hpstate_rw_e;
885
assign  tlu_hyperv_rdpr_sel[3] = htstate_rw_e;
886
assign  tlu_hyperv_rdpr_sel[4] = htba_rw_e;
887
// assign  tlu_rdpr_mx5_active = |(tlu_rdpr_mx5_sel[3:0]);
888
//
889
// buffer gl_rw_g for agp_tid_sel in tlu_tcl
890
// modified for timing 
891
// assign tlu_gl_rw_g = gl_rw_g;
892
assign tlu_gl_rw_m = gl_rw_m;
893
 
894
////////////////////////////////////////////////////////////////////////
895
// GL register controls 
896
////////////////////////////////////////////////////////////////////////
897
 
898 113 albert.wat
dffr_s #(`TLU_THRD_NUM)  dffr_gl_update_sel_w2 (
899
    .din (gl_update_sel_g[`TLU_THRD_NUM-1:0]),
900
    .q   (gl_update_sel_w2[`TLU_THRD_NUM-1:0]),
901 95 fafa1971
    .rst (local_rst),
902
    .clk (clk),
903
    .se  (se),
904 113 albert.wat
    `SIMPLY_RISC_SCANIN,
905 95 fafa1971
    .so ()
906
);
907
 
908 113 albert.wat
dffr_s #(`TLU_THRD_NUM) dffr_dnrtry_inst_w2 (
909 95 fafa1971
    .din ({tlu_dnrtry3_inst_g, tlu_dnrtry2_inst_g,
910
           tlu_dnrtry1_inst_g,tlu_dnrtry0_inst_g}),
911 113 albert.wat
    .q   (dnrtry_inst_w2[`TLU_THRD_NUM-1:0]),
912 95 fafa1971
    .rst (local_rst),
913
    .clk (clk),
914
    .se  (se),
915 113 albert.wat
    `SIMPLY_RISC_SCANIN,
916 95 fafa1971
    .so ()
917
);
918
//
919
// added for timing 
920
assign wsr_inst_g = tlu_wsr_inst_nq_g & ~ifu_tlu_flush_fd_w;
921
 
922 113 albert.wat
dffr_s dffr_wsr_inst_w2 (
923 95 fafa1971
    .din (wsr_inst_g),
924
    .q   (wsr_inst_w2),
925
    .rst (local_rst),
926
    .clk (clk),
927
    .se  (se),
928 113 albert.wat
    `SIMPLY_RISC_SCANIN,
929 95 fafa1971
    .so ()
930
);
931
 
932
// THREAD0
933
 
934 113 albert.wat
assign gl_lvl0_at_maxgl  = (gl_lvl0[`TSA_GLOBAL_WIDTH-1:0] == `MAXGL_GL);
935
assign gl_lvl0_at_maxstl = (gl_lvl0[`TSA_GLOBAL_WIDTH-1:0] == `MAXSTL_GL);
936 95 fafa1971
// 
937
// generate the control to prevent writing beyond maxstl or maxgl
938
 
939
assign maxstl_gl_wr_sel[0] =
940
           ~tlu_hyper_lite[0] &
941 113 albert.wat
           (tlu_wsr_data_w_global[`TLU_GLOBAL_WIDTH-1:0] > {1'b0,`MAXSTL});
942 95 fafa1971
assign maxstl_gl_wr_sel[1] =
943
           ~tlu_hyper_lite[1] &
944 113 albert.wat
           (tlu_wsr_data_w_global[`TLU_GLOBAL_WIDTH-1:0] > {1'b0,`MAXSTL});
945 95 fafa1971
assign maxstl_gl_wr_sel[2] =
946
           ~tlu_hyper_lite[2] &
947 113 albert.wat
           (tlu_wsr_data_w_global[`TLU_GLOBAL_WIDTH-1:0] > {1'b0,`MAXSTL});
948 95 fafa1971
assign maxstl_gl_wr_sel[3] =
949
           ~tlu_hyper_lite[3] &
950 113 albert.wat
           (tlu_wsr_data_w_global[`TLU_GLOBAL_WIDTH-1:0] > {1'b0,`MAXSTL});
951 95 fafa1971
//
952
// added for bug 79252 
953
assign maxstl_gl_dnrtry_sel[0] =
954
           ~tlu_hyper_lite[0] &
955 113 albert.wat
           (&tlu_dnrtry_global_g[`TSA_GLOBAL_WIDTH-1:0]);
956 95 fafa1971
assign maxstl_gl_dnrtry_sel[1] =
957
           ~tlu_hyper_lite[1] &
958 113 albert.wat
           (&tlu_dnrtry_global_g[`TSA_GLOBAL_WIDTH-1:0]);
959 95 fafa1971
assign maxstl_gl_dnrtry_sel[2] =
960
           ~tlu_hyper_lite[2] &
961 113 albert.wat
           (&tlu_dnrtry_global_g[`TSA_GLOBAL_WIDTH-1:0]);
962 95 fafa1971
assign maxstl_gl_dnrtry_sel[3] =
963
           ~tlu_hyper_lite[3] &
964 113 albert.wat
           (&tlu_dnrtry_global_g[`TSA_GLOBAL_WIDTH-1:0]);
965 95 fafa1971
//
966
// added for bug 79252
967 113 albert.wat
assign dnrtry_gl_lvl0_data[`TSA_GLOBAL_WIDTH-1:0] =
968
            (maxstl_gl_dnrtry_sel[0])? `MAXSTL_GL:
969
            tlu_dnrtry_global_g[`TSA_GLOBAL_WIDTH-1:0];
970
assign dnrtry_gl_lvl1_data[`TSA_GLOBAL_WIDTH-1:0] =
971
            (maxstl_gl_dnrtry_sel[1])? `MAXSTL_GL:
972
            tlu_dnrtry_global_g[`TSA_GLOBAL_WIDTH-1:0];
973
assign dnrtry_gl_lvl2_data[`TSA_GLOBAL_WIDTH-1:0] =
974
            (maxstl_gl_dnrtry_sel[2])? `MAXSTL_GL:
975
            tlu_dnrtry_global_g[`TSA_GLOBAL_WIDTH-1:0];
976
assign dnrtry_gl_lvl3_data[`TSA_GLOBAL_WIDTH-1:0] =
977
            (maxstl_gl_dnrtry_sel[3])? `MAXSTL_GL:
978
            tlu_dnrtry_global_g[`TSA_GLOBAL_WIDTH-1:0];
979 95 fafa1971
 
980
// 
981
// maxgl cap
982
assign maxgl_gl_wr_sel[0] =
983
           tlu_hyper_lite[0] &
984 113 albert.wat
           (tlu_wsr_data_w_global[`TLU_GLOBAL_WIDTH-1:0] > `MAXGL);
985 95 fafa1971
assign maxgl_gl_wr_sel[1] =
986
           tlu_hyper_lite[1] &
987 113 albert.wat
           (tlu_wsr_data_w_global[`TLU_GLOBAL_WIDTH-1:0] > `MAXGL);
988 95 fafa1971
assign maxgl_gl_wr_sel[2] =
989
           tlu_hyper_lite[2] &
990 113 albert.wat
           (tlu_wsr_data_w_global[`TLU_GLOBAL_WIDTH-1:0] > `MAXGL);
991 95 fafa1971
assign maxgl_gl_wr_sel[3] =
992
           tlu_hyper_lite[3] &
993 113 albert.wat
           (tlu_wsr_data_w_global[`TLU_GLOBAL_WIDTH-1:0] > `MAXGL);
994 95 fafa1971
//
995
// trap level to be incremented if thread not at MAXGL and not in redmode
996
// modified for bug 2889
997
// modified due to timing
998
/*
999
assign gl0_incr_sel =
1000
           tlu_thrd0_traps & (~(gl_lvl0_at_maxgl | tlu_select_tba_g) |
1001
           (~gl_lvl0_at_maxstl & tlu_select_tba_g));
1002
 
1003
assign gl_lvl0_incr[1:0] = {1'b0, gl0_incr_sel};
1004
 
1005
assign gl0_en = (gl_rw_g & wsr_inst_g & thread_sel_id_g[0]) |
1006
                             gl0_incr_sel | local_rst | por_rstint0_g   |
1007
                 tlu_dnrtry0_inst_g;
1008
 
1009
assign gl_lvl0_new[`TSA_GLOBAL_WIDTH-1:0] =
1010
                (gl_rw_g & wsr_inst_g & thread_sel_id_g[0]) ?
1011
                         wsr_gl_lvl0_data[`TSA_GLOBAL_WIDTH-1:0] :
1012
               ((local_rst | por_rstint0_g) ? `MAXGL_GL :
1013
                   ((tlu_dnrtry0_inst_g) ?
1014
                         tlu_dnrtry_global_g[`TSA_GLOBAL_WIDTH-1:0] :     // done/retry restore
1015
                         gl_lvl0[`TSA_GLOBAL_WIDTH-1:0] + gl_lvl0_incr[1:0])); // trap increments
1016
*/
1017
// modified for bug 79252 
1018 113 albert.wat
assign wsr_gl_lvl0_data[`TSA_GLOBAL_WIDTH-1:0] =
1019
            (maxstl_gl_wr_sel[0])? `MAXSTL_GL:
1020
           ((maxgl_gl_wr_sel[0]) ? `MAXGL_GL :
1021
            tlu_wsr_data_w_global[`TSA_GLOBAL_WIDTH-1:0]);
1022
assign gl_lvl0_update_g[`TSA_GLOBAL_WIDTH-1:0] =
1023 95 fafa1971
                (gl_rw_g & wsr_inst_g & thread_sel_id_g[0]) ?
1024 113 albert.wat
                         wsr_gl_lvl0_data[`TSA_GLOBAL_WIDTH-1:0] :
1025
               ((local_rst | por_rstint0_g) ? `MAXGL_GL :
1026
                         dnrtry_gl_lvl0_data[`TSA_GLOBAL_WIDTH-1:0]);     // done/retry restore
1027 95 fafa1971
                         // tlu_dnrtry_global_g[`TSA_GLOBAL_WIDTH-1:0]);     // done/retry restore
1028
 
1029 113 albert.wat
dffe_s #(`TSA_GLOBAL_WIDTH) dffe_gl_lvl0_update_w2 (
1030
     .din (gl_lvl0_update_g[`TSA_GLOBAL_WIDTH-1:0]),
1031
     .q   (gl_lvl0_update_w2[`TSA_GLOBAL_WIDTH-1:0]),
1032 95 fafa1971
     .en  (gl_update_sel_g[0]),
1033
     .clk (clk),
1034
     .se  (se),
1035 113 albert.wat
     `SIMPLY_RISC_SCANIN,
1036 95 fafa1971
     .so  ()
1037
);
1038
//
1039
// modified for bug3468 and bug3505
1040
assign gl_incr_sel_w2[0] =
1041
            tlu_thrd_traps_w2[0] & ~(gl_lvl0_at_maxgl |
1042
           (gl_lvl0_at_maxstl & tlu_select_tba_w2));
1043
//            tlu_thrd_traps_w2[0] & (~(gl_lvl0_at_maxgl | tlu_select_tba_w2) |  
1044
assign gl_update_sel_g[0] =
1045
           (gl_rw_g & wsr_inst_g & thread_sel_id_g[0]) |
1046
                        local_rst |     por_rstint0_g | tlu_dnrtry0_inst_g;
1047
//
1048
// modified for bug3468
1049
assign gl_priv_max_sel_w2[0] =
1050
           (gl_lvl0_at_maxgl & tlu_select_tba_w2) & tlu_thrd_traps_w2[0];
1051
assign gl0_en =
1052
           gl_incr_sel_w2[0] | gl_update_sel_w2[0] | gl_priv_max_sel_w2[0];
1053
// assign gl0_en = gl_incr_sel_w2[0] | gl_update_sel_w2[0]; 
1054
 
1055 113 albert.wat
assign gl_lvl0_new[`TSA_GLOBAL_WIDTH-1:0] =
1056 95 fafa1971
           (gl_update_sel_w2[0]) ? gl_lvl0_update_w2:
1057
           (~gl_update_sel_w2[0] & gl_priv_max_sel_w2[0]) ?
1058 113 albert.wat
            `MAXSTL_GL:
1059
            gl_lvl0[`TSA_GLOBAL_WIDTH-1:0] + 2'b01;
1060 95 fafa1971
 
1061
// Reset required as processor will start out at gl=1 after reset.
1062
/****************************
1063
   to fix bug 6028 manually in the gate netlist, the following needs
1064
   to be a mux_flop with recirculating path from q to d0 input. But
1065
   to make it resetable, need to brake this recirculating path and
1066
   insert an AND gate such that local_rst_l is ANDed with the q output.
1067
 
1068 113 albert.wat
dffe_s #(`TSA_GLOBAL_WIDTH) dffe_gl0 (
1069 95 fafa1971
     .din (gl_lvl0_new[`TSA_GLOBAL_WIDTH-1:0]),
1070
     .q   (gl_lvl0[`TSA_GLOBAL_WIDTH-1:0]),
1071
     .en  (gl0_en),
1072
     .clk (clk),
1073
     .se  (se),
1074 113 albert.wat
     `SIMPLY_RISC_SCANIN,
1075 95 fafa1971
     .so  ()
1076
);
1077
******************************/
1078
 
1079
wire [1:0] gl_lvl0_or_rst, gl_lvl0_or_rst_or_new;
1080
 
1081
assign gl_lvl0_or_rst[1:0] = gl_lvl0[1:0] & {2{~local_rst}};
1082
 
1083
assign gl_lvl0_or_rst_or_new[1:0] = (gl0_en&~local_rst) ? gl_lvl0_new[1:0] : gl_lvl0_or_rst[1:0];
1084
 
1085 113 albert.wat
dff_s    #(2) dffe_gl0 (
1086 95 fafa1971
        .din(gl_lvl0_or_rst_or_new[1:0]) ,
1087
        .q(gl_lvl0[1:0]),
1088 113 albert.wat
        .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1089 95 fafa1971
 
1090
/******************************/
1091
 
1092
 
1093 113 albert.wat
assign tlu_gl_lvl0[`TSA_GLOBAL_WIDTH-1:0] = gl_lvl0[`TSA_GLOBAL_WIDTH-1:0];
1094 95 fafa1971
 
1095 113 albert.wat
`ifdef FPGA_SYN_1THREAD
1096
`else
1097 95 fafa1971
 
1098
// THREAD1
1099
 
1100 113 albert.wat
assign gl_lvl1_at_maxgl  = (gl_lvl1[`TSA_GLOBAL_WIDTH-1:0] == `MAXGL_GL);
1101
assign gl_lvl1_at_maxstl = (gl_lvl1[`TSA_GLOBAL_WIDTH-1:0] == `MAXSTL_GL);
1102 95 fafa1971
//
1103
// trap level to be incremented if thread not at MAXGL and not in redmode
1104
// modified for bug 2889
1105
// modified due to timing 
1106
/*
1107
assign gl1_incr_sel =
1108
           tlu_thrd1_traps & (~(gl_lvl1_at_maxgl | tlu_select_tba_g) |
1109
           (~gl_lvl1_at_maxstl & tlu_select_tba_g));
1110
 
1111
assign gl_lvl1_incr[1:0] = {1'b0, gl1_incr_sel};
1112
 
1113
assign gl1_en = (gl_rw_g & wsr_inst_g & thread_sel_id_g[1]) |
1114
                             gl1_incr_sel | local_rst | por_rstint1_g   |
1115
                 tlu_dnrtry1_inst_g;
1116
 
1117
assign gl_lvl1_new[`TSA_GLOBAL_WIDTH-1:0] =
1118
                (gl_rw_g & wsr_inst_g & thread_sel_id_g[1])?
1119
                         wsr_gl_lvl1_data[`TSA_GLOBAL_WIDTH-1:0] :
1120
                   ((local_rst | por_rstint1_g) ? `MAXGL_GL :
1121
                   ((tlu_dnrtry1_inst_g) ?
1122
                         dnrtry_gl_lvl1_data[`TSA_GLOBAL_WIDTH-1:0] :     // done/retry restore
1123
                         // tlu_dnrtry_global_g[`TSA_GLOBAL_WIDTH-1:0] :     // done/retry restore
1124
                         gl_lvl1[`TSA_GLOBAL_WIDTH-1:0] + gl_lvl1_incr[1:0])); // trap increments
1125
 
1126
*/
1127 113 albert.wat
assign wsr_gl_lvl1_data[`TSA_GLOBAL_WIDTH-1:0] =
1128
            (maxstl_gl_wr_sel[1])? `MAXSTL_GL:
1129
           ((maxgl_gl_wr_sel[1]) ? `MAXGL_GL :
1130
            tlu_wsr_data_w_global[`TSA_GLOBAL_WIDTH-1:0]);
1131
assign gl_lvl1_update_g[`TSA_GLOBAL_WIDTH-1:0] =
1132 95 fafa1971
                (gl_rw_g & wsr_inst_g & thread_sel_id_g[1]) ?
1133 113 albert.wat
                         wsr_gl_lvl1_data[`TSA_GLOBAL_WIDTH-1:0] :
1134
               ((local_rst | por_rstint1_g) ? `MAXGL_GL :
1135
                         dnrtry_gl_lvl1_data[`TSA_GLOBAL_WIDTH-1:0]);     // done/retry restore
1136 95 fafa1971
                         // tlu_dnrtry_global_g[`TSA_GLOBAL_WIDTH-1:0]);     // done/retry restore
1137
 
1138 113 albert.wat
dffe_s #(`TSA_GLOBAL_WIDTH) dffe_gl_lvl1_update_w2 (
1139
     .din (gl_lvl1_update_g[`TSA_GLOBAL_WIDTH-1:0]),
1140
     .q   (gl_lvl1_update_w2[`TSA_GLOBAL_WIDTH-1:0]),
1141 95 fafa1971
     .en  (gl_update_sel_g[1]),
1142
     .clk (clk),
1143
     .se  (se),
1144 113 albert.wat
     `SIMPLY_RISC_SCANIN,
1145 95 fafa1971
     .so  ()
1146
);
1147
//
1148
// modified for bug3468 and bug3505
1149
assign gl_incr_sel_w2[1] =
1150
            tlu_thrd_traps_w2[1] & ~(gl_lvl1_at_maxgl |
1151
           (gl_lvl1_at_maxstl & tlu_select_tba_w2));
1152
//            tlu_thrd_traps_w2[1] & (~(gl_lvl1_at_maxgl | tlu_select_tba_w2) |  
1153
assign gl_update_sel_g[1] =
1154
           (gl_rw_g & wsr_inst_g & thread_sel_id_g[1]) |
1155
                        local_rst |     por_rstint1_g | tlu_dnrtry1_inst_g;
1156
//
1157
// modified for bug3468
1158
assign gl_priv_max_sel_w2[1] =
1159
           (gl_lvl1_at_maxgl & tlu_select_tba_w2) & tlu_thrd_traps_w2[1];
1160
// 
1161
assign gl1_en =
1162
           gl_incr_sel_w2[1] | gl_update_sel_w2[1] | gl_priv_max_sel_w2[1];
1163
// assign gl1_en = gl_incr_sel_w2[1] | gl_update_sel_w2[1]; 
1164
 
1165 113 albert.wat
assign gl_lvl1_new[`TSA_GLOBAL_WIDTH-1:0] =
1166 95 fafa1971
           (gl_update_sel_w2[1]) ? gl_lvl1_update_w2:
1167
           (~gl_update_sel_w2[1] & gl_priv_max_sel_w2[1]) ?
1168 113 albert.wat
            `MAXSTL_GL:
1169
            gl_lvl1[`TSA_GLOBAL_WIDTH-1:0] + 2'b01;
1170 95 fafa1971
 
1171
// Reset required as processor will start out at gl=1 after reset.
1172
/****************************
1173
   to fix bug 6028 manually in the gate netlist, the following needs
1174
   to be a mux_flop with recirculating path from q to d0 input. But
1175
   to make it resetable, need to brake this recirculating path and
1176
   insert an AND gate such that local_rst_l is ANDed with the q output.
1177 113 albert.wat
dffe_s #(`TSA_GLOBAL_WIDTH) dffe_gl1 (
1178 95 fafa1971
     .din (gl_lvl1_new[`TSA_GLOBAL_WIDTH-1:0]),
1179
     .q   (gl_lvl1[`TSA_GLOBAL_WIDTH-1:0]),
1180
     .en  (gl1_en),
1181
     .clk (clk),
1182
     .se  (se),
1183 113 albert.wat
     `SIMPLY_RISC_SCANIN,
1184 95 fafa1971
     .so  ()
1185
);
1186
******************************/
1187
 
1188
wire [1:0] gl_lvl1_or_rst, gl_lvl1_or_rst_or_new;
1189
 
1190
assign gl_lvl1_or_rst[1:0] = gl_lvl1[1:0] & {2{~local_rst}};
1191
 
1192
assign gl_lvl1_or_rst_or_new[1:0] = (gl1_en&~local_rst) ? gl_lvl1_new[1:0] : gl_lvl1_or_rst[1:0];
1193
 
1194 113 albert.wat
dff_s    #(2) dffe_gl1 (
1195 95 fafa1971
        .din(gl_lvl1_or_rst_or_new[1:0]) ,
1196
        .q(gl_lvl1[1:0]),
1197 113 albert.wat
        .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1198 95 fafa1971
 
1199
/******************************/
1200
 
1201
 
1202 113 albert.wat
assign tlu_gl_lvl1[`TSA_GLOBAL_WIDTH-1:0] = gl_lvl1[`TSA_GLOBAL_WIDTH-1:0];
1203 95 fafa1971
 
1204
// THREAD2
1205
 
1206 113 albert.wat
assign gl_lvl2_at_maxgl  = (gl_lvl2[`TSA_GLOBAL_WIDTH-1:0] == `MAXGL_GL);
1207
assign gl_lvl2_at_maxstl = (gl_lvl2[`TSA_GLOBAL_WIDTH-1:0] == `MAXSTL_GL);
1208 95 fafa1971
//
1209
// trap level to be incremented if thread not at MAXGL and not in redmode
1210
// modified for bug 2889
1211
// modified due to timing
1212
/*
1213
assign gl2_incr_sel =
1214
           tlu_thrd2_traps & (~(gl_lvl2_at_maxgl | tlu_select_tba_g) |
1215
           (~gl_lvl2_at_maxstl & tlu_select_tba_g));
1216
 
1217
assign gl_lvl2_incr[1:0] = {1'b0, gl2_incr_sel};
1218
 
1219
assign gl2_en = (gl_rw_g & wsr_inst_g & thread_sel_id_g[2]) |
1220
                             gl2_incr_sel | local_rst | por_rstint2_g   |
1221
                 tlu_dnrtry2_inst_g;
1222
 
1223
assign gl_lvl2_new[`TSA_GLOBAL_WIDTH-1:0] =
1224
                (gl_rw_g & wsr_inst_g & thread_sel_id_g[2])?
1225
                         wsr_gl_lvl2_data[`TSA_GLOBAL_WIDTH-1:0] :
1226
                   ((local_rst | por_rstint2_g) ? `MAXGL_GL :
1227
                   ((tlu_dnrtry2_inst_g) ?
1228
                         tlu_dnrtry_global_g[`TSA_GLOBAL_WIDTH-1:0] :     // done/retry restore
1229
                         gl_lvl2[`TSA_GLOBAL_WIDTH-1:0] + gl_lvl2_incr[1:0])); // trap increments
1230
*/
1231 113 albert.wat
assign wsr_gl_lvl2_data[`TSA_GLOBAL_WIDTH-1:0] =
1232
            (maxstl_gl_wr_sel[2])? `MAXSTL_GL:
1233
           ((maxgl_gl_wr_sel[2]) ? `MAXGL_GL :
1234
            tlu_wsr_data_w_global[`TSA_GLOBAL_WIDTH-1:0]);
1235
assign gl_lvl2_update_g[`TSA_GLOBAL_WIDTH-1:0] =
1236 95 fafa1971
                (gl_rw_g & wsr_inst_g & thread_sel_id_g[2]) ?
1237 113 albert.wat
                         wsr_gl_lvl2_data[`TSA_GLOBAL_WIDTH-1:0] :
1238
               ((local_rst | por_rstint2_g) ? `MAXGL_GL :
1239
                         dnrtry_gl_lvl2_data[`TSA_GLOBAL_WIDTH-1:0]);     // done/retry restore
1240 95 fafa1971
                         // tlu_dnrtry_global_g[`TSA_GLOBAL_WIDTH-1:0]);     // done/retry restore
1241
 
1242 113 albert.wat
dffe_s #(`TSA_GLOBAL_WIDTH) dffe_gl_lvl2_update_w2 (
1243
     .din (gl_lvl2_update_g[`TSA_GLOBAL_WIDTH-1:0]),
1244
     .q   (gl_lvl2_update_w2[`TSA_GLOBAL_WIDTH-1:0]),
1245 95 fafa1971
     .en  (gl_update_sel_g[2]),
1246
     .clk (clk),
1247
     .se  (se),
1248 113 albert.wat
     `SIMPLY_RISC_SCANIN,
1249 95 fafa1971
     .so  ()
1250
);
1251
//
1252
// modified for bug3468 and bug3505
1253
assign gl_incr_sel_w2[2] =
1254
           tlu_thrd_traps_w2[2] & ~(gl_lvl2_at_maxgl |
1255
           (gl_lvl2_at_maxstl & tlu_select_tba_w2));
1256
//            tlu_thrd_traps_w2[2] & (~(gl_lvl2_at_maxgl | tlu_select_tba_w2) |  
1257
assign gl_update_sel_g[2] =
1258
           (gl_rw_g & wsr_inst_g & thread_sel_id_g[2]) |
1259
                        local_rst |     por_rstint2_g | tlu_dnrtry2_inst_g;
1260
// 
1261
// modified for bug3468
1262
assign gl_priv_max_sel_w2[2] =
1263
           (gl_lvl2_at_maxgl & tlu_select_tba_w2) & tlu_thrd_traps_w2[2];
1264
//
1265
assign gl2_en =
1266
           gl_incr_sel_w2[2] | gl_update_sel_w2[2] | gl_priv_max_sel_w2[2];
1267
// assign gl2_en = gl_incr_sel_w2[2] | gl_update_sel_w2[2]; 
1268
 
1269 113 albert.wat
assign gl_lvl2_new[`TSA_GLOBAL_WIDTH-1:0] =
1270 95 fafa1971
           (gl_update_sel_w2[2]) ? gl_lvl2_update_w2:
1271
           (~gl_update_sel_w2[2] & gl_priv_max_sel_w2[2]) ?
1272 113 albert.wat
            `MAXSTL_GL:
1273
            gl_lvl2[`TSA_GLOBAL_WIDTH-1:0] + 2'b01;
1274 95 fafa1971
 
1275
// Reset required as processor will start out at gl=1 after reset.
1276
/****************************
1277
   to fix bug 6028 manually in the gate netlist, the following needs
1278
   to be a mux_flop with recirculating path from q to d0 input. But
1279
   to make it resetable, need to brake this recirculating path and
1280
   insert an AND gate such that local_rst_l is ANDed with the q output.
1281 113 albert.wat
dffe_s #(`TSA_GLOBAL_WIDTH) dffe_gl2 (
1282 95 fafa1971
     .din (gl_lvl2_new[`TSA_GLOBAL_WIDTH-1:0]),
1283
     .q   (gl_lvl2[`TSA_GLOBAL_WIDTH-1:0]),
1284
     .en  (gl2_en),
1285
     .clk (clk),
1286
     .se  (se),
1287 113 albert.wat
     `SIMPLY_RISC_SCANIN,
1288 95 fafa1971
     .so  ()
1289
);
1290
******************************/
1291
 
1292
wire [1:0] gl_lvl2_or_rst, gl_lvl2_or_rst_or_new;
1293
 
1294
assign gl_lvl2_or_rst[1:0] = gl_lvl2[1:0] & {2{~local_rst}};
1295
 
1296
assign gl_lvl2_or_rst_or_new[1:0] = (gl2_en&~local_rst) ? gl_lvl2_new[1:0] : gl_lvl2_or_rst[1:0];
1297
 
1298 113 albert.wat
dff_s    #(2) dffe_gl2 (
1299 95 fafa1971
        .din(gl_lvl2_or_rst_or_new[1:0]) ,
1300
        .q(gl_lvl2[1:0]),
1301 113 albert.wat
        .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1302 95 fafa1971
 
1303
/******************************/
1304
 
1305 113 albert.wat
assign tlu_gl_lvl2[`TSA_GLOBAL_WIDTH-1:0] = gl_lvl2[`TSA_GLOBAL_WIDTH-1:0];
1306 95 fafa1971
 
1307
// THREAD3
1308
 
1309 113 albert.wat
assign gl_lvl3_at_maxgl  = (gl_lvl3[`TSA_GLOBAL_WIDTH-1:0] == `MAXGL_GL);
1310
assign gl_lvl3_at_maxstl = (gl_lvl3[`TSA_GLOBAL_WIDTH-1:0] == `MAXSTL_GL);
1311 95 fafa1971
//
1312
// trap level to be incremented if thread not at MAXGL and not in redmode
1313
// modified for bug 2889
1314
// modified due to timing
1315
/*
1316
assign gl3_incr_sel =
1317
           tlu_thrd3_traps & (~(gl_lvl3_at_maxgl | tlu_select_tba_g) |
1318
           (~gl_lvl3_at_maxstl & tlu_select_tba_g));
1319
 
1320
assign gl_lvl3_incr = {1'b0, gl3_incr_sel};
1321
 
1322
assign gl3_en = (gl_rw_g & wsr_inst_g & thread_sel_id_g[3]) |
1323
                             gl3_incr_sel | local_rst | por_rstint3_g   |
1324
                 tlu_dnrtry3_inst_g;
1325
 
1326
assign gl_lvl3_new[`TSA_GLOBAL_WIDTH-1:0] =
1327
                (gl_rw_g & wsr_inst_g & thread_sel_id_g[3])?
1328
                         wsr_gl_lvl3_data[`TSA_GLOBAL_WIDTH-1:0] :
1329
               ((local_rst | por_rstint3_g) ? `MAXGL_GL :
1330
                   ((tlu_dnrtry3_inst_g) ?
1331
                         tlu_dnrtry_global_g[`TSA_GLOBAL_WIDTH-1:0] :     // done/retry restore
1332
                     gl_lvl3[`TSA_GLOBAL_WIDTH-1:0] + gl_lvl3_incr[1:0])); // trap increments
1333
*/
1334 113 albert.wat
assign wsr_gl_lvl3_data[`TSA_GLOBAL_WIDTH-1:0] =
1335
            (maxstl_gl_wr_sel[3])? `MAXSTL_GL:
1336
           ((maxgl_gl_wr_sel[3]) ? `MAXGL_GL :
1337
            tlu_wsr_data_w_global[`TSA_GLOBAL_WIDTH-1:0]);
1338
assign gl_lvl3_update_g[`TSA_GLOBAL_WIDTH-1:0] =
1339 95 fafa1971
                (gl_rw_g & wsr_inst_g & thread_sel_id_g[3]) ?
1340 113 albert.wat
                         wsr_gl_lvl3_data[`TSA_GLOBAL_WIDTH-1:0] :
1341
               ((local_rst | por_rstint3_g) ? `MAXGL_GL :
1342
                         dnrtry_gl_lvl3_data[`TSA_GLOBAL_WIDTH-1:0]);     // done/retry restore
1343 95 fafa1971
                         // tlu_dnrtry_global_g[`TSA_GLOBAL_WIDTH-1:0]);     // done/retry restore
1344
 
1345 113 albert.wat
dffe_s #(`TSA_GLOBAL_WIDTH) dffe_gl_lvl3_update_w2 (
1346
     .din (gl_lvl3_update_g[`TSA_GLOBAL_WIDTH-1:0]),
1347
     .q   (gl_lvl3_update_w2[`TSA_GLOBAL_WIDTH-1:0]),
1348 95 fafa1971
     .en  (gl_update_sel_g[3]),
1349
     .clk (clk),
1350
     .se  (se),
1351 113 albert.wat
     `SIMPLY_RISC_SCANIN,
1352 95 fafa1971
     .so  ()
1353
);
1354
//
1355
// modified for bug3468
1356
assign gl_incr_sel_w2[3] =
1357
           tlu_thrd_traps_w2[3] & ~(gl_lvl3_at_maxgl |
1358
           (gl_lvl3_at_maxstl & tlu_select_tba_w2));
1359
//            tlu_thrd_traps_w2[3] & (~(gl_lvl3_at_maxgl | tlu_select_tba_w2) |  
1360
assign gl_update_sel_g[3] =
1361
           (gl_rw_g & wsr_inst_g & thread_sel_id_g[3]) |
1362
                        local_rst |     por_rstint3_g | tlu_dnrtry3_inst_g;
1363
//
1364
// modified for bug3468
1365
assign gl_priv_max_sel_w2[3] =
1366
           (gl_lvl3_at_maxgl & tlu_select_tba_w2) & tlu_thrd_traps_w2[3];
1367
// 
1368
assign gl3_en =
1369
           gl_incr_sel_w2[3] | gl_update_sel_w2[3] | gl_priv_max_sel_w2[3];
1370
// assign gl3_en = gl_incr_sel_w2[3] | gl_update_sel_w2[3]; 
1371
 
1372 113 albert.wat
assign gl_lvl3_new[`TSA_GLOBAL_WIDTH-1:0] =
1373 95 fafa1971
           (gl_update_sel_w2[3]) ? gl_lvl3_update_w2:
1374
           (~gl_update_sel_w2[3] & gl_priv_max_sel_w2[3]) ?
1375 113 albert.wat
            `MAXSTL_GL:
1376
            gl_lvl3[`TSA_GLOBAL_WIDTH-1:0] + 2'b01;
1377 95 fafa1971
 
1378
// Reset required as processor will start out at gl1 after reset.
1379
/****************************
1380
   to fix bug 6028 manually in the gate netlist, the following needs
1381
   to be a mux_flop with recirculating path from q to d0 input. But
1382
   to make it resetable, need to brake this recirculating path and
1383
   insert an AND gate such that local_rst_l is ANDed with the q output.
1384 113 albert.wat
dffe_s #(`TSA_GLOBAL_WIDTH) dffe_gl3 (
1385 95 fafa1971
     .din (gl_lvl3_new[`TSA_GLOBAL_WIDTH-1:0]),
1386
     .q   (gl_lvl3[`TSA_GLOBAL_WIDTH-1:0]),
1387
     .en  (gl3_en),
1388
     .clk (clk),
1389
     .se  (se),
1390 113 albert.wat
     `SIMPLY_RISC_SCANIN,
1391 95 fafa1971
     .so  ()
1392
);
1393
******************************/
1394
 
1395
wire [1:0] gl_lvl3_or_rst, gl_lvl3_or_rst_or_new;
1396
 
1397
assign gl_lvl3_or_rst[1:0] = gl_lvl3[1:0] & {2{~local_rst}};
1398
 
1399
assign gl_lvl3_or_rst_or_new[1:0] = (gl3_en&~local_rst) ? gl_lvl3_new[1:0] : gl_lvl3_or_rst[1:0];
1400
 
1401 113 albert.wat
dff_s    #(2) dffe_gl3 (
1402 95 fafa1971
        .din(gl_lvl3_or_rst_or_new[1:0]) ,
1403
        .q(gl_lvl3[1:0]),
1404 113 albert.wat
        .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1405 95 fafa1971
 
1406
/******************************/
1407
 
1408 113 albert.wat
assign tlu_gl_lvl3[`TSA_GLOBAL_WIDTH-1:0] = gl_lvl3[`TSA_GLOBAL_WIDTH-1:0];
1409 95 fafa1971
 
1410 113 albert.wat
`endif // !`ifdef FPGA_SYN_1THREAD
1411 95 fafa1971
 
1412
////////////////////////////////////////////////////////////////////////
1413
// Global swap 
1414
////////////////////////////////////////////////////////////////////////
1415
// modified due to timing
1416
/*
1417
assign agp_thrid[0] = ~tlu_agp_tid_g[0] & ~tlu_agp_tid_g[1] & gl0_en;
1418
assign agp_thrid[1] =  tlu_agp_tid_g[0] & ~tlu_agp_tid_g[1] & gl1_en;
1419
assign agp_thrid[2] = ~tlu_agp_tid_g[0] &  tlu_agp_tid_g[1] & gl2_en;
1420
assign agp_thrid[3] =  tlu_agp_tid_g[0] &  tlu_agp_tid_g[1] & gl3_en;
1421
 
1422
assign agp_swap =
1423
           (agp_thrid[0])?
1424
               |(gl_lvl0_new[1:0] ^ gl_lvl0[1:0]):
1425
               ((agp_thrid[1])?
1426
                     |(gl_lvl1_new[1:0] ^ gl_lvl1[1:0]):
1427
                     ((agp_thrid[2])?
1428
                         |(gl_lvl2_new[1:0] ^ gl_lvl2[1:0]):
1429
                         ((agp_thrid[3])?
1430
                            |(gl_lvl3_new[1:0] ^ gl_lvl3[1:0]):1'b0)));
1431
 
1432
assign agp_new[1:0] =
1433
           (agp_thrid[1])? gl_lvl1_new[1:0] :
1434
               ((agp_thrid[2])? gl_lvl2_new[1:0] :
1435
                   ((agp_thrid[3])? gl_lvl3_new[1:0] :
1436
                        gl_lvl0_new[1:0]));
1437
 
1438 113 albert.wat
dffr_s dffr_tlu_exu_agp_swap (
1439 95 fafa1971
    .din (agp_swap),
1440
    .q   (tlu_exu_agp_swap),
1441
    .clk (clk),
1442
    .rst (local_rst),
1443
    .se  (se),
1444 113 albert.wat
    `SIMPLY_RISC_SCANIN,
1445 95 fafa1971
    .so  ()
1446
);
1447
 
1448 113 albert.wat
dff_s #(2) dff_tlu_exu_agp (
1449 95 fafa1971
    .din (agp_new[1:0]),
1450
    .q   (tlu_exu_agp[1:0]),
1451
    .clk (clk),
1452
    .se  (se),
1453 113 albert.wat
    `SIMPLY_RISC_SCANIN,
1454 95 fafa1971
    .so  ()
1455
);
1456
 
1457 113 albert.wat
dff_s #(2) dff_tlu_exu_agp_tid (
1458 95 fafa1971
    .din (tlu_agp_tid_g[1:0]),
1459
    .q   (tlu_exu_agp_tid[1:0]),
1460
    .clk (clk),
1461
    .se  (se),
1462 113 albert.wat
    `SIMPLY_RISC_SCANIN,
1463 95 fafa1971
    .so  ()
1464
);
1465
*/
1466
 
1467
assign agp_thrid_w2[0] = ~tlu_agp_tid_w2[0] & ~tlu_agp_tid_w2[1] & gl0_en;
1468
 
1469 113 albert.wat
`ifdef FPGA_SYN_1THREAD
1470
   assign agp_thrid_w2[1] = 1'b0;
1471
   assign agp_thrid_w2[2] = 1'b0;
1472
   assign agp_thrid_w2[3] = 1'b0;
1473
   assign agp_swap_w2 = (agp_thrid_w2[0])?
1474
                          |(gl_lvl0_new[1:0] ^ gl_lvl0[1:0]):1'b0;
1475
   dffr_s dffr_agp_swap_w3 (
1476
    .din (agp_swap_w2),
1477
    .q   (agp_swap_w3),
1478
    .rst (local_rst),
1479
    .clk (clk),
1480
    .se  (se),
1481
    `SIMPLY_RISC_SCANIN,
1482
    .so ()
1483
);
1484 95 fafa1971
 
1485 113 albert.wat
   assign agp_new_w2[1:0] = gl_lvl0_new[1:0];
1486 95 fafa1971
 
1487 113 albert.wat
`else
1488
 
1489 95 fafa1971
assign agp_thrid_w2[1] =  tlu_agp_tid_w2[0] & ~tlu_agp_tid_w2[1] & gl1_en;
1490
assign agp_thrid_w2[2] = ~tlu_agp_tid_w2[0] &  tlu_agp_tid_w2[1] & gl2_en;
1491
assign agp_thrid_w2[3] =  tlu_agp_tid_w2[0] &  tlu_agp_tid_w2[1] & gl3_en;
1492
 
1493
assign agp_swap_w2 =
1494
           (agp_thrid_w2[0])?
1495
               |(gl_lvl0_new[1:0] ^ gl_lvl0[1:0]):
1496
               ((agp_thrid_w2[1])?
1497
                     |(gl_lvl1_new[1:0] ^ gl_lvl1[1:0]):
1498
                     ((agp_thrid_w2[2])?
1499
                         |(gl_lvl2_new[1:0] ^ gl_lvl2[1:0]):
1500
                         ((agp_thrid_w2[3])?
1501
                            |(gl_lvl3_new[1:0] ^ gl_lvl3[1:0]):1'b0)));
1502
 
1503 113 albert.wat
dffr_s dffr_agp_swap_w3 (
1504 95 fafa1971
    .din (agp_swap_w2),
1505
    .q   (agp_swap_w3),
1506
    .rst (local_rst),
1507
    .clk (clk),
1508
    .se  (se),
1509 113 albert.wat
    `SIMPLY_RISC_SCANIN,
1510 95 fafa1971
    .so ()
1511
);
1512
 
1513
assign agp_new_w2[1:0] =
1514
           (agp_thrid_w2[1])? gl_lvl1_new[1:0] :
1515
               ((agp_thrid_w2[2])? gl_lvl2_new[1:0] :
1516
                   ((agp_thrid_w2[3])? gl_lvl3_new[1:0] :
1517
                        gl_lvl0_new[1:0]));
1518 113 albert.wat
`endif // !`ifdef FPGA_SYN_1THREAD
1519 95 fafa1971
 
1520
//
1521
// added for timing fixes
1522 113 albert.wat
dff_s #(2) dff_agp_new_w3 (
1523 95 fafa1971
    .din (agp_new_w2[1:0]),
1524
    .q   (agp_new_w3[1:0]),
1525
    .clk (clk),
1526
    .se  (se),
1527 113 albert.wat
    `SIMPLY_RISC_SCANIN,
1528 95 fafa1971
    .so  ()
1529
);
1530
assign tlu_exu_agp_swap = agp_swap_w3;
1531
assign tlu_exu_agp[1:0] = agp_new_w3[1:0];
1532
 
1533
////////////////////////////////////////////////////////////////////////
1534
// HPSTATE register controls 
1535
////////////////////////////////////////////////////////////////////////
1536
//
1537
// added for timing
1538 113 albert.wat
dffr_s #(`TLU_THRD_NUM) dffr_update_hpstate_w2 (
1539
    .din (update_hpstate_g[`TLU_THRD_NUM-1:0]),
1540
    .q   (update_hpstate_w2[`TLU_THRD_NUM-1:0]),
1541 95 fafa1971
    .rst (local_rst),
1542
    .clk (clk),
1543
    .se  (se),
1544 113 albert.wat
    `SIMPLY_RISC_SCANIN,
1545 95 fafa1971
    .so  ()
1546
);
1547
 
1548
// thread 0
1549
assign tlu_hpstate_din_sel0[0] = dnrtry_inst_w2[0] & ~rst_tri_en;
1550
assign tlu_hpstate_din_sel0[1] = (hpstate_rw_w2 & wsr_inst_w2) &
1551
                                 ~rst_tri_en                   &
1552
                                 ~tlu_hpstate_din_sel0[0]      &
1553
                                  thread_sel_id_w2[0];
1554
//
1555
// generating write enables to update the hpstate registers
1556
// modified for timing 
1557
/*
1558
assign tlu_hpstate_din_sel0[0] = tlu_dnrtry0_inst_g;
1559
assign tlu_hpstate_din_sel0[1] = (hpstate_rw_g & wsr_inst_g) &
1560
                                 ~tlu_hpstate_din_sel0[0]        &
1561
                                  thread_sel_id_g[0];
1562
assign update_hpstate0_g =  tlu_thrd0_traps | tlu_dnrtry0_inst_g |
1563
                                  ((hpstate_rw_g & wsr_inst_g) &
1564
                            thread_sel_id_g[0]);
1565
 
1566
assign tlu_update_hpstate_l_g[0] = ~(update_hpstate0_g | local_rst);
1567
*/
1568
assign update_hpstate_g[0] =
1569
           tlu_dnrtry0_inst_g | ((hpstate_rw_g & wsr_inst_g) &
1570
           thread_sel_id_g[0]);
1571
 
1572
assign tlu_update_hpstate_l_w2[0] =
1573
           ~(update_hpstate_w2[0] | local_rst | tlu_thrd_traps_w2[0]);
1574
//
1575
// thread 1
1576
assign tlu_hpstate_din_sel1[0] = dnrtry_inst_w2[1] & ~rst_tri_en;
1577
assign tlu_hpstate_din_sel1[1] = (hpstate_rw_w2 & wsr_inst_w2) &
1578
                                 ~rst_tri_en                   &
1579
                                 ~tlu_hpstate_din_sel1[0]      &
1580
                                  thread_sel_id_w2[1];
1581
//
1582
// generating write enables to update the hpstate registers
1583
// modified for timing 
1584
/*
1585
assign tlu_hpstate_din_sel1[0] = tlu_dnrtry1_inst_g;
1586
assign tlu_hpstate_din_sel1[1] = (hpstate_rw_g & wsr_inst_g) &
1587
                                 ~tlu_hpstate_din_sel1[0]        &
1588
                                  thread_sel_id_g[1];
1589
assign update_hpstate1_g =  tlu_thrd1_traps | tlu_dnrtry1_inst_g |
1590
                                  ((hpstate_rw_g & wsr_inst_g) &
1591
                            thread_sel_id_g[1]);
1592
 
1593
assign tlu_update_hpstate_l_g[1] = ~(update_hpstate1_g | local_rst);
1594
*/
1595
assign update_hpstate_g[1] =
1596
           tlu_dnrtry1_inst_g | ((hpstate_rw_g & wsr_inst_g) &
1597
           thread_sel_id_g[1]);
1598
 
1599
assign tlu_update_hpstate_l_w2[1] =
1600
           ~(update_hpstate_w2[1] | local_rst | tlu_thrd_traps_w2[1]);
1601
//
1602
// thread 2
1603
assign tlu_hpstate_din_sel2[0] = dnrtry_inst_w2[2] & ~rst_tri_en;
1604
assign tlu_hpstate_din_sel2[1] = (hpstate_rw_w2 & wsr_inst_w2) &
1605
                                 ~rst_tri_en                   &
1606
                                 ~tlu_hpstate_din_sel2[0]      &
1607
                                  thread_sel_id_w2[2];
1608
//
1609
// generating write enables to update the hpstate registers
1610
// modified for timing
1611
/*
1612
assign tlu_hpstate_din_sel2[0] = tlu_dnrtry2_inst_g;
1613
assign tlu_hpstate_din_sel2[1] = (hpstate_rw_g & wsr_inst_g) &
1614
                                 ~tlu_hpstate_din_sel2[0]        &
1615
                                  thread_sel_id_g[2];
1616
assign update_hpstate2_g =  tlu_thrd2_traps | tlu_dnrtry2_inst_g |
1617
                                  ((hpstate_rw_g & wsr_inst_g) &
1618
                            thread_sel_id_g[2]);
1619
 
1620
assign tlu_update_hpstate_l_g[2] = ~(update_hpstate2_g | local_rst);
1621
*/
1622
assign update_hpstate_g[2] =
1623
           tlu_dnrtry2_inst_g | ((hpstate_rw_g & wsr_inst_g) &
1624
           thread_sel_id_g[2]);
1625
 
1626
assign tlu_update_hpstate_l_w2[2] =
1627
           ~(update_hpstate_w2[2] | local_rst | tlu_thrd_traps_w2[2]);
1628
//
1629
// thread 3
1630
assign tlu_hpstate_din_sel3[0] = dnrtry_inst_w2[3] & ~rst_tri_en;
1631
assign tlu_hpstate_din_sel3[1] = (hpstate_rw_w2 & wsr_inst_w2) &
1632
                                 ~tlu_hpstate_din_sel3[0]      &
1633
                                 ~rst_tri_en                   &
1634
                                  thread_sel_id_w2[3];
1635
//
1636
// generating write enables to update the hpstate registers
1637
// modified for timing
1638
/*
1639
assign tlu_hpstate_din_sel3[0] = tlu_dnrtry3_inst_g;
1640
assign tlu_hpstate_din_sel3[1] = (hpstate_rw_g & wsr_inst_g) &
1641
                                 ~tlu_hpstate_din_sel3[0]        &
1642
                                  thread_sel_id_g[3];
1643
assign update_hpstate3_g =  tlu_thrd3_traps | tlu_dnrtry3_inst_g |
1644
                                  ((hpstate_rw_g & wsr_inst_g) &
1645
                            thread_sel_id_g[3]);
1646
 
1647
assign tlu_update_hpstate_l_g[3] = ~(update_hpstate3_g | local_rst);
1648
*/
1649
assign update_hpstate_g[3] =
1650
           tlu_dnrtry3_inst_g | ((hpstate_rw_g & wsr_inst_g) &
1651
           thread_sel_id_g[3]);
1652
 
1653
assign tlu_update_hpstate_l_w2[3] =
1654
           ~(update_hpstate_w2[3] | local_rst | tlu_thrd_traps_w2[3]);
1655
 
1656
////////////////////////////////////////////////////////////////////////
1657
// HTICKCMP register controls 
1658
////////////////////////////////////////////////////////////////////////
1659
// thread 0
1660
assign htickcmp_intdis_en[0] =
1661
           (htickcmp_rw_g & wsr_inst_g & thread_sel_id_g[0]) |
1662
            local_rst | por_rstint0_g;
1663
// 
1664
// HTICK_CMP.INT_DIS
1665 113 albert.wat
dffe_s dffe_hintdis0  (
1666 95 fafa1971
     .din (tlu_tick_ctl_din),
1667
     .q   (htick_intdis0),
1668
     .en  (htickcmp_intdis_en[0]),
1669
     .clk (clk),
1670
     .se  (se),
1671 113 albert.wat
     `SIMPLY_RISC_SCANIN,
1672 95 fafa1971
     .so ()
1673
);
1674
 
1675
// thread 1
1676
assign htickcmp_intdis_en[1] =
1677
           (htickcmp_rw_g & wsr_inst_g & thread_sel_id_g[1]) |
1678
                        local_rst | por_rstint1_g;
1679
// 
1680
// HTICK_CMP.INT_DIS
1681 113 albert.wat
dffe_s dffe_hintdis1  (
1682 95 fafa1971
     .din (tlu_tick_ctl_din),
1683
     .q   (htick_intdis1),
1684
     .en  (htickcmp_intdis_en[1]),
1685
     .clk (clk),
1686
     .se  (se),
1687 113 albert.wat
     `SIMPLY_RISC_SCANIN,
1688 95 fafa1971
     .so ()
1689
);
1690
 
1691
// thread 2
1692
assign htickcmp_intdis_en[2] =
1693
           (htickcmp_rw_g & wsr_inst_g & thread_sel_id_g[2]) |
1694
                        local_rst | por_rstint2_g;
1695
// 
1696
// HTICK_CMP.INT_DIS
1697 113 albert.wat
dffe_s dffe_hintdis2  (
1698 95 fafa1971
     .din (tlu_tick_ctl_din),
1699
     .q   (htick_intdis2),
1700
     .en  (htickcmp_intdis_en[2]),
1701
     .clk (clk),
1702
     .se  (se),
1703 113 albert.wat
     `SIMPLY_RISC_SCANIN,
1704 95 fafa1971
     .so ()
1705
);
1706
 
1707
// thread 3
1708
assign htickcmp_intdis_en[3] =
1709
           (htickcmp_rw_g & wsr_inst_g & thread_sel_id_g[3]) |
1710
                        local_rst | por_rstint3_g;
1711
// HTICK_CMP.INT_DIS
1712
//
1713 113 albert.wat
dffe_s dffe_hintdis3  (
1714 95 fafa1971
     .din (tlu_tick_ctl_din),
1715
     .q   (htick_intdis3),
1716
     .en  (htickcmp_intdis_en[3]),
1717
     .clk (clk),
1718
     .se  (se),
1719 113 albert.wat
     `SIMPLY_RISC_SCANIN,
1720 95 fafa1971
     .so ()
1721
);
1722
//
1723
// generating for the non-thread specific htick_cmp
1724
// interrupt disable
1725
assign tlu_htickcmp_intdis =
1726
               (thread_sel_id_e[0] & htick_intdis0) | (thread_sel_id_e[1] & htick_intdis1) |
1727
                   (thread_sel_id_e[2] & htick_intdis2) | (thread_sel_id_e[3] & htick_intdis3);
1728
 
1729
////////////////////////////////////////////////////////////////////////
1730
// HINTP register controls 
1731
////////////////////////////////////////////////////////////////////////
1732
// thread 0 
1733
// 
1734
// modified for timing
1735
// assign tlu_set_hintp_g[0] = 
1736
//            (~htick_intdis0 & tlu_tickcmp_sel[0])? tlu_htick_match: 1'b0;
1737
assign tlu_set_hintp_sel_g[0] = ~htick_intdis0 & tlu_tickcmp_sel[0];
1738
// modified for bug 4886
1739
assign tlu_wr_hintp_g[0] =
1740
           (hintp_rw_g & wsr_inst_g & thread_sel_id_g[0]) | local_rst;
1741
//
1742
// modified for timing - moved to tlu_tdp
1743
// assign tlu_hintp_en_l_g[0] = 
1744
//            ~(tlu_set_hintp_g[0] | tlu_wr_hintp_g[0]);
1745
//
1746
// thread 1 
1747
//
1748
// modified for timing
1749
// assign tlu_set_hintp_g[1] = 
1750
//            (~htick_intdis1 & tlu_tickcmp_sel[1])? tlu_htick_match: 1'b0;
1751
assign tlu_set_hintp_sel_g[1] = ~htick_intdis1 & tlu_tickcmp_sel[1];
1752
assign tlu_wr_hintp_g[1] =
1753
           (hintp_rw_g & wsr_inst_g & thread_sel_id_g[1]) | local_rst;
1754
//
1755
// modified for timing - moved to tlu_tdp
1756
// assign tlu_hintp_en_l_g[1] = 
1757
//            ~(tlu_set_hintp_g[1] | tlu_wr_hintp_g[1]);
1758
//
1759
// thread 2 
1760
// 
1761
// modified for timing 
1762
// assign tlu_set_hintp_g[2] = 
1763
//            (~htick_intdis2 & tlu_tickcmp_sel[2])? tlu_htick_match: 1'b0;
1764
assign tlu_set_hintp_sel_g[2] = ~htick_intdis2 & tlu_tickcmp_sel[2];
1765
assign tlu_wr_hintp_g[2] =
1766
           (hintp_rw_g & wsr_inst_g & thread_sel_id_g[2]) | local_rst;
1767
//
1768
// modified for timing - moved to tlu_tdp
1769
// assign tlu_hintp_en_l_g[2] = 
1770
//            ~(tlu_set_hintp_g[2] | tlu_wr_hintp_g[2]);
1771
//
1772
// thread 3 
1773
//
1774
// modified for timing
1775
// assign tlu_set_hintp_g[3] = 
1776
//            (~htick_intdis3 & tlu_tickcmp_sel[3])? tlu_htick_match: 1'b0;
1777
assign tlu_set_hintp_sel_g[3] = ~htick_intdis3 & tlu_tickcmp_sel[3];
1778
assign tlu_wr_hintp_g[3] =
1779
           (hintp_rw_g & wsr_inst_g & thread_sel_id_g[3]) | local_rst;
1780
//
1781
// modified for timing - moved to tlu_tdp
1782
// assign tlu_hintp_en_l_g[3] = 
1783
//            ~(tlu_set_hintp_g[3] | tlu_wr_hintp_g[3]);
1784
 
1785
////////////////////////////////////////////////////////////////////////
1786
// HTBA register controls 
1787
////////////////////////////////////////////////////////////////////////
1788
 
1789
assign tlu_htba_en_l[0]  = ~(htba_rw_g & wsr_inst_g & thread_sel_id_g[0]);
1790
assign tlu_htba_en_l[1] = ~(htba_rw_g & wsr_inst_g & thread_sel_id_g[1]);
1791
assign tlu_htba_en_l[2] = ~(htba_rw_g & wsr_inst_g & thread_sel_id_g[2]);
1792
assign tlu_htba_en_l[3] = ~(htba_rw_g & wsr_inst_g & thread_sel_id_g[3]);
1793
 
1794
////////////////////////////////////////////////////////////////////////
1795
// ASI QUEUE register controls and data 
1796
////////////////////////////////////////////////////////////////////////
1797
// ASI read or write op
1798
//
1799
assign asi_queue_write_e = ifu_lsu_alt_space_e & ifu_lsu_st_inst_e;
1800
assign asi_queue_read_e  = ifu_lsu_alt_space_e & ifu_lsu_ld_inst_e;
1801
// 
1802
// qualify the asi write and read controls
1803
assign asi_queue_write_m = tlu_inst_vld_m & asi_queue_write_pq_m;
1804
assign asi_queue_read_m  = tlu_inst_vld_m & asi_queue_read_pq_m;
1805
//
1806
// modified due to timing violations
1807
// assign asi_queue_write_g = 
1808
//      ~(tlu_flush_pipe_w | ifu_tlu_flush_w) & asi_queue_write_uf_g;
1809
assign asi_queue_write_g =
1810
           ~local_flush_all_w & asi_queue_write_uf_g;
1811
assign tlu_asi_write_g = asi_queue_write_g;
1812
 
1813
// assign asi_queue_read_g  = 
1814
//     ~(tlu_flush_pipe_w | ifu_tlu_flush_w) & asi_queue_read_uf_g;
1815
//
1816
// staging the asi controls
1817 113 albert.wat
dffr_s #(2) dffr_asi_ctl_m (
1818 95 fafa1971
    .din ({asi_queue_write_e, asi_queue_read_e}),
1819
    .q   ({asi_queue_write_pq_m, asi_queue_read_pq_m}),
1820
    .rst (local_rst),
1821
    .clk (clk),
1822
    .se  (se),
1823 113 albert.wat
    `SIMPLY_RISC_SCANIN,
1824 95 fafa1971
    .so  ()
1825
);
1826
 
1827 113 albert.wat
dffr_s #(2) dffr_asi_ctl_g (
1828 95 fafa1971
    .din ({asi_queue_write_m, asi_queue_read_m}),
1829
    .q   ({asi_queue_write_uf_g, asi_queue_read_g}),
1830
    .rst (local_rst),
1831
    .clk (clk),
1832
    .se  (se),
1833 113 albert.wat
    `SIMPLY_RISC_SCANIN,
1834 95 fafa1971
    .so  ()
1835
);
1836
// 
1837
// ASI address decode 
1838
// decoding the ASI state 0x25 for the ASI_QUEUES
1839
assign asi_queue_rw_e =
1840
          (ifu_lsu_alt_space_e)?
1841 113 albert.wat
          (tlu_asi_state_e[`TLU_ASI_STATE_WIDTH-1:0]==`TLU_ASI_QUE_ASI):
1842 95 fafa1971
           1'b0;
1843
//
1844
// staging the asi controls
1845 113 albert.wat
dffr_s dffr_asi_queue_rw_m (
1846 95 fafa1971
    .din (asi_queue_rw_e),
1847
    .q   (asi_queue_rw_m),
1848
    .rst (local_rst),
1849
    .clk (clk),
1850
    .se  (se),
1851 113 albert.wat
    `SIMPLY_RISC_SCANIN,
1852 95 fafa1971
    .so  ()
1853
);
1854
 
1855 113 albert.wat
dffr_s dffr_asi_queue_rw_g (
1856 95 fafa1971
    .din (asi_queue_rw_m),
1857
    .q   (asi_queue_rw_g),
1858
    .rst (local_rst),
1859
    .clk (clk),
1860
    .se  (se),
1861 113 albert.wat
    `SIMPLY_RISC_SCANIN,
1862 95 fafa1971
    .so  ()
1863
);
1864
//
1865
// modified due to timing violations
1866
/*
1867
// assign tlu_ldst_va_e[`TLU_ASI_VA_WIDTH-1:0] =
1868
//          exu_lsu_ldst_va_e[`TLU_ASI_VA_WIDTH-1:0];
1869 113 albert.wat
dff_s #(`TLU_ASI_VA_WIDTH) dff_tlu_ldst_va_m (
1870 95 fafa1971
    .din (exu_lsu_ldst_va_e[`TLU_ASI_VA_WIDTH-1:0]),
1871
    .q   (tlu_ldst_va_m[`TLU_ASI_VA_WIDTH-1:0]),
1872
    .clk (clk),
1873
    .se  (se),
1874 113 albert.wat
    `SIMPLY_RISC_SCANIN,
1875 95 fafa1971
    .so  ()
1876
);
1877
 
1878
// modified for timing
1879
assign que_legal_va_e =
1880
           cpu_mondo_head_rw_e  | cpu_mondo_tail_rw_e |
1881
           dev_mondo_head_rw_e  | dev_mondo_tail_rw_e |
1882
           resum_err_head_rw_e  | resum_err_tail_rw_e |
1883
           nresum_err_head_rw_e | nresum_err_tail_rw_e;
1884
 
1885
assign que_ill_va_e =
1886
           (ifu_lsu_alt_space_e)?
1887
           (((|exu_lsu_ldst_va_e[`ASI_VA_WIDTH-1:`TLU_ASI_QUE_VA_HI+1]) |
1888
           (|exu_lsu_ldst_va_e[`TLU_ASI_QUE_VA_LO-1:0]) | ~que_legal_va_e) &
1889
            asi_queue_pq_rw_e): 1'b0;
1890
*/
1891 113 albert.wat
assign tlu_ldst_va_m[`TLU_ASI_VA_WIDTH-1:0] =
1892
           lsu_tlu_ldst_va_m[`TLU_ASI_VA_WIDTH-1:0];
1893 95 fafa1971
 
1894
assign que_legal_va_m =
1895
           cpu_mondo_head_rw_m  | cpu_mondo_tail_rw_m |
1896
           dev_mondo_head_rw_m  | dev_mondo_tail_rw_m |
1897
           resum_err_head_rw_m  | resum_err_tail_rw_m |
1898
           nresum_err_head_rw_m | nresum_err_tail_rw_m;
1899
 
1900
//
1901
// illegal range check for queue va 
1902
assign que_ill_va_m =
1903
           (asi_queue_rw_m)? ~que_legal_va_m : 1'b0;
1904
//
1905
// staged illegal va range 
1906
//
1907 113 albert.wat
dffr_s dffr_que_ill_va_g (
1908 95 fafa1971
    .din (que_ill_va_m),
1909
    .q   (que_ill_va_g),
1910
    .rst (local_rst),
1911
    .clk (clk),
1912
    .se  (se),
1913 113 albert.wat
    `SIMPLY_RISC_SCANIN,
1914 95 fafa1971
    .so  ()
1915
);
1916
// 
1917
// added for timing - interrupt register decodes
1918
// interrupt receiver registers
1919
assign asi_inrr_rw_e =
1920
          (ifu_lsu_alt_space_e)?
1921 113 albert.wat
          (tlu_asi_state_e[`TLU_ASI_STATE_WIDTH-1:0]==`TLU_INRR_ASI):
1922 95 fafa1971
           1'b0;
1923
 
1924 113 albert.wat
dffr_s dffr_asi_inrr_rw_m (
1925 95 fafa1971
    .din (asi_inrr_rw_e),
1926
    .q   (asi_inrr_rw_m),
1927
    .rst (local_rst),
1928
    .clk (clk),
1929
    .se  (se),
1930 113 albert.wat
    `SIMPLY_RISC_SCANIN,
1931 95 fafa1971
    .so  ()
1932
);
1933
 
1934 113 albert.wat
dffr_s dffr_asi_inrr_rw_g (
1935 95 fafa1971
    .din (asi_inrr_rw_m),
1936
    .q   (asi_inrr_rw_g),
1937
    .rst (local_rst),
1938
    .clk (clk),
1939
    .se  (se),
1940 113 albert.wat
    `SIMPLY_RISC_SCANIN,
1941 95 fafa1971
    .so  ()
1942
);
1943
 
1944
assign inc_ind_asi_wr_inrr[0] =
1945
           (asi_inrr_rw_g & asi_queue_write_uf_g   &
1946
           ~local_flush_all_w & thread_sel_id_g[0]);
1947
assign inc_ind_asi_wr_inrr[1] =
1948
           (asi_inrr_rw_g & asi_queue_write_uf_g   &
1949
           ~local_flush_all_w & thread_sel_id_g[1]);
1950
assign inc_ind_asi_wr_inrr[2] =
1951
           (asi_inrr_rw_g & asi_queue_write_uf_g   &
1952
           ~local_flush_all_w & thread_sel_id_g[2]);
1953
assign inc_ind_asi_wr_inrr[3] =
1954
           (asi_inrr_rw_g & asi_queue_write_uf_g   &
1955
           ~local_flush_all_w & thread_sel_id_g[3]);
1956
//
1957
// interrupt dispatch registers
1958
assign asi_indr_rw_e =
1959
          (ifu_lsu_alt_space_e)?
1960 113 albert.wat
          (tlu_asi_state_e[`TLU_ASI_STATE_WIDTH-1:0]==`TLU_INDR_ASI):
1961 95 fafa1971
           1'b0;
1962
 
1963 113 albert.wat
dffr_s dffr_asi_indr_rw_m (
1964 95 fafa1971
    .din (asi_indr_rw_e),
1965
    .q   (asi_indr_rw_m),
1966
    .rst (local_rst),
1967
    .clk (clk),
1968
    .se  (se),
1969 113 albert.wat
    `SIMPLY_RISC_SCANIN,
1970 95 fafa1971
    .so  ()
1971
);
1972
 
1973 113 albert.wat
dffr_s dffr_asi_indr_rw_g (
1974 95 fafa1971
    .din (asi_indr_rw_m),
1975
    .q   (asi_indr_rw_g),
1976
    .rst (local_rst),
1977
    .clk (clk),
1978
    .se  (se),
1979 113 albert.wat
    `SIMPLY_RISC_SCANIN,
1980 95 fafa1971
    .so  ()
1981
);
1982
 
1983
assign inc_ind_asi_wr_indr[0] =
1984
           asi_indr_rw_g & ~local_flush_all_w & asi_queue_write_uf_g &
1985
           thread_sel_id_g[0];
1986
assign inc_ind_asi_wr_indr[1] =
1987
           asi_indr_rw_g & ~local_flush_all_w & asi_queue_write_uf_g &
1988
           thread_sel_id_g[1];
1989
assign inc_ind_asi_wr_indr[2] =
1990
           asi_indr_rw_g & ~local_flush_all_w & asi_queue_write_uf_g &
1991
           thread_sel_id_g[2];
1992
assign inc_ind_asi_wr_indr[3] =
1993
           asi_indr_rw_g & ~local_flush_all_w & asi_queue_write_uf_g &
1994
           thread_sel_id_g[3];
1995
 
1996
//
1997
// interrupt vector registers
1998
assign asi_invr_rw_e =
1999
          (ifu_lsu_alt_space_e)?
2000 113 albert.wat
          (tlu_asi_state_e[`TLU_ASI_STATE_WIDTH-1:0]==`TLU_INVR_ASI):
2001 95 fafa1971
           1'b0;
2002
 
2003 113 albert.wat
dffr_s dffr_asi_invr_rw_m (
2004 95 fafa1971
    .din (asi_invr_rw_e),
2005
    .q   (asi_invr_rw_m),
2006
    .rst (local_rst),
2007
    .clk (clk),
2008
    .se  (se),
2009 113 albert.wat
    `SIMPLY_RISC_SCANIN,
2010 95 fafa1971
    .so  ()
2011
);
2012
 
2013 113 albert.wat
dffr_s dffr_asi_invr_rw_g (
2014 95 fafa1971
    .din (asi_invr_rw_m),
2015
    .q   (asi_invr_rw_g),
2016
    .rst (local_rst),
2017
    .clk (clk),
2018
    .se  (se),
2019 113 albert.wat
    `SIMPLY_RISC_SCANIN,
2020 95 fafa1971
    .so  ()
2021
);
2022
 
2023
assign inc_ind_asi_rd_invr[0] =
2024
           (asi_invr_rw_g & asi_queue_read_g &
2025
           ~local_flush_all_w & thread_sel_id_g[0]);
2026
assign inc_ind_asi_rd_invr[1] =
2027
           (asi_invr_rw_g & asi_queue_read_g &
2028
           ~local_flush_all_w & thread_sel_id_g[1]);
2029
assign inc_ind_asi_rd_invr[2] =
2030
           (asi_invr_rw_g & asi_queue_read_g &
2031
           ~local_flush_all_w & thread_sel_id_g[2]);
2032
assign inc_ind_asi_rd_invr[3] =
2033
           (asi_invr_rw_g & asi_queue_read_g &
2034
           ~local_flush_all_w & thread_sel_id_g[3]);
2035
//
2036
// timing changes: all va e stage signals have been moved to m-stage
2037
// decoding the VA portion of the ASI address
2038
// cpu_mondo_head: 0x3c0
2039
assign cpu_mondo_head_rw_m =
2040 113 albert.wat
          (tlu_ldst_va_m[`TLU_ASI_VA_WIDTH-1:0]==`CPU_MONDO_HEAD);
2041 95 fafa1971
//
2042
// cpu_mondo_tail: 0x3c8
2043
assign cpu_mondo_tail_rw_m =
2044 113 albert.wat
          (tlu_ldst_va_m[`TLU_ASI_VA_WIDTH-1:0]==`CPU_MONDO_TAIL);
2045 95 fafa1971
//
2046
// dev_mondo_head: 0x3d0
2047
assign dev_mondo_head_rw_m =
2048 113 albert.wat
          (tlu_ldst_va_m[`TLU_ASI_VA_WIDTH-1:0]==`DEV_MONDO_HEAD);
2049 95 fafa1971
//
2050
// dev_mondo_tail: 0x3d8
2051
assign dev_mondo_tail_rw_m =
2052 113 albert.wat
          (tlu_ldst_va_m[`TLU_ASI_VA_WIDTH-1:0]==`DEV_MONDO_TAIL);
2053 95 fafa1971
//
2054
// resum_err_head: 0x3e0
2055
assign resum_err_head_rw_m =
2056 113 albert.wat
          (tlu_ldst_va_m[`TLU_ASI_VA_WIDTH-1:0]==`RESUM_ERR_HEAD);
2057 95 fafa1971
//
2058
// resum_err_tail: 0x3e8
2059
assign resum_err_tail_rw_m =
2060 113 albert.wat
          (tlu_ldst_va_m[`TLU_ASI_VA_WIDTH-1:0]==`RESUM_ERR_TAIL);
2061 95 fafa1971
//
2062
// nresum_err_head: 0x3f0
2063
assign nresum_err_head_rw_m =
2064 113 albert.wat
          (tlu_ldst_va_m[`TLU_ASI_VA_WIDTH-1:0]==`NRESUM_ERR_HEAD);
2065 95 fafa1971
//
2066
// nresum_err_tail: 0x3f8
2067
assign nresum_err_tail_rw_m =
2068 113 albert.wat
          (tlu_ldst_va_m[`TLU_ASI_VA_WIDTH-1:0]==`NRESUM_ERR_TAIL);
2069 95 fafa1971
//
2070
// timing change: replaced by flopped tlu_ldst_va_m decodes
2071
// staging the ASI queue rw decodes
2072
// cpu_mondo_head
2073
/*
2074 113 albert.wat
dff_s dff_cpu_mondo_head_rw_m (
2075 95 fafa1971
     .din (cpu_mondo_head_rw_e),
2076
     .q   (cpu_mondo_head_rw_m),
2077
     .clk (clk),
2078
     .se  (se),
2079 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2080 95 fafa1971
     .so  ()
2081
);
2082
 
2083 113 albert.wat
dff_s dff_dev_mondo_head_rw_m (
2084 95 fafa1971
     .din (dev_mondo_head_rw_e),
2085
     .q   (dev_mondo_head_rw_m),
2086
     .clk (clk),
2087
     .se  (se),
2088 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2089 95 fafa1971
     .so  ()
2090
);
2091
 
2092 113 albert.wat
dff_s dff_resum_err_head_rw_m (
2093 95 fafa1971
     .din (resum_err_head_rw_e),
2094
     .q   (resum_err_head_rw_m),
2095
     .clk (clk),
2096
     .se  (se),
2097 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2098 95 fafa1971
     .so  ()
2099
);
2100
 
2101 113 albert.wat
dff_s dff_nresum_err_head_rw_m (
2102 95 fafa1971
     .din (nresum_err_head_rw_e),
2103
     .q   (nresum_err_head_rw_m),
2104
     .clk (clk),
2105
     .se  (se),
2106 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2107 95 fafa1971
     .so  ()
2108
);
2109
 
2110 113 albert.wat
dff_s dff_cpu_mondo_tail_rw_m (
2111 95 fafa1971
     .din (cpu_mondo_tail_rw_e),
2112
     .q   (cpu_mondo_tail_rw_m),
2113
     .clk (clk),
2114
     .se  (se),
2115 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2116 95 fafa1971
     .so  ()
2117
);
2118
 
2119 113 albert.wat
dff_s dff_dev_mondo_tail_rw_m (
2120 95 fafa1971
     .din (dev_mondo_tail_rw_e),
2121
     .q   (dev_mondo_tail_rw_m),
2122
     .clk (clk),
2123
     .se  (se),
2124 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2125 95 fafa1971
     .so  ()
2126
);
2127
 
2128 113 albert.wat
dff_s dff_resum_err_tail_rw_m (
2129 95 fafa1971
     .din (resum_err_tail_rw_e),
2130
     .q   (resum_err_tail_rw_m),
2131
     .clk (clk),
2132
     .se  (se),
2133 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2134 95 fafa1971
     .so  ()
2135
);
2136
 
2137 113 albert.wat
dff_s dff_nresum_err_tail_rw_m (
2138 95 fafa1971
     .din (nresum_err_tail_rw_e),
2139
     .q   (nresum_err_tail_rw_m),
2140
     .clk (clk),
2141
     .se  (se),
2142 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2143 95 fafa1971
     .so  ()
2144
);
2145
//
2146
// illegal range check
2147 113 albert.wat
dffr_s dffr_que_ill_va_m (
2148 95 fafa1971
    .din (que_ill_va_e),
2149
    .q   (que_ill_va_m),
2150
    .rst (local_rst),
2151
    .clk (clk),
2152
    .se  (se),
2153 113 albert.wat
    `SIMPLY_RISC_SCANIN,
2154 95 fafa1971
    .so  ()
2155
);
2156
*/
2157
 
2158
// staging the ASI queue rw decodes
2159
// cpu_mondo_head
2160 113 albert.wat
dff_s dff_cpu_mondo_head_rw_g (
2161 95 fafa1971
     .din (cpu_mondo_head_rw_m),
2162
     .q   (cpu_mondo_head_rw_g),
2163
     .clk (clk),
2164
     .se  (se),
2165 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2166 95 fafa1971
     .so  ()
2167
);
2168
//
2169
// dev_mondo_head
2170 113 albert.wat
dff_s dff_dev_mondo_head_rw_g (
2171 95 fafa1971
     .din (dev_mondo_head_rw_m),
2172
     .q   (dev_mondo_head_rw_g),
2173
     .clk (clk),
2174
     .se  (se),
2175 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2176 95 fafa1971
     .so  ()
2177
);
2178
//
2179
// resum_err_head
2180 113 albert.wat
dff_s dff_resum_err_head_rw_g (
2181 95 fafa1971
     .din (resum_err_head_rw_m),
2182
     .q   (resum_err_head_rw_g),
2183
     .clk (clk),
2184
     .se  (se),
2185 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2186 95 fafa1971
     .so  ()
2187
);
2188
//
2189
// nresum_err_head
2190 113 albert.wat
dff_s dff_nresum_err_head_rw_g (
2191 95 fafa1971
     .din (nresum_err_head_rw_m),
2192
     .q   (nresum_err_head_rw_g),
2193
     .clk (clk),
2194
     .se  (se),
2195 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2196 95 fafa1971
     .so  ()
2197
);
2198
// 
2199
// cpu_mondo_tail
2200
//
2201 113 albert.wat
dff_s dff_cpu_mondo_tail_rw_g (
2202 95 fafa1971
     .din (cpu_mondo_tail_rw_m),
2203
     .q   (cpu_mondo_tail_rw_g),
2204
     .clk (clk),
2205
     .se  (se),
2206 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2207 95 fafa1971
     .so  ()
2208
);
2209
//
2210
// dev_mondo_tail
2211
//
2212 113 albert.wat
dff_s dff_dev_mondo_tail_rw_g (
2213 95 fafa1971
     .din (dev_mondo_tail_rw_m),
2214
     .q   (dev_mondo_tail_rw_g),
2215
     .clk (clk),
2216
     .se  (se),
2217 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2218 95 fafa1971
     .so  ()
2219
);
2220
//
2221
// resum_err_tail
2222
//
2223 113 albert.wat
dff_s dff_resum_err_tail_rw_g (
2224 95 fafa1971
     .din (resum_err_tail_rw_m),
2225
     .q   (resum_err_tail_rw_g),
2226
     .clk (clk),
2227
     .se  (se),
2228 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2229 95 fafa1971
     .so  ()
2230
);
2231
//
2232
// nresum_err_tail
2233
//
2234 113 albert.wat
dff_s dff_nresum_err_tail_rw_g (
2235 95 fafa1971
     .din (nresum_err_tail_rw_m),
2236
     .q   (nresum_err_tail_rw_g),
2237
     .clk (clk),
2238
     .se  (se),
2239 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2240 95 fafa1971
     .so  ()
2241
);
2242
// 
2243
// generating thread specific read and write enables  
2244
//
2245
// cpu_mondo_head read
2246
// assign cpu_mondo_head_rd_g[0] = 
2247
//            asi_queue_read_g & cpu_mondo_head_rw_g & 
2248
//            asi_queue_rw_g   & thread_sel_id_g[0];
2249
assign cpu_mondo_head_rd_g[0] =
2250
           ~(|cpu_mondo_head_rd_g[3:1]);
2251
assign cpu_mondo_head_rd_g[1] =
2252
           asi_queue_read_g & cpu_mondo_head_rw_g &
2253
           asi_queue_rw_g   & thread_sel_id_g[1];
2254
assign cpu_mondo_head_rd_g[2] =
2255
           asi_queue_read_g & cpu_mondo_head_rw_g &
2256
           asi_queue_rw_g   & thread_sel_id_g[2];
2257
assign cpu_mondo_head_rd_g[3] =
2258
           asi_queue_read_g & cpu_mondo_head_rw_g &
2259
           asi_queue_rw_g   & thread_sel_id_g[3];
2260
//
2261
// non-thread specific read
2262
assign cpu_mondo_hd_rd_g =
2263
           asi_queue_read_g & cpu_mondo_head_rw_g &
2264
           asi_queue_rw_g;
2265
// 
2266
// cpu_mondo_head write 
2267
//
2268
assign cpu_mondo_head_wr_g[0] =
2269
           ~local_flush_all_w & asi_queue_write_uf_g & cpu_mondo_head_rw_g &
2270
           asi_queue_rw_g & thread_sel_id_g[0];
2271
assign cpu_mondo_head_wr_g[1] =
2272
           ~local_flush_all_w & asi_queue_write_uf_g & cpu_mondo_head_rw_g &
2273
           asi_queue_rw_g & thread_sel_id_g[1];
2274
assign cpu_mondo_head_wr_g[2] =
2275
           ~local_flush_all_w & asi_queue_write_uf_g & cpu_mondo_head_rw_g &
2276
           asi_queue_rw_g & thread_sel_id_g[2];
2277
assign cpu_mondo_head_wr_g[3] =
2278
           ~local_flush_all_w & asi_queue_write_uf_g & cpu_mondo_head_rw_g &
2279
           asi_queue_rw_g & thread_sel_id_g[3];
2280
//
2281
// cpu_mondo_tail read
2282
// assign cpu_mondo_tail_rd_g[0] = 
2283
//            asi_queue_read_g & cpu_mondo_tail_rw_g & 
2284
//            asi_queue_rw_g   & thread_sel_id_g[0];
2285
assign cpu_mondo_tail_rd_g[0] =
2286
           ~(|cpu_mondo_tail_rd_g[3:1]);
2287
assign cpu_mondo_tail_rd_g[1] =
2288
           asi_queue_read_g & cpu_mondo_tail_rw_g &
2289
           asi_queue_rw_g   & thread_sel_id_g[1];
2290
assign cpu_mondo_tail_rd_g[2] =
2291
           asi_queue_read_g & cpu_mondo_tail_rw_g &
2292
           asi_queue_rw_g   & thread_sel_id_g[2];
2293
assign cpu_mondo_tail_rd_g[3] =
2294
           asi_queue_read_g & cpu_mondo_tail_rw_g &
2295
           asi_queue_rw_g   & thread_sel_id_g[3];
2296
//
2297
// non-thread specific read
2298
assign cpu_mondo_ta_rd_g =
2299
           asi_queue_read_g & cpu_mondo_tail_rw_g &
2300
           asi_queue_rw_g;
2301
// 
2302
// cpu_mondo_tail write 
2303
// 
2304
assign cpu_mondo_tail_wr_g[0] =
2305
           ~local_flush_all_w & asi_queue_write_uf_g & cpu_mondo_tail_rw_g &
2306
           asi_queue_rw_g & thread_sel_id_g[0];
2307
assign cpu_mondo_tail_wr_g[1] =
2308
           ~local_flush_all_w & asi_queue_write_uf_g & cpu_mondo_tail_rw_g &
2309
           asi_queue_rw_g & thread_sel_id_g[1];
2310
assign cpu_mondo_tail_wr_g[2] =
2311
           ~local_flush_all_w & asi_queue_write_uf_g & cpu_mondo_tail_rw_g &
2312
           asi_queue_rw_g & thread_sel_id_g[2];
2313
assign cpu_mondo_tail_wr_g[3] =
2314
           ~local_flush_all_w & asi_queue_write_uf_g & cpu_mondo_tail_rw_g &
2315
           asi_queue_rw_g & thread_sel_id_g[3];
2316
//
2317
// dev_mondo_head read
2318
// assign dev_mondo_head_rd_g[0] = 
2319
//            asi_queue_read_g & dev_mondo_head_rw_g & 
2320
//            asi_queue_rw_g   & thread_sel_id_g[0];
2321
assign dev_mondo_head_rd_g[0] =
2322
           ~(|dev_mondo_head_rd_g[3:1]);
2323
assign dev_mondo_head_rd_g[1] =
2324
           asi_queue_read_g & dev_mondo_head_rw_g &
2325
           asi_queue_rw_g   & thread_sel_id_g[1];
2326
assign dev_mondo_head_rd_g[2] =
2327
           asi_queue_read_g & dev_mondo_head_rw_g &
2328
           asi_queue_rw_g   & thread_sel_id_g[2];
2329
assign dev_mondo_head_rd_g[3] =
2330
           asi_queue_read_g & dev_mondo_head_rw_g &
2331
           asi_queue_rw_g   & thread_sel_id_g[3];
2332
//
2333
// non-thread specific read
2334
assign dev_mondo_hd_rd_g =
2335
           asi_queue_read_g & dev_mondo_head_rw_g &
2336
           asi_queue_rw_g;
2337
// 
2338
// dev_mondo_head write 
2339
//
2340
assign dev_mondo_head_wr_g[0] =
2341
           ~local_flush_all_w & asi_queue_write_uf_g & dev_mondo_head_rw_g &
2342
           asi_queue_rw_g & thread_sel_id_g[0];
2343
assign dev_mondo_head_wr_g[1] =
2344
           ~local_flush_all_w & asi_queue_write_uf_g & dev_mondo_head_rw_g &
2345
           asi_queue_rw_g & thread_sel_id_g[1];
2346
assign dev_mondo_head_wr_g[2] =
2347
           ~local_flush_all_w & asi_queue_write_uf_g & dev_mondo_head_rw_g &
2348
           asi_queue_rw_g & thread_sel_id_g[2];
2349
assign dev_mondo_head_wr_g[3] =
2350
           ~local_flush_all_w & asi_queue_write_uf_g & dev_mondo_head_rw_g &
2351
           asi_queue_rw_g & thread_sel_id_g[3];
2352
//
2353
// dev_mondo_tail read
2354
// assign dev_mondo_tail_rd_g[0] = 
2355
//            asi_queue_read_g & dev_mondo_tail_rw_g & 
2356
//            asi_queue_rw_g   & thread_sel_id_g[0];
2357
assign dev_mondo_tail_rd_g[0] =
2358
           ~(|dev_mondo_tail_rd_g[3:1]);
2359
assign dev_mondo_tail_rd_g[1] =
2360
           asi_queue_read_g & dev_mondo_tail_rw_g &
2361
           asi_queue_rw_g   & thread_sel_id_g[1];
2362
assign dev_mondo_tail_rd_g[2] =
2363
           asi_queue_read_g & dev_mondo_tail_rw_g &
2364
           asi_queue_rw_g   & thread_sel_id_g[2];
2365
assign dev_mondo_tail_rd_g[3] =
2366
           asi_queue_read_g & dev_mondo_tail_rw_g &
2367
           asi_queue_rw_g   & thread_sel_id_g[3];
2368
//
2369
// non-thread specific read
2370
assign dev_mondo_ta_rd_g =
2371
           asi_queue_read_g & dev_mondo_tail_rw_g &
2372
           asi_queue_rw_g;
2373
// 
2374
// dev_mondo_tail write 
2375
// 
2376
assign dev_mondo_tail_wr_g[0] =
2377
           ~local_flush_all_w & asi_queue_write_uf_g & dev_mondo_tail_rw_g &
2378
           asi_queue_rw_g & thread_sel_id_g[0];
2379
assign dev_mondo_tail_wr_g[1] =
2380
           ~local_flush_all_w & asi_queue_write_uf_g & dev_mondo_tail_rw_g &
2381
           asi_queue_rw_g & thread_sel_id_g[1];
2382
assign dev_mondo_tail_wr_g[2] =
2383
           ~local_flush_all_w & asi_queue_write_uf_g & dev_mondo_tail_rw_g &
2384
           asi_queue_rw_g & thread_sel_id_g[2];
2385
assign dev_mondo_tail_wr_g[3] =
2386
           ~local_flush_all_w & asi_queue_write_uf_g & dev_mondo_tail_rw_g &
2387
           asi_queue_rw_g & thread_sel_id_g[3];
2388
//
2389
// resum_err_head read
2390
// assign resum_err_head_rd_g[0] = 
2391
//            asi_queue_read_g & resum_err_head_rw_g & 
2392
//            asi_queue_rw_g   & thread_sel_id_g[0];
2393
assign resum_err_head_rd_g[0] =
2394
           ~(|resum_err_head_rd_g[3:1]);
2395
assign resum_err_head_rd_g[1] =
2396
           asi_queue_read_g & resum_err_head_rw_g &
2397
           asi_queue_rw_g   & thread_sel_id_g[1];
2398
assign resum_err_head_rd_g[2] =
2399
           asi_queue_read_g & resum_err_head_rw_g &
2400
           asi_queue_rw_g   & thread_sel_id_g[2];
2401
assign resum_err_head_rd_g[3] =
2402
           asi_queue_read_g & resum_err_head_rw_g &
2403
           asi_queue_rw_g   & thread_sel_id_g[3];
2404
//
2405
// non-thread specific read
2406
assign resum_err_hd_rd_g =
2407
           asi_queue_read_g & resum_err_head_rw_g &
2408
           asi_queue_rw_g;
2409
// 
2410
// resum_err_head write 
2411
//
2412
assign resum_err_head_wr_g[0] =
2413
           asi_queue_write_g & resum_err_head_rw_g &
2414
           asi_queue_rw_g    & thread_sel_id_g[0];
2415
assign resum_err_head_wr_g[1] =
2416
           asi_queue_write_g & resum_err_head_rw_g &
2417
           asi_queue_rw_g    & thread_sel_id_g[1];
2418
assign resum_err_head_wr_g[2] =
2419
           asi_queue_write_g & resum_err_head_rw_g &
2420
           asi_queue_rw_g    & thread_sel_id_g[2];
2421
assign resum_err_head_wr_g[3] =
2422
           asi_queue_write_g & resum_err_head_rw_g &
2423
           asi_queue_rw_g    & thread_sel_id_g[3];
2424
//
2425
// resum_err_tail read
2426
// assign resum_err_tail_rd_g[0] = 
2427
//            asi_queue_read_g & resum_err_tail_rw_g & 
2428
//            asi_queue_rw_g   & thread_sel_id_g[0];
2429
assign resum_err_tail_rd_g[0] =
2430
           ~(|resum_err_tail_rd_g[3:1]);
2431
assign resum_err_tail_rd_g[1] =
2432
           asi_queue_read_g & resum_err_tail_rw_g &
2433
           asi_queue_rw_g   & thread_sel_id_g[1];
2434
assign resum_err_tail_rd_g[2] =
2435
           asi_queue_read_g & resum_err_tail_rw_g &
2436
           asi_queue_rw_g   & thread_sel_id_g[2];
2437
assign resum_err_tail_rd_g[3] =
2438
           asi_queue_read_g & resum_err_tail_rw_g &
2439
           asi_queue_rw_g   & thread_sel_id_g[3];
2440
//
2441
// non-thread specific read
2442
assign resum_err_ta_rd_g =
2443
           asi_queue_read_g & resum_err_tail_rw_g &
2444
           asi_queue_rw_g;
2445
// 
2446
// resum_err_tail write 
2447
// 
2448
assign resum_err_tail_wr_g[0] =
2449
           asi_queue_write_g & resum_err_tail_rw_g &
2450
           asi_queue_rw_g    & thread_sel_id_g[0];
2451
assign resum_err_tail_wr_g[1] =
2452
           asi_queue_write_g & resum_err_tail_rw_g &
2453
           asi_queue_rw_g    & thread_sel_id_g[1];
2454
assign resum_err_tail_wr_g[2] =
2455
           asi_queue_write_g & resum_err_tail_rw_g &
2456
           asi_queue_rw_g    & thread_sel_id_g[2];
2457
assign resum_err_tail_wr_g[3] =
2458
           asi_queue_write_g & resum_err_tail_rw_g &
2459
           asi_queue_rw_g    & thread_sel_id_g[3];
2460
//
2461
// nresum_err_head read
2462
// assign nresum_err_head_rd_g[0] = 
2463
//            asi_queue_read_g & nresum_err_head_rw_g & 
2464
//            asi_queue_rw_g   & thread_sel_id_g[0];
2465
assign nresum_err_head_rd_g[0] =
2466
           ~(|nresum_err_head_rd_g[3:1]);
2467
assign nresum_err_head_rd_g[1] =
2468
           asi_queue_read_g & nresum_err_head_rw_g &
2469
           asi_queue_rw_g   & thread_sel_id_g[1];
2470
assign nresum_err_head_rd_g[2] =
2471
           asi_queue_read_g & nresum_err_head_rw_g &
2472
           asi_queue_rw_g   & thread_sel_id_g[2];
2473
assign nresum_err_head_rd_g[3] =
2474
           asi_queue_read_g & nresum_err_head_rw_g &
2475
           asi_queue_rw_g   & thread_sel_id_g[3];
2476
//
2477
// non-thread specific read
2478
assign nresum_err_hd_rd_g =
2479
           asi_queue_read_g & nresum_err_head_rw_g &
2480
           asi_queue_rw_g;
2481
// 
2482
// nresum_err_head write 
2483
//
2484
assign nresum_err_head_wr_g[0] =
2485
           asi_queue_write_g & nresum_err_head_rw_g &
2486
           asi_queue_rw_g    & thread_sel_id_g[0];
2487
assign nresum_err_head_wr_g[1] =
2488
           asi_queue_write_g & nresum_err_head_rw_g &
2489
           asi_queue_rw_g    & thread_sel_id_g[1];
2490
assign nresum_err_head_wr_g[2] =
2491
           asi_queue_write_g & nresum_err_head_rw_g &
2492
           asi_queue_rw_g    & thread_sel_id_g[2];
2493
assign nresum_err_head_wr_g[3] =
2494
           asi_queue_write_g & nresum_err_head_rw_g &
2495
           asi_queue_rw_g    & thread_sel_id_g[3];
2496
//
2497
// nresum_err_tail read
2498
// assign nresum_err_tail_rd_g[0] = 
2499
//            asi_queue_read_g & nresum_err_tail_rw_g & 
2500
//            asi_queue_rw_g   & thread_sel_id_g[0];
2501
assign nresum_err_tail_rd_g[0] =
2502
           ~(|nresum_err_tail_rd_g[3:1]);
2503
assign nresum_err_tail_rd_g[1] =
2504
           asi_queue_read_g & nresum_err_tail_rw_g &
2505
           asi_queue_rw_g   & thread_sel_id_g[1];
2506
assign nresum_err_tail_rd_g[2] =
2507
           asi_queue_read_g & nresum_err_tail_rw_g &
2508
           asi_queue_rw_g   & thread_sel_id_g[2];
2509
assign nresum_err_tail_rd_g[3] =
2510
           asi_queue_read_g & nresum_err_tail_rw_g &
2511
           asi_queue_rw_g   & thread_sel_id_g[3];
2512
//
2513
// non-thread specific read
2514
assign nresum_err_ta_rd_g =
2515
           asi_queue_read_g & nresum_err_tail_rw_g &
2516
           asi_queue_rw_g;
2517
// 
2518
// nresum_err_tail write 
2519
// 
2520
assign nresum_err_tail_wr_g[0] =
2521
           asi_queue_write_g & nresum_err_tail_rw_g &
2522
           asi_queue_rw_g    & thread_sel_id_g[0];
2523
assign nresum_err_tail_wr_g[1] =
2524
           asi_queue_write_g & nresum_err_tail_rw_g &
2525
           asi_queue_rw_g    & thread_sel_id_g[1];
2526
assign nresum_err_tail_wr_g[2] =
2527
           asi_queue_write_g & nresum_err_tail_rw_g &
2528
           asi_queue_rw_g    & thread_sel_id_g[2];
2529
assign nresum_err_tail_wr_g[3] =
2530
           asi_queue_write_g & nresum_err_tail_rw_g &
2531
           asi_queue_rw_g    & thread_sel_id_g[3];
2532
//
2533
// storing the head and pointers for the queues
2534
// thread 0
2535
//
2536 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_cpu_mondo0_head (
2537
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2538
     .q   (cpu_mondo0_head[`TLU_ASI_QUE_WIDTH-1:0]),
2539 95 fafa1971
     .en  (cpu_mondo_head_wr_g[0]),
2540
     .clk (clk),
2541
     .se  (se),
2542 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2543 95 fafa1971
     .so  ()
2544
);
2545
 
2546 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_cpu_mondo0_tail (
2547
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2548
     .q   (cpu_mondo0_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2549 95 fafa1971
     .en  (cpu_mondo_tail_wr_g[0]),
2550
     .clk (clk),
2551
     .se  (se),
2552 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2553 95 fafa1971
     .so  ()
2554
);
2555
 
2556 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_dev_mondo0_head (
2557
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2558
     .q   (dev_mondo0_head[`TLU_ASI_QUE_WIDTH-1:0]),
2559 95 fafa1971
     .en  (dev_mondo_head_wr_g[0]),
2560
     .clk (clk),
2561
     .se  (se),
2562 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2563 95 fafa1971
     .so  ()
2564
);
2565
 
2566 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_dev_mondo0_tail (
2567
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2568
     .q   (dev_mondo0_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2569 95 fafa1971
     .en  (dev_mondo_tail_wr_g[0]),
2570
     .clk (clk),
2571
     .se  (se),
2572 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2573 95 fafa1971
     .so  ()
2574
);
2575
 
2576 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_resum_err0_head (
2577
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2578
     .q   (resum_err0_head[`TLU_ASI_QUE_WIDTH-1:0]),
2579 95 fafa1971
     .en  (resum_err_head_wr_g[0]),
2580
     .clk (clk),
2581
     .se  (se),
2582 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2583 95 fafa1971
     .so  ()
2584
);
2585
 
2586 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_resum_err0_tail (
2587
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2588
     .q   (resum_err0_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2589 95 fafa1971
     .en  (resum_err_tail_wr_g[0]),
2590
     .clk (clk),
2591
     .se  (se),
2592 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2593 95 fafa1971
     .so  ()
2594
);
2595
 
2596 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_nresum_err0_head (
2597
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2598
     .q   (nresum_err0_head[`TLU_ASI_QUE_WIDTH-1:0]),
2599 95 fafa1971
     .en  (nresum_err_head_wr_g[0]),
2600
     .clk (clk),
2601
     .se  (se),
2602 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2603 95 fafa1971
     .so  ()
2604
);
2605
 
2606 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_nresum_err0_tail (
2607
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2608
     .q   (nresum_err0_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2609 95 fafa1971
     .en  (nresum_err_tail_wr_g[0]),
2610
     .clk (clk),
2611
     .se  (se),
2612 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2613 95 fafa1971
     .so  ()
2614
);
2615
//
2616
// thread 1
2617
//
2618 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_cpu_mondo1_head (
2619
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2620
     .q   (cpu_mondo1_head[`TLU_ASI_QUE_WIDTH-1:0]),
2621 95 fafa1971
     .en  (cpu_mondo_head_wr_g[1]),
2622
     .clk (clk),
2623
     .se  (se),
2624 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2625 95 fafa1971
     .so  ()
2626
);
2627
 
2628 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_cpu_mondo1_tail (
2629
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2630
     .q   (cpu_mondo1_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2631 95 fafa1971
     .en  (cpu_mondo_tail_wr_g[1]),
2632
     .clk (clk),
2633
     .se  (se),
2634 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2635 95 fafa1971
     .so  ()
2636
);
2637
 
2638 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_dev_mondo1_head (
2639
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2640
     .q   (dev_mondo1_head[`TLU_ASI_QUE_WIDTH-1:0]),
2641 95 fafa1971
     .en  (dev_mondo_head_wr_g[1]),
2642
     .clk (clk),
2643
     .se  (se),
2644 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2645 95 fafa1971
     .so  ()
2646
);
2647
 
2648 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_dev_mondo1_tail (
2649
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2650
     .q   (dev_mondo1_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2651 95 fafa1971
     .en  (dev_mondo_tail_wr_g[1]),
2652
     .clk (clk),
2653
     .se  (se),
2654 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2655 95 fafa1971
     .so  ()
2656
);
2657
 
2658 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_resum_err1_head (
2659
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2660
     .q   (resum_err1_head[`TLU_ASI_QUE_WIDTH-1:0]),
2661 95 fafa1971
     .en  (resum_err_head_wr_g[1]),
2662
     .clk (clk),
2663
     .se  (se),
2664 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2665 95 fafa1971
     .so  ()
2666
);
2667
 
2668 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_resum_err1_tail (
2669
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2670
     .q   (resum_err1_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2671 95 fafa1971
     .en  (resum_err_tail_wr_g[1]),
2672
     .clk (clk),
2673
     .se  (se),
2674 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2675 95 fafa1971
     .so  ()
2676
);
2677
 
2678 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_nresum_err1_head (
2679
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2680
     .q   (nresum_err1_head[`TLU_ASI_QUE_WIDTH-1:0]),
2681 95 fafa1971
     .en  (nresum_err_head_wr_g[1]),
2682
     .clk (clk),
2683
     .se  (se),
2684 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2685 95 fafa1971
     .so  ()
2686
);
2687
 
2688 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_nresum_err1_tail (
2689
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2690
     .q   (nresum_err1_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2691 95 fafa1971
     .en  (nresum_err_tail_wr_g[1]),
2692
     .clk (clk),
2693
     .se  (se),
2694 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2695 95 fafa1971
     .so  ()
2696
);
2697
//
2698
// thread 2
2699
//
2700 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_cpu_mondo2_head (
2701
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2702
     .q   (cpu_mondo2_head[`TLU_ASI_QUE_WIDTH-1:0]),
2703 95 fafa1971
     .en  (cpu_mondo_head_wr_g[2]),
2704
     .clk (clk),
2705
     .se  (se),
2706 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2707 95 fafa1971
     .so  ()
2708
);
2709
 
2710 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_cpu_mondo2_tail (
2711
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2712
     .q   (cpu_mondo2_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2713 95 fafa1971
     .en  (cpu_mondo_tail_wr_g[2]),
2714
     .clk (clk),
2715
     .se  (se),
2716 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2717 95 fafa1971
     .so  ()
2718
);
2719
 
2720 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_dev_mondo2_head (
2721
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2722
     .q   (dev_mondo2_head[`TLU_ASI_QUE_WIDTH-1:0]),
2723 95 fafa1971
     .en  (dev_mondo_head_wr_g[2]),
2724
     .clk (clk),
2725
     .se  (se),
2726 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2727 95 fafa1971
     .so  ()
2728
);
2729
 
2730 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_dev_mondo2_tail (
2731
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2732
     .q   (dev_mondo2_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2733 95 fafa1971
     .en  (dev_mondo_tail_wr_g[2]),
2734
     .clk (clk),
2735
     .se  (se),
2736 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2737 95 fafa1971
     .so  ()
2738
);
2739
 
2740 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_resum_err2_head (
2741
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2742
     .q   (resum_err2_head[`TLU_ASI_QUE_WIDTH-1:0]),
2743 95 fafa1971
     .en  (resum_err_head_wr_g[2]),
2744
     .clk (clk),
2745
     .se  (se),
2746 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2747 95 fafa1971
     .so  ()
2748
);
2749
 
2750 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_resum_err2_tail (
2751
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2752
     .q   (resum_err2_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2753 95 fafa1971
     .en  (resum_err_tail_wr_g[2]),
2754
     .clk (clk),
2755
     .se  (se),
2756 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2757 95 fafa1971
     .so  ()
2758
);
2759
 
2760 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_nresum_err2_head (
2761
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2762
     .q   (nresum_err2_head[`TLU_ASI_QUE_WIDTH-1:0]),
2763 95 fafa1971
     .en  (nresum_err_head_wr_g[2]),
2764
     .clk (clk),
2765
     .se  (se),
2766 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2767 95 fafa1971
     .so  ()
2768
);
2769
 
2770 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_nresum_err2_tail (
2771
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2772
     .q   (nresum_err2_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2773 95 fafa1971
     .en  (nresum_err_tail_wr_g[2]),
2774
     .clk (clk),
2775
     .se  (se),
2776 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2777 95 fafa1971
     .so  ()
2778
);
2779
//
2780
// thread 3
2781
//
2782 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_cpu_mondo3_head (
2783
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2784
     .q   (cpu_mondo3_head[`TLU_ASI_QUE_WIDTH-1:0]),
2785 95 fafa1971
     .en  (cpu_mondo_head_wr_g[3]),
2786
     .clk (clk),
2787
     .se  (se),
2788 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2789 95 fafa1971
     .so  ()
2790
);
2791
 
2792 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_cpu_mondo3_tail (
2793
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2794
     .q   (cpu_mondo3_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2795 95 fafa1971
     .en  (cpu_mondo_tail_wr_g[3]),
2796
     .clk (clk),
2797
     .se  (se),
2798 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2799 95 fafa1971
     .so  ()
2800
);
2801
 
2802 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_dev_mondo3_head (
2803
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2804
     .q   (dev_mondo3_head[`TLU_ASI_QUE_WIDTH-1:0]),
2805 95 fafa1971
     .en  (dev_mondo_head_wr_g[3]),
2806
     .clk (clk),
2807
     .se  (se),
2808 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2809 95 fafa1971
     .so  ()
2810
);
2811
 
2812 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_dev_mondo3_tail (
2813
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2814
     .q   (dev_mondo3_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2815 95 fafa1971
     .en  (dev_mondo_tail_wr_g[3]),
2816
     .clk (clk),
2817
     .se  (se),
2818 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2819 95 fafa1971
     .so  ()
2820
);
2821
 
2822 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_resum_err3_head (
2823
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2824
     .q   (resum_err3_head[`TLU_ASI_QUE_WIDTH-1:0]),
2825 95 fafa1971
     .en  (resum_err_head_wr_g[3]),
2826
     .clk (clk),
2827
     .se  (se),
2828 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2829 95 fafa1971
     .so  ()
2830
);
2831
 
2832 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_resum_err3_tail (
2833
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2834
     .q   (resum_err3_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2835 95 fafa1971
     .en  (resum_err_tail_wr_g[3]),
2836
     .clk (clk),
2837
     .se  (se),
2838 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2839 95 fafa1971
     .so  ()
2840
);
2841
 
2842 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_nresum_err3_head (
2843
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2844
     .q   (nresum_err3_head[`TLU_ASI_QUE_WIDTH-1:0]),
2845 95 fafa1971
     .en  (nresum_err_head_wr_g[3]),
2846
     .clk (clk),
2847
     .se  (se),
2848 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2849 95 fafa1971
     .so  ()
2850
);
2851
 
2852 113 albert.wat
dffe_s #(`TLU_ASI_QUE_WIDTH) dffe_nresum_err3_tail (
2853
     .din (tlu_asi_queue_data_g[`TLU_ASI_QUE_WIDTH-1:0]),
2854
     .q   (nresum_err3_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2855 95 fafa1971
     .en  (nresum_err_tail_wr_g[3]),
2856
     .clk (clk),
2857
     .se  (se),
2858 113 albert.wat
     `SIMPLY_RISC_SCANIN,
2859 95 fafa1971
     .so  ()
2860
);
2861
//
2862
// reading out the asi queues 
2863
// 
2864
// added for bug2332
2865
// assign cpu_mondo_hd_onehot_g = 
2866
//            ~(|cpu_mondo_head_rd_g[3:1]);
2867
// cpu_mondo_head
2868 113 albert.wat
mux4ds #(`TLU_ASI_QUE_WIDTH) mx_cpu_mondo_head (
2869
    .in0  (cpu_mondo0_head[`TLU_ASI_QUE_WIDTH-1:0]),
2870
    .in1  (cpu_mondo1_head[`TLU_ASI_QUE_WIDTH-1:0]),
2871
    .in2  (cpu_mondo2_head[`TLU_ASI_QUE_WIDTH-1:0]),
2872
    .in3  (cpu_mondo3_head[`TLU_ASI_QUE_WIDTH-1:0]),
2873 95 fafa1971
    .sel0 (cpu_mondo_head_rd_g[0]),
2874
    .sel1 (cpu_mondo_head_rd_g[1]),
2875
    .sel2 (cpu_mondo_head_rd_g[2]),
2876
    .sel3 (cpu_mondo_head_rd_g[3]),
2877 113 albert.wat
    .dout (cpu_mondo_hd_rdata[`TLU_ASI_QUE_WIDTH-1:0])
2878 95 fafa1971
);
2879
//
2880
// added for bug2332
2881
// assign cpu_mondo_ta_onehot_g = 
2882
//            ~(|cpu_mondo_tail_rd_g[3:1]);
2883
// cpu_mondo_tail
2884 113 albert.wat
mux4ds #(`TLU_ASI_QUE_WIDTH) mx_cpu_mondo_tail (
2885
    .in0  (cpu_mondo0_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2886
    .in1  (cpu_mondo1_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2887
    .in2  (cpu_mondo2_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2888
    .in3  (cpu_mondo3_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2889 95 fafa1971
    .sel0 (cpu_mondo_tail_rd_g[0]),
2890
    .sel1 (cpu_mondo_tail_rd_g[1]),
2891
    .sel2 (cpu_mondo_tail_rd_g[2]),
2892
    .sel3 (cpu_mondo_tail_rd_g[3]),
2893 113 albert.wat
    .dout (cpu_mondo_ta_rdata[`TLU_ASI_QUE_WIDTH-1:0])
2894 95 fafa1971
);
2895
//
2896
// added for bug2332
2897
// assign dev_mondo_hd_onehot_g = 
2898
//            ~(|dev_mondo_head_rd_g[3:1]);
2899
// dev_mondo_head
2900 113 albert.wat
mux4ds #(`TLU_ASI_QUE_WIDTH) mx_dev_mondo_head (
2901
    .in0  (dev_mondo0_head[`TLU_ASI_QUE_WIDTH-1:0]),
2902
    .in1  (dev_mondo1_head[`TLU_ASI_QUE_WIDTH-1:0]),
2903
    .in2  (dev_mondo2_head[`TLU_ASI_QUE_WIDTH-1:0]),
2904
    .in3  (dev_mondo3_head[`TLU_ASI_QUE_WIDTH-1:0]),
2905 95 fafa1971
    .sel0 (dev_mondo_head_rd_g[0]),
2906
    .sel1 (dev_mondo_head_rd_g[1]),
2907
    .sel2 (dev_mondo_head_rd_g[2]),
2908
    .sel3 (dev_mondo_head_rd_g[3]),
2909 113 albert.wat
    .dout (dev_mondo_hd_rdata[`TLU_ASI_QUE_WIDTH-1:0])
2910 95 fafa1971
);
2911
//
2912
// added for bug2332
2913
// assign dev_mondo_ta_onehot_g = 
2914
//            ~(|dev_mondo_tail_rd_g[3:1]);
2915
// dev_mondo_tail
2916 113 albert.wat
mux4ds #(`TLU_ASI_QUE_WIDTH) mx_dev_mondo_tail (
2917
    .in0  (dev_mondo0_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2918
    .in1  (dev_mondo1_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2919
    .in2  (dev_mondo2_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2920
    .in3  (dev_mondo3_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2921 95 fafa1971
    .sel0 (dev_mondo_tail_rd_g[0]),
2922
    .sel1 (dev_mondo_tail_rd_g[1]),
2923
    .sel2 (dev_mondo_tail_rd_g[2]),
2924
    .sel3 (dev_mondo_tail_rd_g[3]),
2925 113 albert.wat
    .dout (dev_mondo_ta_rdata[`TLU_ASI_QUE_WIDTH-1:0])
2926 95 fafa1971
);
2927
//
2928
// added for bug2332
2929
// assign resum_err_hd_onehot_g = 
2930
//            ~(|resum_err_head_rd_g[3:1]);
2931
// resum_err_head
2932 113 albert.wat
mux4ds #(`TLU_ASI_QUE_WIDTH) mx_resum_err_head (
2933
    .in0  (resum_err0_head[`TLU_ASI_QUE_WIDTH-1:0]),
2934
    .in1  (resum_err1_head[`TLU_ASI_QUE_WIDTH-1:0]),
2935
    .in2  (resum_err2_head[`TLU_ASI_QUE_WIDTH-1:0]),
2936
    .in3  (resum_err3_head[`TLU_ASI_QUE_WIDTH-1:0]),
2937 95 fafa1971
    .sel0 (resum_err_head_rd_g[0]),
2938
    .sel1 (resum_err_head_rd_g[1]),
2939
    .sel2 (resum_err_head_rd_g[2]),
2940
    .sel3 (resum_err_head_rd_g[3]),
2941 113 albert.wat
    .dout (resum_err_hd_rdata[`TLU_ASI_QUE_WIDTH-1:0])
2942 95 fafa1971
);
2943
//
2944
// added for bug2332
2945
// assign resum_err_ta_onehot_g = 
2946
//            ~(|resum_err_tail_rd_g[3:1]);
2947
// resum_err_tail
2948 113 albert.wat
mux4ds #(`TLU_ASI_QUE_WIDTH) mx_resum_err_tail (
2949
    .in0  (resum_err0_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2950
    .in1  (resum_err1_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2951
    .in2  (resum_err2_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2952
    .in3  (resum_err3_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2953 95 fafa1971
    .sel0 (resum_err_tail_rd_g[0]),
2954
    .sel1 (resum_err_tail_rd_g[1]),
2955
    .sel2 (resum_err_tail_rd_g[2]),
2956
    .sel3 (resum_err_tail_rd_g[3]),
2957 113 albert.wat
    .dout (resum_err_ta_rdata[`TLU_ASI_QUE_WIDTH-1:0])
2958 95 fafa1971
);
2959
//
2960
// added for bug2332
2961
// assign nresum_err_hd_onehot_g = 
2962
//            ~(|nresum_err_head_rd_g[3:1]);
2963
// nresum_err_head
2964 113 albert.wat
mux4ds #(`TLU_ASI_QUE_WIDTH) mx_nresum_err_head (
2965
    .in0  (nresum_err0_head[`TLU_ASI_QUE_WIDTH-1:0]),
2966
    .in1  (nresum_err1_head[`TLU_ASI_QUE_WIDTH-1:0]),
2967
    .in2  (nresum_err2_head[`TLU_ASI_QUE_WIDTH-1:0]),
2968
    .in3  (nresum_err3_head[`TLU_ASI_QUE_WIDTH-1:0]),
2969 95 fafa1971
    .sel0 (nresum_err_head_rd_g[0]),
2970
    .sel1 (nresum_err_head_rd_g[1]),
2971
    .sel2 (nresum_err_head_rd_g[2]),
2972
    .sel3 (nresum_err_head_rd_g[3]),
2973 113 albert.wat
    .dout (nresum_err_hd_rdata[`TLU_ASI_QUE_WIDTH-1:0])
2974 95 fafa1971
);
2975
//
2976
// added for bug2332
2977
// assign nresum_err_ta_onehot_g = 
2978
//            ~(|nresum_err_tail_rd_g[3:1]);
2979
// nresum_err_tail
2980 113 albert.wat
mux4ds #(`TLU_ASI_QUE_WIDTH) mx_nresum_err_tail (
2981
    .in0  (nresum_err0_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2982
    .in1  (nresum_err1_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2983
    .in2  (nresum_err2_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2984
    .in3  (nresum_err3_tail[`TLU_ASI_QUE_WIDTH-1:0]),
2985 95 fafa1971
    .sel0 (nresum_err_tail_rd_g[0]),
2986
    .sel1 (nresum_err_tail_rd_g[1]),
2987
    .sel2 (nresum_err_tail_rd_g[2]),
2988
    .sel3 (nresum_err_tail_rd_g[3]),
2989 113 albert.wat
    .dout (nresum_err_ta_rdata[`TLU_ASI_QUE_WIDTH-1:0])
2990 95 fafa1971
);
2991
// 
2992
// added for bug 2332
2993
assign asi_qrdata_mx1_sel[0] = cpu_mondo_hd_rd_g |
2994
                               ~(|asi_qrdata_mx1_sel[3:1]);
2995
assign asi_qrdata_mx1_sel[1] = cpu_mondo_ta_rd_g;
2996
assign asi_qrdata_mx1_sel[2] = dev_mondo_hd_rd_g;
2997
assign asi_qrdata_mx1_sel[3] = dev_mondo_ta_rd_g;
2998
// 
2999
// selecting between the eight queues
3000 113 albert.wat
mux4ds #(`TLU_ASI_QUE_WIDTH) mx1_asi_queue_rdata (
3001
    .in0  (cpu_mondo_hd_rdata[`TLU_ASI_QUE_WIDTH-1:0]),
3002
    .in1  (cpu_mondo_ta_rdata[`TLU_ASI_QUE_WIDTH-1:0]),
3003
    .in2  (dev_mondo_hd_rdata[`TLU_ASI_QUE_WIDTH-1:0]),
3004
    .in3  (dev_mondo_ta_rdata[`TLU_ASI_QUE_WIDTH-1:0]),
3005 95 fafa1971
    .sel0 (asi_qrdata_mx1_sel[0]),
3006
    .sel1 (asi_qrdata_mx1_sel[1]),
3007
    .sel2 (asi_qrdata_mx1_sel[2]),
3008
    .sel3 (asi_qrdata_mx1_sel[3]),
3009 113 albert.wat
    .dout (asi_queue_rdata1_g[`TLU_ASI_QUE_WIDTH-1:0])
3010 95 fafa1971
);
3011
// 
3012
// added for bug 2332
3013
assign asi_qrdata_mx2_sel[0] = resum_err_hd_rd_g |
3014
                               ~(|asi_qrdata_mx2_sel[3:1]);
3015
assign asi_qrdata_mx2_sel[1] = resum_err_ta_rd_g;
3016
assign asi_qrdata_mx2_sel[2] = nresum_err_hd_rd_g;
3017
assign asi_qrdata_mx2_sel[3] = nresum_err_ta_rd_g;
3018
 
3019 113 albert.wat
mux4ds #(`TLU_ASI_QUE_WIDTH) mx2_asi_queue_rdata (
3020
    .in0  (resum_err_hd_rdata[`TLU_ASI_QUE_WIDTH-1:0]),
3021
    .in1  (resum_err_ta_rdata[`TLU_ASI_QUE_WIDTH-1:0]),
3022
    .in2  (nresum_err_hd_rdata[`TLU_ASI_QUE_WIDTH-1:0]),
3023
    .in3  (nresum_err_ta_rdata[`TLU_ASI_QUE_WIDTH-1:0]),
3024 95 fafa1971
    .sel0 (asi_qrdata_mx2_sel[0]),
3025
    .sel1 (asi_qrdata_mx2_sel[1]),
3026
    .sel2 (asi_qrdata_mx2_sel[2]),
3027
    .sel3 (asi_qrdata_mx2_sel[3]),
3028 113 albert.wat
    .dout (asi_queue_rdata2_g[`TLU_ASI_QUE_WIDTH-1:0])
3029 95 fafa1971
);
3030
//
3031
// constructing the select for the final asi queue rdata output
3032
assign asi_qrdata_mx_sel2 =
3033
           resum_err_hd_rd_g  | resum_err_ta_rd_g |
3034
           nresum_err_hd_rd_g | nresum_err_ta_rd_g;
3035
//
3036 113 albert.wat
mux2ds #(`TLU_ASI_QUE_WIDTH) mx_tlu_asi_queue_rdata (
3037
    .in0  (asi_queue_rdata2_g[`TLU_ASI_QUE_WIDTH-1:0]),
3038
    .in1  (asi_queue_rdata1_g[`TLU_ASI_QUE_WIDTH-1:0]),
3039 95 fafa1971
    .sel0 (asi_qrdata_mx_sel2),
3040
    .sel1 (~asi_qrdata_mx_sel2),
3041 113 albert.wat
    .dout (tlu_asi_queue_rdata_g[`TLU_ASI_QUE_WIDTH-1:0])
3042 95 fafa1971
);
3043
//
3044
// forming the valid signal for the asi queue rdata
3045
assign tlu_asi_queue_rd_vld_g =
3046
       asi_qrdata_mx_sel2 | cpu_mondo_hd_rd_g | cpu_mondo_ta_rd_g |
3047
       dev_mondo_hd_rd_g  | dev_mondo_ta_rd_g;
3048
 
3049
assign tlu_ld_data_vld_g = asi_ld_addr_vld_g;
3050
 
3051
////////////////////////////////////////////////////////////////////////
3052
// SCPD and HSCPD control logic
3053
////////////////////////////////////////////////////////////////////////
3054
//
3055
// privileged scratch pad access
3056
assign asi_scpd_rw_e =
3057
           ifu_lsu_alt_space_e &
3058 113 albert.wat
          (tlu_asi_state_e[`TLU_ASI_STATE_WIDTH-1:0]==`PRI_SCPD_ASI_STATE);
3059 95 fafa1971
 
3060
// hyprivileged scratch pad access
3061
assign asi_hscpd_rw_e =
3062
           ifu_lsu_alt_space_e &
3063 113 albert.wat
          (tlu_asi_state_e[`TLU_ASI_STATE_WIDTH-1:0]==`HPRI_SCPD_ASI_STATE);
3064 95 fafa1971
//
3065
// staged the scpd/hscpd rw ctls
3066 113 albert.wat
dffr_s #(2) dffr_asi_scpd_rw_ctls (
3067 95 fafa1971
    .din ({asi_hscpd_rw_e, asi_scpd_rw_e}),
3068
    .q   ({asi_hscpd_rw_m, asi_scpd_rw_m}),
3069
    .rst (local_rst),
3070
    .clk (clk),
3071
    .se  (se),
3072 113 albert.wat
    `SIMPLY_RISC_SCANIN,
3073 95 fafa1971
    .so  ()
3074
);
3075
 
3076
// address generation
3077
//
3078
// modified due to timing fix  
3079
/*
3080
 assign scpd_addr_va_e[`SCPD_ASI_VA_ADDR_WIDTH-1:0] =
3081
            tlu_ldst_va_e[`TLU_ASI_SCPD_VA_HI:`TLU_ASI_SCPD_VA_LO];
3082
 
3083
 staged the shifted va address
3084
 modified due to timing fix
3085
 
3086 113 albert.wat
dff_s #(`SCPD_ASI_VA_ADDR_WIDTH) dff_scpd_addr_va_m (
3087 95 fafa1971
    .din (scpd_addr_va_e[`SCPD_ASI_VA_ADDR_WIDTH-1:0]),
3088
    .q   (scpd_addr_va_m[`SCPD_ASI_VA_ADDR_WIDTH-1:0]),
3089
    .clk (clk),
3090
    .se  (se),
3091 113 albert.wat
    `SIMPLY_RISC_SCANIN,
3092 95 fafa1971
    .so  ()
3093
);
3094
*/
3095
 
3096 113 albert.wat
assign scpd_addr_va_m[`SCPD_ASI_VA_ADDR_WIDTH-1:0] =
3097
            tlu_ldst_va_m[`TLU_ASI_SCPD_VA_HI:`TLU_ASI_SCPD_VA_LO];
3098 95 fafa1971
 
3099 113 albert.wat
dff_s #(`SCPD_ASI_VA_ADDR_WIDTH) dff_scpd_addr_va_g (
3100
    .din (scpd_addr_va_m[`SCPD_ASI_VA_ADDR_WIDTH-1:0]),
3101
    .q   (scpd_addr_va_g[`SCPD_ASI_VA_ADDR_WIDTH-1:0]),
3102 95 fafa1971
    .clk (clk),
3103
    .se  (se),
3104 113 albert.wat
    `SIMPLY_RISC_SCANIN,
3105 95 fafa1971
    .so  ()
3106
);
3107
 
3108 113 albert.wat
assign tlu_scpd_rd_addr_m[`SCPD_RW_ADDR_WIDTH-1:0] =
3109
           {thrid_m[1:0], scpd_addr_va_m[`SCPD_ASI_VA_ADDR_WIDTH-1:0]};
3110 95 fafa1971
 
3111 113 albert.wat
assign tlu_scpd_wr_addr_g[`SCPD_RW_ADDR_WIDTH-1:0] =
3112
           {thrid_g[1:0], scpd_addr_va_g[`SCPD_ASI_VA_ADDR_WIDTH-1:0]};
3113 95 fafa1971
//
3114
// illegal range check for scratch-pd va 
3115
// modified due to timing
3116
/*
3117
assign scpd_ill_va_e =
3118
           (ifu_lsu_alt_space_e)?
3119
           ((asi_scpd_rw_e | asi_hscpd_rw_e) &
3120
           ((|exu_lsu_ldst_va_e[`ASI_VA_WIDTH-1:`TLU_ASI_SCPD_VA_HI+1]) |
3121
            (|exu_lsu_ldst_va_e[`TLU_ASI_SCPD_VA_LO-1:0]))) :
3122
            1'b0;
3123
// staged illegal va range
3124 113 albert.wat
dffr_s dffr_scpd_ill_va_m (
3125 95 fafa1971
    .din (scpd_ill_va_e),
3126
    .q   (scpd_ill_va_m),
3127
    .rst (local_rst),
3128
    .clk (clk),
3129
    .se  (se),
3130 113 albert.wat
    `SIMPLY_RISC_SCANIN,
3131 95 fafa1971
    .so  ()
3132
);
3133
*/
3134
//
3135 113 albert.wat
assign va_not_baligned_m = (|tlu_ldst_va_m[`TLU_ASI_SCPD_VA_LO-1:0]);
3136 95 fafa1971
assign scpd_ill_va_m =
3137
           (asi_scpd_rw_m | asi_hscpd_rw_m) &
3138
            va_not_baligned_m;
3139
 
3140
// 
3141 113 albert.wat
dffr_s dffr_scpd_ill_va_g (
3142 95 fafa1971
    .din (scpd_ill_va_m),
3143
    .q   (scpd_ill_va_g),
3144
    .rst (local_rst),
3145
    .clk (clk),
3146
    .se  (se),
3147 113 albert.wat
    `SIMPLY_RISC_SCANIN,
3148 95 fafa1971
    .so  ()
3149
);
3150
//
3151
// generating read and write valid 
3152
assign asi_scpd_rw_vld_m =
3153
            (asi_scpd_rw_m | asi_hscpd_rw_m) &
3154
           ~(hscpd_data_acc_excpt_m | va_not_baligned_m);
3155
 
3156 113 albert.wat
dffr_s dffr_asi_scpd_rw_vld_g (
3157 95 fafa1971
    .din (asi_scpd_rw_vld_m),
3158
    .q   (asi_scpd_rw_vld_g),
3159
    .rst (local_rst),
3160
    .clk (clk),
3161
    .se  (se),
3162 113 albert.wat
    `SIMPLY_RISC_SCANIN,
3163 95 fafa1971
    .so  ()
3164
);
3165
 
3166
assign tlu_scpd_wr_vld_g =
3167
           asi_queue_write_g & asi_scpd_rw_vld_g;
3168
//
3169
// control to the memory macro for the read
3170
// modified due to timing 
3171
assign tlu_scpd_rd_vld_m =
3172
           // asi_queue_read_m & asi_scpd_rw_vld_m; 
3173
           asi_queue_read_pq_m & asi_scpd_rw_vld_m;
3174
//
3175
// control to the int block for the selection of read data 
3176
// replaced by queue vld
3177
// assign tlu_scpd_rd_vld_g = 
3178
//            asi_queue_read_g & asi_scpd_rw_vld_g; 
3179
 
3180
// decoding for hypervisor only scratch-pad
3181
assign hscpd_va_rw_m =
3182 113 albert.wat
          ((scpd_addr_va_m[`SCPD_ASI_VA_ADDR_WIDTH-1:0] ==
3183
            `HSCPD_ASI_VA_ADDR_LO) |
3184
           (scpd_addr_va_m[`SCPD_ASI_VA_ADDR_WIDTH-1:0] ==
3185
            `HSCPD_ASI_VA_ADDR_HI));
3186 95 fafa1971
 
3187
////////////////////////////////////////////////////////////////////////
3188
// Potential trap indicators 
3189
////////////////////////////////////////////////////////////////////////
3190
// possible traps are: 
3191
// 1) head ptr <> tail ptr (with the exception of nresum_err_queue)
3192
// 2) write to tail by supervisor - data_access_exception 
3193
 
3194
//
3195
// write to hypervisor scratch-pad using 0x20 ASI state
3196
 
3197
assign hscpd_priv_asi_acc_m =
3198
       hscpd_va_rw_m & asi_scpd_rw_m;
3199
 
3200
// modified due to timing - moved the inst_vld qualification to tlu_tcl
3201
assign hscpd_data_acc_excpt_pq_m =
3202
           hscpd_priv_asi_acc_m &
3203
           (asi_queue_write_pq_m | asi_queue_read_pq_m);
3204
/*
3205
           hscpd_priv_asi_acc_m &
3206
           // (asi_queue_write_m | asi_queue_read_m)  &
3207
           (asi_queue_write_pq_m | asi_queue_read_pq_m) &
3208
           ((thread_sel_id_m[0] & ~tlu_hyper_lite[0]) |
3209
            (thread_sel_id_m[1] & ~tlu_hyper_lite[1]) |
3210
            (thread_sel_id_m[2] & ~tlu_hyper_lite[2]) |
3211
            (thread_sel_id_m[3] & ~tlu_hyper_lite[3]));
3212
*/
3213
//
3214
// data_access_exception to access the hyper-privileged scratch-pad 
3215
 
3216
assign tlu_hscpd_dacc_excpt_m = hscpd_data_acc_excpt_pq_m;
3217
//
3218
// revised for bug 3586
3219
 
3220
assign hscpd_data_acc_excpt_m =
3221
           hscpd_data_acc_excpt_pq_m &
3222
           ((thread_sel_id_m[0] & ~tlu_hyper_lite[0]) |
3223
            (thread_sel_id_m[1] & ~tlu_hyper_lite[1]) |
3224
            (thread_sel_id_m[2] & ~tlu_hyper_lite[2]) |
3225
            (thread_sel_id_m[3] & ~tlu_hyper_lite[3]));
3226
 
3227
// illegal va range indicator
3228
assign tlu_va_ill_g =
3229
           (que_ill_va_g | scpd_ill_va_g) & asi_queue_read_g;
3230
 
3231
// load instruction valid - scpd or asi queue 
3232
assign asi_ld_addr_vld_m  =
3233
             asi_queue_read_m & (asi_queue_rw_m |
3234
           ((asi_hscpd_rw_m | asi_scpd_rw_m) &
3235
            ~hscpd_data_acc_excpt_m));
3236
 
3237
// staging the ld address valid 
3238 113 albert.wat
dffr_s dffr_asi_ld_addr_vld_g (
3239 95 fafa1971
    .din (asi_ld_addr_vld_m),
3240
    .q   (asi_ld_addr_vld_g),
3241
    .rst (local_rst),
3242
    .clk (clk),
3243
    .se  (se),
3244 113 albert.wat
    `SIMPLY_RISC_SCANIN,
3245 95 fafa1971
    .so  ()
3246
);
3247
//
3248
// redefined va illegal checking - the following code is 
3249
// no longer necessary
3250
// zero va range detector
3251
/*
3252
assign va_all_zero_e =
3253
            (~(|exu_lsu_ldst_va_e[`ASI_VA_WIDTH-1:0])) &
3254
             asi_queue_read_g;
3255
//
3256
// staged illegal va range
3257 113 albert.wat
dffr_s dffr_va_all_zero_m (
3258 95 fafa1971
    .din (va_all_zero_e),
3259
    .q   (va_all_zero_m),
3260
    .rst (local_rst),
3261
    .clk (clk),
3262
    .se  (se),
3263 113 albert.wat
    `SIMPLY_RISC_SCANIN,
3264 95 fafa1971
    .so  ()
3265
);
3266
//
3267 113 albert.wat
dffr_s dffr_va_all_zero_g (
3268 95 fafa1971
    .din (va_all_zero_m),
3269
    .q   (va_all_zero_g),
3270
    .rst (local_rst),
3271
    .clk (clk),
3272
    .se  (se),
3273 113 albert.wat
    `SIMPLY_RISC_SCANIN,
3274 95 fafa1971
    .so  ()
3275
);
3276
 
3277
assign tlu_va_all_zero_g = va_all_zero_g;
3278
*/
3279
 
3280
////////////////////////////////////////////////////////////////////////
3281
// queue traps - head ptr <> tail ptr
3282
////////////////////////////////////////////////////////////////////////
3283
// note: these traps are level-sensitive
3284
//
3285
// thread 0
3286
 
3287
assign tlu_cpu_mondo_cmp[0] =
3288 113 albert.wat
           (|(cpu_mondo0_head[`TLU_ASI_QUE_WIDTH-1:0] ^
3289
              cpu_mondo0_tail[`TLU_ASI_QUE_WIDTH-1:0]));
3290 95 fafa1971
assign tlu_dev_mondo_cmp[0]=
3291 113 albert.wat
           (|(dev_mondo0_head[`TLU_ASI_QUE_WIDTH-1:0] ^
3292
              dev_mondo0_tail[`TLU_ASI_QUE_WIDTH-1:0]));
3293 95 fafa1971
assign tlu_resum_err_cmp[0] =
3294 113 albert.wat
           (|(resum_err0_head[`TLU_ASI_QUE_WIDTH-1:0] ^
3295
              resum_err0_tail[`TLU_ASI_QUE_WIDTH-1:0]));
3296 95 fafa1971
// thread 1
3297
 
3298
assign tlu_cpu_mondo_cmp[1] =
3299 113 albert.wat
           (|(cpu_mondo1_head[`TLU_ASI_QUE_WIDTH-1:0] ^
3300
              cpu_mondo1_tail[`TLU_ASI_QUE_WIDTH-1:0]));
3301 95 fafa1971
assign tlu_dev_mondo_cmp[1]=
3302 113 albert.wat
           (|(dev_mondo1_head[`TLU_ASI_QUE_WIDTH-1:0] ^
3303
              dev_mondo1_tail[`TLU_ASI_QUE_WIDTH-1:0]));
3304 95 fafa1971
assign tlu_resum_err_cmp[1] =
3305 113 albert.wat
           (|(resum_err1_head[`TLU_ASI_QUE_WIDTH-1:0] ^
3306
              resum_err1_tail[`TLU_ASI_QUE_WIDTH-1:0]));
3307 95 fafa1971
//
3308
// thread 2
3309
 
3310
assign tlu_cpu_mondo_cmp[2] =
3311 113 albert.wat
           (|(cpu_mondo2_head[`TLU_ASI_QUE_WIDTH-1:0] ^
3312
              cpu_mondo2_tail[`TLU_ASI_QUE_WIDTH-1:0]));
3313 95 fafa1971
assign tlu_dev_mondo_cmp[2]=
3314 113 albert.wat
           (|(dev_mondo2_head[`TLU_ASI_QUE_WIDTH-1:0] ^
3315
              dev_mondo2_tail[`TLU_ASI_QUE_WIDTH-1:0]));
3316 95 fafa1971
assign tlu_resum_err_cmp[2] =
3317 113 albert.wat
           (|(resum_err2_head[`TLU_ASI_QUE_WIDTH-1:0] ^
3318
              resum_err2_tail[`TLU_ASI_QUE_WIDTH-1:0]));
3319 95 fafa1971
// thread 3
3320
 
3321
assign tlu_cpu_mondo_cmp[3] =
3322 113 albert.wat
           (|(cpu_mondo3_head[`TLU_ASI_QUE_WIDTH-1:0] ^
3323
              cpu_mondo3_tail[`TLU_ASI_QUE_WIDTH-1:0]));
3324 95 fafa1971
assign tlu_dev_mondo_cmp[3]=
3325 113 albert.wat
           (|(dev_mondo3_head[`TLU_ASI_QUE_WIDTH-1:0] ^
3326
              dev_mondo3_tail[`TLU_ASI_QUE_WIDTH-1:0]));
3327 95 fafa1971
assign tlu_resum_err_cmp[3] =
3328 113 albert.wat
           (|(resum_err3_head[`TLU_ASI_QUE_WIDTH-1:0] ^
3329
              resum_err3_tail[`TLU_ASI_QUE_WIDTH-1:0]));
3330 95 fafa1971
 
3331
// write to tail by supervisor
3332
// modified due to timing - moved the inst_vld qualification to tlu_tcl
3333
assign qtail_write_m =
3334
           (nresum_err_tail_rw_m | resum_err_tail_rw_m  |
3335
            cpu_mondo_tail_rw_m  | dev_mondo_tail_rw_m) &
3336
            asi_queue_write_pq_m & asi_queue_rw_m;
3337
            // asi_queue_write_m & asi_queue_rw_m;
3338
 
3339
//
3340
// modified for timing - qualification moved to tcl
3341
assign tlu_qtail_dacc_excpt_m = qtail_write_m;
3342
/*
3343
           ((thread_sel_id_m[0] & que_trap_en[0] & tlu_pstate_priv[0])  |
3344
            (thread_sel_id_m[1] & que_trap_en[1] & tlu_pstate_priv[1])  |
3345
            (thread_sel_id_m[2] & que_trap_en[2] & tlu_pstate_priv[2])  |
3346
            (thread_sel_id_m[3] & que_trap_en[3] & tlu_pstate_priv[3])) &
3347
             qtail_write_m;
3348
*/
3349
 
3350
endmodule

powered by: WebSVN 2.1.0

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