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

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [hdl/] [rtl/] [sparc_core/] [sparc_tlu_intdp.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: sparc_tlu_intdp.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
//  Module Name: sparc_tlu_intdp
29
//  Description:
30
//    Contains the code for receiving interrupts from the crossbar,
31
//    and sending interrupts out to other processors through the corssbar.
32
//    The interrupt receive register (INRR, asi=0x49/VA=0),  incoming
33
//    vector register (INVR, asi=0x7f/VA=0x40), and interrupt vector
34
//    dispatch register (INDR, asi=0x77/VA=0) are implemented in this
35
//    block.  This block also initiates thread reset/wake up when a
36
//    reset packet is received.
37
//
38
*/
39
 
40
////////////////////////////////////////////////////////////////////////
41
// Global header file includes
42
////////////////////////////////////////////////////////////////////////
43 113 albert.wat
`include "iop.h"
44 95 fafa1971
 
45
////////////////////////////////////////////////////////////////////////
46
// Local header file includes / local defines
47
////////////////////////////////////////////////////////////////////////
48 113 albert.wat
`include "tlu.h"
49 95 fafa1971
//
50
// modved defines to tlu.h
51
/*
52
`define INT_VEC_HI 5
53
`define INT_VEC_LO 0
54
`define INT_THR_HI  12
55
`define INT_THR_LO   8
56
`define INT_TYPE_HI 17
57
`define INT_TYPE_LO 16
58
*/
59
 
60
module sparc_tlu_intdp (/*AUTOARG*/
61
   // Outputs
62
   int_pending_i2_l, ind_inc_thrid_i1, // indr_inc_rst_pkt, 
63
   ind_inc_type_i1, tlu_lsu_int_ldxa_data_w2, int_tlu_rstid_m,
64
   tlu_lsu_pcxpkt, so,
65
   // Inputs
66
   //
67
   // modified to abide to the Niagara reset methodology 
68
   // clk, se, si, reset, lsu_tlu_intpkt, lsu_tlu_st_rs3_data_g, 
69
   rclk, se, si, tlu_rst_l, lsu_tlu_st_rs3_data_g, // lsu_tlu_intpkt, 
70
   inc_ind_ld_int_i1, inc_ind_rstthr_i1, inc_ind_asi_thr,
71
   inc_ind_asi_wr_indr, inc_ind_indr_grant, // inc_ind_asi_inrr, 
72
   inc_ind_thr_m, inc_ind_asi_wr_inrr, inc_ind_asi_rd_invr,
73
   inc_indr_req_valid, inc_indr_req_thrid, tlu_asi_rdata_mxsel_g,
74
   tlu_asi_queue_rdata_g, tlu_scpd_asi_rdata_g, lsu_ind_intpkt_id,
75
   lsu_ind_intpkt_type, lsu_ind_intpkt_thr
76
   );
77
 
78
   //
79
   // modified to abide to the Niagara reset methodology 
80
   // input      clk, se, si, reset;
81
   input      rclk, se, si, tlu_rst_l;
82
 
83
   // from lsu
84
   // input [17:0]  lsu_tlu_intpkt;   // int pkt from cpx
85
   input [63:0]  lsu_tlu_st_rs3_data_g;     // write data for int regs
86
 
87
   // select lines from int_ctl
88
   input [3:0]    inc_ind_ld_int_i1;            // ld ext interrupt to inrr
89
   input [3:0]    inc_ind_rstthr_i1;
90
 
91
   // changing the select from inverting to non-inverting for grape
92
   // input [3:0]        inc_ind_asi_thr_l;            // thread issuing asi command
93
   input [3:0]    inc_ind_asi_thr;            // thread issuing asi command
94
   input [3:0]    inc_ind_asi_wr_indr;          // write INDR
95
   // convert the signal to non-inverting version for grape
96
   // input [3:0]        inc_ind_indr_grant_l;         // transmit INDR to PCX
97
   input [3:0]    inc_ind_indr_grant;         // transmit INDR to PCX
98
   // obsolete input
99
   // input      inc_ind_asi_inrr;             // read INRR
100
   // convert the signal to non-inverting version for grape
101
   // input [3:0]        inc_ind_thr_m_l;
102
   input [3:0]    inc_ind_thr_m;
103
 
104
   // other controls
105
   input [3:0]    inc_ind_asi_wr_inrr;  // write INRR
106
   input [3:0]    inc_ind_asi_rd_invr;  // read INVR (reset corr bit in INRR)
107
 
108
   // indr request
109
   input         inc_indr_req_valid;   // valid value in INDR, i.e make req
110
   input [1:0]    inc_indr_req_thrid;   // thread making request
111
   //
112
   // asi rdata mux select
113
   input [3:0] tlu_asi_rdata_mxsel_g;
114
   // asi data from other blocks
115 113 albert.wat
   input [`TLU_SCPD_DATA_WIDTH-1:0] tlu_scpd_asi_rdata_g;
116
   input [`TLU_ASI_QUE_WIDTH-1:0]   tlu_asi_queue_rdata_g;
117 95 fafa1971
   input [4:0]  lsu_ind_intpkt_thr;
118
   input [1:0]  lsu_ind_intpkt_type;
119
   input [5:0]  lsu_ind_intpkt_id;
120
 
121
   // to int ctl
122
   output [3:0]  int_pending_i2_l;     // interrupt still pending
123
   // output     indr_inc_rst_pkt;
124
 
125
   output [4:0]  ind_inc_thrid_i1;
126
   output [1:0]  ind_inc_type_i1;
127
 
128
   // to outside world
129
   output [63:0] tlu_lsu_int_ldxa_data_w2; // read data from asi regs 
130
   output [5:0]  int_tlu_rstid_m;
131
 
132
   output [25:0] tlu_lsu_pcxpkt;       // pcxpkt for inter processor int
133
 
134
   output        so;
135
 
136
   // local signals
137
   //
138
   // added to abide to the Niagara reset methodology 
139
   wire local_rst; // local reset signal 
140
   //
141
   wire [63:0] int_tlu_asi_data;     // read data from int regs
142
   // interrupt and reset id
143
   wire [5:0]     int_id_i1;
144
   wire [5:0]     t0_rstid_i2,
145
                 t1_rstid_i2,
146
                 t2_rstid_i2,
147
                 t3_rstid_i2,
148
                 next_t0_rstid_i1,
149
                 next_t1_rstid_i1,
150
                 next_t2_rstid_i1,
151
                 next_t3_rstid_i1;
152
 
153
   // Interrupt receive register
154
   wire [63:0]    inrr_dec_i1,
155
                 inrr_rd_data_i2;
156
 
157
   wire [63:0]    t0_inrr_i2,
158
                 t1_inrr_i2,
159
                 t2_inrr_i2,
160
                 t3_inrr_i2,
161
                 t0_inrr_aw_i2,
162
                 t1_inrr_aw_i2,
163
                 t2_inrr_aw_i2,
164
                 t3_inrr_aw_i2,
165
                 t0_inrr_arw_i1,
166
                 t1_inrr_arw_i1,
167
                 t2_inrr_arw_i1,
168
                 t3_inrr_arw_i1,
169
                 next_t0_inrr_i1,
170
                 next_t1_inrr_i1,
171
                 next_t2_inrr_i1,
172
                 next_t3_inrr_i1;
173
 
174
   wire [63:0]    new_t0_inrr_i1,
175
                 new_t1_inrr_i1,
176
                 new_t2_inrr_i1,
177
                 new_t3_inrr_i1;
178
 
179
   // clear interrupt through asi
180
   wire [63:0]   t0_asi_wr_data,
181
                 t1_asi_wr_data,
182
                 t2_asi_wr_data,
183
                 t3_asi_wr_data;
184
 
185
   // interrupt vector
186
   wire [5:0]     t0_invr_i3,
187
                 t1_invr_i3,
188
                 t2_invr_i3,
189
                 t3_invr_i3,
190
                 t0_invr_i2,
191
                 t1_invr_i2,
192
                 t2_invr_i2,
193
                 t3_invr_i2;
194
   wire [5:0]     invr_rd_data_i3;
195
 
196
   // highest priority interrupt
197
   wire [63:0]    pe_ivec_i3,
198
                 t0_pe_ivec_i3,
199
                 t1_pe_ivec_i3,
200
                 t2_pe_ivec_i3,
201
                 t3_pe_ivec_i3;
202
 
203
   // interrupt dispatch
204
   // removed the obsolete bits 
205
   // wire [12:0]        indr_wr_pkt;
206
   wire [10:0]    indr_wr_pkt;
207
 
208
   // removed the obsolete bits 
209
   // wire [12:0]        indr_pcxpkt,
210
   wire [10:0]    indr_pcxpkt,
211
                 t0_indr,
212
                 t1_indr,
213
                 t2_indr,
214
                 t3_indr,
215
                 t0_indr_next,
216
                 t1_indr_next,
217
                 t2_indr_next,
218
                 t3_indr_next;
219
   // 
220
   // local clock
221
   wire clk;
222
 
223
   //
224
   // Code Starts Here
225
   //
226
   //----------------------------------------------------------------------
227
   // creating local clock
228
   //----------------------------------------------------------------------
229
   assign clk = rclk;
230
 
231
   //----------------------------------------------------------------------
232
   // Interrupt Receive
233
   //----------------------------------------------------------------------
234
   //
235
   // create local reset signal
236
   assign local_rst = ~tlu_rst_l;
237
 
238
   // I1 Stage
239
   // decode interrupt vector
240
   // modified due to interface clean-up
241
   /*
242
   assign  int_id_i1 = lsu_tlu_intpkt[`INT_VEC_HI:`INT_VEC_LO];
243
   assign  ind_inc_type_i1 = lsu_tlu_intpkt[`INT_TYPE_HI:`INT_TYPE_LO];
244
   assign  ind_inc_thrid_i1 = lsu_tlu_intpkt[`INT_THR_HI:`INT_THR_LO];
245
   */
246
   assign  int_id_i1[5:0]        = lsu_ind_intpkt_id[5:0];
247
   assign  ind_inc_type_i1[1:0]  = lsu_ind_intpkt_type[1:0];
248
   assign  ind_inc_thrid_i1[4:0] = lsu_ind_intpkt_thr[4:0];
249
 
250
   // rstid enable mux
251
   dp_mux2es #6 rid_mux0(.dout  (next_t0_rstid_i1[5:0]),
252
                         .in0   (t0_rstid_i2[5:0]),
253
                         .in1   (int_id_i1[5:0]),
254
                         .sel   (inc_ind_rstthr_i1[0]));
255
 
256 113 albert.wat
`ifdef FPGA_SYN_1THREAD
257
     dff_s #6 rid0_reg(.din (next_t0_rstid_i1[5:0]),
258
                   .q   (t0_rstid_i2[5:0]),
259
                   .clk (clk),
260
                   .se  (se), `SIMPLY_RISC_SCANIN, .so());
261
   assign  int_tlu_rstid_m[5:0] = t0_rstid_i2[5:0];
262
 
263
`else
264 95 fafa1971
 
265
   dp_mux2es #6 rid_mux1(.dout  (next_t1_rstid_i1[5:0]),
266
                         .in0   (t1_rstid_i2[5:0]),
267
                         .in1   (int_id_i1[5:0]),
268
                         .sel   (inc_ind_rstthr_i1[1]));
269
 
270
   dp_mux2es #6 rid_mux2(.dout  (next_t2_rstid_i1[5:0]),
271
                         .in0   (t2_rstid_i2[5:0]),
272
                         .in1   (int_id_i1[5:0]),
273
                         .sel   (inc_ind_rstthr_i1[2]));
274
 
275
   dp_mux2es #6 rid_mux3(.dout  (next_t3_rstid_i1[5:0]),
276
                         .in0   (t3_rstid_i2[5:0]),
277
                         .in1   (int_id_i1[5:0]),
278
                         .sel   (inc_ind_rstthr_i1[3]));
279
 
280
   // rst id flops
281 113 albert.wat
   dff_s #6 rid0_reg(.din (next_t0_rstid_i1[5:0]),
282 95 fafa1971
                   .q   (t0_rstid_i2[5:0]),
283
                   .clk (clk),
284 113 albert.wat
                   .se  (se), `SIMPLY_RISC_SCANIN, .so());
285
   dff_s #6 rid1_reg(.din (next_t1_rstid_i1[5:0]),
286 95 fafa1971
                   .q   (t1_rstid_i2[5:0]),
287
                   .clk (clk),
288 113 albert.wat
                   .se  (se), `SIMPLY_RISC_SCANIN, .so());
289
   dff_s #6 rid2_reg(.din (next_t2_rstid_i1[5:0]),
290 95 fafa1971
                   .q   (t2_rstid_i2[5:0]),
291
                   .clk (clk),
292 113 albert.wat
                   .se  (se), `SIMPLY_RISC_SCANIN, .so());
293
   dff_s #6 rid3_reg(.din (next_t3_rstid_i1[5:0]),
294 95 fafa1971
                   .q   (t3_rstid_i2[5:0]),
295
                   .clk (clk),
296 113 albert.wat
                   .se  (se), `SIMPLY_RISC_SCANIN, .so());
297 95 fafa1971
 
298
   // rstid to tlu in M stage
299
   // changing the select from inverting to non-inverting for grape
300
   /*
301
   dp_mux4ds #6 tlurid_mux(.dout (int_tlu_rstid_m[5:0]),
302
                           .in0  (t0_rstid_i2[5:0]),
303
                           .in1  (t1_rstid_i2[5:0]),
304
                           .in2  (t2_rstid_i2[5:0]),
305
                           .in3  (t3_rstid_i2[5:0]),
306
                           .sel0_l (inc_ind_thr_m_l[0]),
307
                           .sel1_l (inc_ind_thr_m_l[1]),
308
                           .sel2_l (inc_ind_thr_m_l[2]),
309
                           .sel3_l (inc_ind_thr_m_l[3]));
310
   */
311
   dp_mux4ds #6 tlurid_mux(.dout (int_tlu_rstid_m[5:0]),
312
                           .in0  (t0_rstid_i2[5:0]),
313
                           .in1  (t1_rstid_i2[5:0]),
314
                           .in2  (t2_rstid_i2[5:0]),
315
                           .in3  (t3_rstid_i2[5:0]),
316
                           .sel0_l (~inc_ind_thr_m[0]),
317
                           .sel1_l (~inc_ind_thr_m[1]),
318
                           .sel2_l (~inc_ind_thr_m[2]),
319
                           .sel3_l (~inc_ind_thr_m[3]));
320
 
321 113 albert.wat
`endif // !`ifdef FPGA_SYN_1THREAD
322 95 fafa1971
 
323
   sparc_tlu_dec64 iv_dec(.in  (int_id_i1[5:0]),
324
                          .out (inrr_dec_i1[63:0]));
325
 
326
   // merge decoded interrupt vector with inrr
327
   assign  new_t0_inrr_i1 = inrr_dec_i1 | t0_inrr_arw_i1;
328
   assign  new_t1_inrr_i1 = inrr_dec_i1 | t1_inrr_arw_i1;
329
   assign  new_t2_inrr_i1 = inrr_dec_i1 | t2_inrr_arw_i1;
330
   assign  new_t3_inrr_i1 = inrr_dec_i1 | t3_inrr_arw_i1;
331
 
332
   // enable mux to load new interrupt to INRR
333
   dp_mux2es #64 inrr_en_mux0(.dout  (next_t0_inrr_i1[63:0]),
334
                          .in0   (t0_inrr_arw_i1[63:0]),
335
                          .in1   (new_t0_inrr_i1[63:0]),
336
                          .sel   (inc_ind_ld_int_i1[0]));
337 113 albert.wat
`ifdef FPGA_SYN_1THREAD
338
   // interrupt receive register (INRR)
339
   // change to dff -- software will reset before IE turns on
340
   dffr_s #64 t0_inrr (.din (next_t0_inrr_i1[63:0]),
341
                     .q   (t0_inrr_i2[63:0]),
342
                     .clk (clk),
343
   //
344
   // modified to abide to the Niagara reset methodology 
345
   //                .rst (reset),
346
                     .rst (local_rst),
347
                     .se  (se), `SIMPLY_RISC_SCANIN, .so());
348
   assign   inrr_rd_data_i2[63:0] = t0_inrr_i2[63:0];
349 95 fafa1971
 
350 113 albert.wat
`else
351 95 fafa1971
 
352
   dp_mux2es #64 inrr_en_mux1(.dout  (next_t1_inrr_i1[63:0]),
353
                          .in0   (t1_inrr_arw_i1[63:0]),
354
                          .in1   (new_t1_inrr_i1[63:0]),
355
                          .sel   (inc_ind_ld_int_i1[1]));
356
   dp_mux2es #64 inrr_en_mux2(.dout  (next_t2_inrr_i1[63:0]),
357
                          .in0   (t2_inrr_arw_i1[63:0]),
358
                          .in1   (new_t2_inrr_i1[63:0]),
359
                          .sel   (inc_ind_ld_int_i1[2]));
360
   dp_mux2es #64 inrr_en_mux3(.dout  (next_t3_inrr_i1[63:0]),
361
                          .in0   (t3_inrr_arw_i1[63:0]),
362
                          .in1   (new_t3_inrr_i1[63:0]),
363
                          .sel   (inc_ind_ld_int_i1[3]));
364
 
365
   // interrupt receive register (INRR)
366
   // change to dff -- software will reset before IE turns on
367 113 albert.wat
   dffr_s #64 t0_inrr (.din (next_t0_inrr_i1[63:0]),
368 95 fafa1971
                     .q   (t0_inrr_i2[63:0]),
369
                     .clk (clk),
370
   //
371
   // modified to abide to the Niagara reset methodology 
372
   //                .rst (reset),
373
                     .rst (local_rst),
374 113 albert.wat
                     .se  (se), `SIMPLY_RISC_SCANIN, .so());
375
   dffr_s #64 t1_inrr (.din (next_t1_inrr_i1[63:0]),
376 95 fafa1971
                     .q   (t1_inrr_i2[63:0]),
377
                     .clk (clk),
378
   //
379
   // modified to abide to the Niagara reset methodology 
380
   //                .rst (reset),
381
                     .rst (local_rst),
382 113 albert.wat
                     .se  (se), `SIMPLY_RISC_SCANIN, .so());
383
   dffr_s #64 t2_inrr (.din (next_t2_inrr_i1[63:0]),
384 95 fafa1971
                     .q   (t2_inrr_i2[63:0]),
385
                     .clk (clk),
386
   //
387
   // modified to abide to the Niagara reset methodology 
388
   //                .rst (reset),
389
                     .rst (local_rst),
390 113 albert.wat
                     .se  (se), `SIMPLY_RISC_SCANIN, .so());
391
   dffr_s #64 t3_inrr (.din (next_t3_inrr_i1[63:0]),
392 95 fafa1971
                     .q   (t3_inrr_i2[63:0]),
393
                     .clk (clk),
394
   //
395
   // modified to abide to the Niagara reset methodology 
396
   //                .rst (reset),
397
                     .rst (local_rst),
398 113 albert.wat
                     .se  (se), `SIMPLY_RISC_SCANIN, .so());
399 95 fafa1971
 
400
   // I2 Stage
401
   // read out INRR to asi
402
   // changing the select from inverting to non-inverting for grape
403
   /*
404
   dp_mux4ds #64 inrr_rd_mux(.dout (inrr_rd_data_i2[63:0]),
405
                         .in0  (t0_inrr_i2[63:0]),
406
                         .in1  (t1_inrr_i2[63:0]),
407
                         .in2  (t2_inrr_i2[63:0]),
408
                         .in3  (t3_inrr_i2[63:0]),
409
                         .sel0_l (inc_ind_asi_thr_l[0]),
410
                         .sel1_l (inc_ind_asi_thr_l[1]),
411
                         .sel2_l (inc_ind_asi_thr_l[2]),
412
                         .sel3_l (inc_ind_asi_thr_l[3]));
413
    */
414
   dp_mux4ds #64 inrr_rd_mux(.dout (inrr_rd_data_i2[63:0]),
415
                         .in0  (t0_inrr_i2[63:0]),
416
                         .in1  (t1_inrr_i2[63:0]),
417
                         .in2  (t2_inrr_i2[63:0]),
418
                         .in3  (t3_inrr_i2[63:0]),
419
                         .sel0_l (~inc_ind_asi_thr[0]),
420
                         .sel1_l (~inc_ind_asi_thr[1]),
421
                         .sel2_l (~inc_ind_asi_thr[2]),
422
                         .sel3_l (~inc_ind_asi_thr[3]));
423
 
424 113 albert.wat
`endif // !`ifdef FPGA_SYN_1THREAD
425 95 fafa1971
 
426
   // signal interrupt pending
427
   sparc_tlu_zcmp64  zcmp0(.in  (t0_inrr_i2[63:0]),
428
                           .zero (int_pending_i2_l[0]));
429
 
430 113 albert.wat
`ifdef FPGA_SYN_1THREAD
431
   assign t0_asi_wr_data = ~(~lsu_tlu_st_rs3_data_g &
432
                              {64{inc_ind_asi_wr_inrr[0]}});
433
   assign t0_inrr_aw_i2 = t0_inrr_i2 & t0_asi_wr_data;
434
   sparc_tlu_penc64 t0_invr_penc(.in  (t0_inrr_i2[63:0]),
435
                                 .out (t0_invr_i2[5:0]));
436
   dff_s #6 t0_invr (.din (t0_invr_i2[5:0]),
437
                   .q   (t0_invr_i3[5:0]),
438
                   .clk (clk),
439
                   .se  (se), `SIMPLY_RISC_SCANIN, .so());
440
   assign invr_rd_data_i3[5:0] = t0_invr_i3[5:0];
441 95 fafa1971
 
442 113 albert.wat
`else
443
 
444 95 fafa1971
   sparc_tlu_zcmp64  zcmp1(.in  (t1_inrr_i2[63:0]),
445
                           .zero (int_pending_i2_l[1]));
446
   sparc_tlu_zcmp64  zcmp2(.in  (t2_inrr_i2[63:0]),
447
                           .zero (int_pending_i2_l[2]));
448
   sparc_tlu_zcmp64  zcmp3(.in  (t3_inrr_i2[63:0]),
449
                           .zero (int_pending_i2_l[3]));
450
 
451
   // write data -- only zeros may be written to the INRR.  An attempt
452
   // to write 1 is ignored.
453
   // Force to all 1 if no write
454
   assign  t0_asi_wr_data = ~(~lsu_tlu_st_rs3_data_g &
455
                              {64{inc_ind_asi_wr_inrr[0]}});
456
   assign  t1_asi_wr_data = ~(~lsu_tlu_st_rs3_data_g &
457
                              {64{inc_ind_asi_wr_inrr[1]}});
458
   assign  t2_asi_wr_data = ~(~lsu_tlu_st_rs3_data_g &
459
                              {64{inc_ind_asi_wr_inrr[2]}});
460
   assign  t3_asi_wr_data = ~(~lsu_tlu_st_rs3_data_g &
461
                              {64{inc_ind_asi_wr_inrr[3]}});
462
 
463
   assign  t0_inrr_aw_i2 = t0_inrr_i2 & t0_asi_wr_data;
464
   assign  t1_inrr_aw_i2 = t1_inrr_i2 & t1_asi_wr_data;
465
   assign  t2_inrr_aw_i2 = t2_inrr_i2 & t2_asi_wr_data;
466
   assign  t3_inrr_aw_i2 = t3_inrr_i2 & t3_asi_wr_data;
467
 
468
   // priority encode INRR to 6 bits to get INVR
469
   // b63 has the highest priority
470
   sparc_tlu_penc64 t0_invr_penc(.in  (t0_inrr_i2[63:0]),
471
                                 .out (t0_invr_i2[5:0]));
472
   sparc_tlu_penc64 t1_invr_penc(.in  (t1_inrr_i2[63:0]),
473
                                 .out (t1_invr_i2[5:0]));
474
   sparc_tlu_penc64 t2_invr_penc(.in  (t2_inrr_i2[63:0]),
475
                                 .out (t2_invr_i2[5:0]));
476
   sparc_tlu_penc64 t3_invr_penc(.in  (t3_inrr_i2[63:0]),
477
                                 .out (t3_invr_i2[5:0]));
478
 
479
   // Interrupt Vector Register (INVR)
480
   // Cannot write to INVR
481 113 albert.wat
   dff_s #6 t0_invr (.din (t0_invr_i2[5:0]),
482 95 fafa1971
                   .q   (t0_invr_i3[5:0]),
483
                   .clk (clk),
484 113 albert.wat
                   .se  (se), `SIMPLY_RISC_SCANIN, .so());
485
   dff_s #6 t1_invr (.din (t1_invr_i2[5:0]),
486 95 fafa1971
                   .q   (t1_invr_i3[5:0]),
487
                   .clk (clk),
488 113 albert.wat
                   .se  (se), `SIMPLY_RISC_SCANIN, .so());
489
   dff_s #6 t2_invr (.din (t2_invr_i2[5:0]),
490 95 fafa1971
                   .q   (t2_invr_i3[5:0]),
491
                   .clk (clk),
492 113 albert.wat
                   .se  (se), `SIMPLY_RISC_SCANIN, .so());
493
   dff_s #6 t3_invr (.din (t3_invr_i2[5:0]),
494 95 fafa1971
                   .q   (t3_invr_i3[5:0]),
495
                   .clk (clk),
496 113 albert.wat
                   .se  (se), `SIMPLY_RISC_SCANIN, .so());
497 95 fafa1971
 
498
   // I3 stage
499
   // read out to asi data 
500
   // changing the select from inverting to non-inverting for grape
501
   /*
502
   dp_mux4ds #6 invr_rd_mux(.dout (invr_rd_data_i3[5:0]),
503
                            .in0  (t0_invr_i3[5:0]),
504
                            .in1  (t1_invr_i3[5:0]),
505
                            .in2  (t2_invr_i3[5:0]),
506
                            .in3  (t3_invr_i3[5:0]),
507
                            .sel0_l (inc_ind_asi_thr_l[0]),
508
                            .sel1_l (inc_ind_asi_thr_l[1]),
509
                            .sel2_l (inc_ind_asi_thr_l[2]),
510
                            .sel3_l (inc_ind_asi_thr_l[3]));
511
   */
512
   dp_mux4ds #6 invr_rd_mux(.dout (invr_rd_data_i3[5:0]),
513
                            .in0  (t0_invr_i3[5:0]),
514
                            .in1  (t1_invr_i3[5:0]),
515
                            .in2  (t2_invr_i3[5:0]),
516
                            .in3  (t3_invr_i3[5:0]),
517
                            .sel0_l (~inc_ind_asi_thr[0]),
518
                            .sel1_l (~inc_ind_asi_thr[1]),
519
                            .sel2_l (~inc_ind_asi_thr[2]),
520
                            .sel3_l (~inc_ind_asi_thr[3]));
521 113 albert.wat
`endif // !`ifdef FPGA_SYN_1THREAD
522 95 fafa1971
 
523
   //
524
   // modified for bug 2109
525
   // asi rd data mux
526
   dp_mux4ds #(64) asi_rd_mux(
527
                           .in0  ({58'b0, invr_rd_data_i3[5:0]}),
528
                           .in1  (inrr_rd_data_i2[63:0]),
529 113 albert.wat
                           .in2  (tlu_scpd_asi_rdata_g[`TLU_SCPD_DATA_WIDTH-1:0]),
530
                           .in3  ({50'b0, tlu_asi_queue_rdata_g[`TLU_ASI_QUE_WIDTH-1:0],6'b0}),
531 95 fafa1971
                           .sel0_l (~tlu_asi_rdata_mxsel_g[0]),
532
                           .sel1_l (~tlu_asi_rdata_mxsel_g[1]),
533
                           .sel2_l (~tlu_asi_rdata_mxsel_g[2]),
534
                           .sel3_l (~tlu_asi_rdata_mxsel_g[3]),
535
               .dout (int_tlu_asi_data[63:0]));
536
 
537 113 albert.wat
   dff_s #(64) dff_tlu_lsu_int_ldxa_data_w2 (
538 95 fafa1971
        .din (int_tlu_asi_data[63:0]),
539
                .q   (tlu_lsu_int_ldxa_data_w2[63:0]),
540
                .clk (clk),
541
                .se  (se),
542 113 albert.wat
        `SIMPLY_RISC_SCANIN,
543 95 fafa1971
        .so());
544
 
545
   sparc_tlu_dec64 inrr_pe_dec(.in  (invr_rd_data_i3[5:0]),
546
                               .out (pe_ivec_i3[63:0]));
547
 
548
   // when INVR is read, zero out the corresponding bit in INRR
549
   assign  t0_pe_ivec_i3 = pe_ivec_i3 & {64{inc_ind_asi_rd_invr[0]}};
550
   assign  t1_pe_ivec_i3 = pe_ivec_i3 & {64{inc_ind_asi_rd_invr[1]}};
551
   assign  t2_pe_ivec_i3 = pe_ivec_i3 & {64{inc_ind_asi_rd_invr[2]}};
552
   assign  t3_pe_ivec_i3 = pe_ivec_i3 & {64{inc_ind_asi_rd_invr[3]}};
553
 
554
   assign  t0_inrr_arw_i1 = t0_inrr_aw_i2 & ~t0_pe_ivec_i3;
555
   assign  t1_inrr_arw_i1 = t1_inrr_aw_i2 & ~t1_pe_ivec_i3;
556
   assign  t2_inrr_arw_i1 = t2_inrr_aw_i2 & ~t2_pe_ivec_i3;
557
   assign  t3_inrr_arw_i1 = t3_inrr_aw_i2 & ~t3_pe_ivec_i3;
558
 
559
   //----------------------------------------------------------------------
560
   // Interrupt Dispatch
561
   //----------------------------------------------------------------------
562
   // modified to remove the unused bits
563
   //
564
   // assign  indr_wr_pkt = {lsu_tlu_st_rs3_data_g[`INT_TYPE_HI:`INT_TYPE_LO], 
565 113 albert.wat
   assign  indr_wr_pkt = {lsu_tlu_st_rs3_data_g[`INT_THR_HI:`INT_THR_LO],
566
                          lsu_tlu_st_rs3_data_g[`INT_VEC_HI:`INT_VEC_LO]};
567 95 fafa1971
   // 
568
   // removed for timing 
569
   // assign  indr_inc_rst_pkt = lsu_tlu_st_rs3_data_g[`INT_TYPE_HI] |
570
   //                         lsu_tlu_st_rs3_data_g[`INT_TYPE_LO];
571
 
572
   dp_mux2es  #11   t0_indr_mux(.dout (t0_indr_next[10:0]),
573
                                .in0  (t0_indr[10:0]),
574
                                .in1  (indr_wr_pkt[10:0]),
575
                                .sel  (inc_ind_asi_wr_indr[0]));
576 113 albert.wat
`ifdef FPGA_SYN_1THREAD
577
   dff_s #11 t0_indr_reg(.din (t0_indr_next[10:0]),
578
                   .q   (t0_indr[10:0]),
579
                   .clk (clk),
580
                   .se  (se), `SIMPLY_RISC_SCANIN, .so());
581
   assign  indr_pcxpkt[10:0] = t0_indr[10:0];
582 95 fafa1971
 
583 113 albert.wat
`else
584
 
585 95 fafa1971
   dp_mux2es  #11   t1_indr_mux(.dout (t1_indr_next[10:0]),
586
                                .in0  (t1_indr[10:0]),
587
                                .in1  (indr_wr_pkt[10:0]),
588
                                .sel  (inc_ind_asi_wr_indr[1]));
589
   dp_mux2es  #11   t2_indr_mux(.dout (t2_indr_next[10:0]),
590
                                .in0  (t2_indr[10:0]),
591
                                .in1  (indr_wr_pkt[10:0]),
592
                                .sel  (inc_ind_asi_wr_indr[2]));
593
   dp_mux2es  #11   t3_indr_mux(.dout (t3_indr_next[10:0]),
594
                                .in0  (t3_indr[10:0]),
595
                                .in1  (indr_wr_pkt[10:0]),
596
                                .sel  (inc_ind_asi_wr_indr[3]));
597
 
598 113 albert.wat
   dff_s #11 t0_indr_reg(.din (t0_indr_next[10:0]),
599 95 fafa1971
                   .q   (t0_indr[10:0]),
600
                   .clk (clk),
601 113 albert.wat
                   .se  (se), `SIMPLY_RISC_SCANIN, .so());
602
   dff_s #11 t1_indr_reg(.din (t1_indr_next[10:0]),
603 95 fafa1971
                   .q   (t1_indr[10:0]),
604
                   .clk (clk),
605 113 albert.wat
                   .se  (se), `SIMPLY_RISC_SCANIN, .so());
606
   dff_s #11 t2_indr_reg(.din (t2_indr_next[10:0]),
607 95 fafa1971
                   .q   (t2_indr[10:0]),
608
                   .clk (clk),
609 113 albert.wat
                   .se  (se), `SIMPLY_RISC_SCANIN, .so());
610
   dff_s #11 t3_indr_reg(.din (t3_indr_next[10:0]),
611 95 fafa1971
                   .q   (t3_indr[10:0]),
612
                   .clk (clk),
613 113 albert.wat
                   .se  (se), `SIMPLY_RISC_SCANIN, .so());
614 95 fafa1971
 
615
   // changing the select from inverting to non-inverting for grape
616
   /*
617
   dp_mux4ds #13 int_dsp_mux(.dout (indr_pcxpkt[12:0]),
618
                             .in0  (t0_indr[12:0]),
619
                             .in1  (t1_indr[12:0]),
620
                             .in2  (t2_indr[12:0]),
621
                             .in3  (t3_indr[12:0]),
622
                             .sel0_l (inc_ind_indr_grant_l[0]),
623
                             .sel1_l (inc_ind_indr_grant_l[1]),
624
                             .sel2_l (inc_ind_indr_grant_l[2]),
625
                             .sel3_l (inc_ind_indr_grant_l[3]));
626
    */
627
   dp_mux4ds #11 int_dsp_mux(.dout (indr_pcxpkt[10:0]),
628
                             .in0  (t0_indr[10:0]),
629
                             .in1  (t1_indr[10:0]),
630
                             .in2  (t2_indr[10:0]),
631
                             .in3  (t3_indr[10:0]),
632
                             .sel0_l (~inc_ind_indr_grant[0]),
633
                             .sel1_l (~inc_ind_indr_grant[1]),
634
                             .sel2_l (~inc_ind_indr_grant[2]),
635
                             .sel3_l (~inc_ind_indr_grant[3]));
636 113 albert.wat
`endif // !`ifdef FPGA_SYN_1THREAD
637 95 fafa1971
 
638
 
639
   assign  tlu_lsu_pcxpkt[25:0] = {inc_indr_req_valid,  // 25
640 113 albert.wat
                                   {`INT_RQ},               // 24:20
641 95 fafa1971
                                   inc_indr_req_thrid[1:0], // 19:18
642
//                                 indr_pcxpkt[12:11],  -- cannot send rst
643
                                   {2'b00},             // 17:16
644
                                   3'b0,                // 15:13 rsvd
645
                                   indr_pcxpkt[10:6],   // 12:8
646
                                   2'b0,                // 7:6   rsvd
647
                                   indr_pcxpkt[5:0]};   // 5:0
648
 
649
   // TBD:
650
   // 1. disable sending of reset/nuke/resum packets from indr -- DONE 1/6
651
 
652
endmodule
653
 
654
 

powered by: WebSVN 2.1.0

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