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

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [hdl/] [rtl/] [sparc_core/] [sparc_exu_rml.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_exu_rml.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_exu_rml
29
//      Description: Register management logic.  Contains CWP, CANSAVE, CANRESTORE
30
//              and other window management registers.  Generates RF related traps
31
//              and switches the global registers to alternate globals.  All the registers
32
//              are written in the W stage (there is no bypassing so they must
33
//              swap out) and will either get a new value generated by a window management
34
//              Instruction or by a WRPS instruction.  The following traps can be generated:
35
//                      Fill: restore with canrestore == 0
36
//                      clean_window: save with cleanwin-canrestore == 0
37
//                      spill: flushw with cansave != nwindows -2 or
38
//                              save with cansave == 0
39
//              It is assumed that the contents of the new window will get squashed
40
//              on a clean_window or fill trap so the save or restore gets executed
41
//              normally.  Spill traps or WRCWPs mean that all 16 windowed registers
42
//              must be saved and restored (a 4 cycle operation).
43
*/
44
module sparc_exu_rml (/*AUTOARG*/
45
   // Outputs
46
   exu_tlu_spill_wtype, exu_tlu_spill_other, exu_tlu_cwp_retry,
47
   exu_tlu_cwp3_w, exu_tlu_cwp2_w, exu_tlu_cwp1_w, exu_tlu_cwp0_w,
48
   so, exu_tlu_cwp_cmplt, exu_tlu_cwp_cmplt_tid, rml_ecl_cwp_d,
49
   rml_ecl_cansave_d, rml_ecl_canrestore_d, rml_ecl_otherwin_d,
50
   rml_ecl_wstate_d, rml_ecl_cleanwin_d, rml_ecl_fill_e,
51
   rml_ecl_clean_window_e, rml_ecl_other_e, rml_ecl_wtype_e,
52
   exu_ifu_spill_e, rml_ecl_gl_e, rml_irf_old_lo_cwp_e,
53
   rml_irf_new_lo_cwp_e, rml_irf_old_e_cwp_e, rml_irf_new_e_cwp_e,
54
   rml_irf_swap_even_e, rml_irf_swap_odd_e, rml_irf_swap_local_e,
55
   rml_irf_kill_restore_w, rml_irf_cwpswap_tid_e, rml_ecl_swap_done,
56
   rml_ecl_rmlop_done_e, exu_ifu_oddwin_s, exu_tlu_spill,
57
   exu_tlu_spill_tid, rml_ecl_kill_m, rml_irf_old_agp,
58
   rml_irf_new_agp, rml_irf_swap_global, rml_irf_global_tid,
59
   // Inputs
60
   tlu_exu_cwp_retry_m, rst_tri_en, rclk, se, si, grst_l, arst_l,
61
   ifu_exu_tid_s2, ifu_exu_save_d, ifu_exu_restore_d,
62
   ifu_exu_saved_e, ifu_exu_restored_e, ifu_exu_flushw_e,
63
   ecl_rml_thr_m, ecl_rml_thr_w, ecl_rml_cwp_wen_e,
64
   ecl_rml_cansave_wen_w, ecl_rml_canrestore_wen_w,
65
   ecl_rml_otherwin_wen_w, ecl_rml_wstate_wen_w,
66
   ecl_rml_cleanwin_wen_w, ecl_rml_xor_data_e, ecl_rml_kill_e,
67
   ecl_rml_kill_w, ecl_rml_early_flush_w, exu_tlu_wsr_data_w,
68
   tlu_exu_agp, tlu_exu_agp_swap, tlu_exu_agp_tid, tlu_exu_cwp_m,
69
   tlu_exu_cwpccr_update_m, ecl_rml_inst_vld_w
70
   ) ;
71
   input rclk;
72
   input se;
73
   input si;
74
   input grst_l;
75
   input arst_l;
76
   input [1:0] ifu_exu_tid_s2;
77
   input       ifu_exu_save_d;
78
   input       ifu_exu_restore_d;
79
   input       ifu_exu_saved_e;
80
   input       ifu_exu_restored_e;
81
   input       ifu_exu_flushw_e;
82
   input [3:0] ecl_rml_thr_m;
83
   input [3:0] ecl_rml_thr_w;
84
   input       ecl_rml_cwp_wen_e;
85
   input       ecl_rml_cansave_wen_w;
86
   input       ecl_rml_canrestore_wen_w;
87
   input       ecl_rml_otherwin_wen_w;
88
   input       ecl_rml_wstate_wen_w;
89
   input       ecl_rml_cleanwin_wen_w;
90
   input [2:0] ecl_rml_xor_data_e;
91
   input       ecl_rml_kill_e;// needed for oddwin updates
92
   input       ecl_rml_kill_w;
93
   input       ecl_rml_early_flush_w;
94
   input [5:0] exu_tlu_wsr_data_w; // for wstate
95
   input [1:0]   tlu_exu_agp;   // alternate global pointer
96
   input         tlu_exu_agp_swap;// switch globals
97
   input [1:0]   tlu_exu_agp_tid;// thread that agp refers to
98
   input [2:0] tlu_exu_cwp_m;   // for switching cwp on return from trap
99
   input       tlu_exu_cwpccr_update_m;
100
   input       ecl_rml_inst_vld_w;
101
   /*AUTOINPUT*/
102
   // Beginning of automatic inputs (from unused autoinst inputs)
103
   input                rst_tri_en;             // To cwp of sparc_exu_rml_cwp.v
104
   input                tlu_exu_cwp_retry_m;    // To cwp of sparc_exu_rml_cwp.v
105
   // End of automatics
106
 
107
   /*AUTOOUTPUT*/
108
   // Beginning of automatic outputs (from unused autoinst outputs)
109
   output [2:0]         exu_tlu_cwp0_w;         // From cwp of sparc_exu_rml_cwp.v
110
   output [2:0]         exu_tlu_cwp1_w;         // From cwp of sparc_exu_rml_cwp.v
111
   output [2:0]         exu_tlu_cwp2_w;         // From cwp of sparc_exu_rml_cwp.v
112
   output [2:0]         exu_tlu_cwp3_w;         // From cwp of sparc_exu_rml_cwp.v
113
   output               exu_tlu_cwp_retry;      // From cwp of sparc_exu_rml_cwp.v
114
   output               exu_tlu_spill_other;    // From cwp of sparc_exu_rml_cwp.v
115
   output [2:0]         exu_tlu_spill_wtype;    // From cwp of sparc_exu_rml_cwp.v
116
   // End of automatics
117
   output               so;
118
   output      exu_tlu_cwp_cmplt;
119
   output [1:0] exu_tlu_cwp_cmplt_tid;
120
   output [2:0]  rml_ecl_cwp_d;
121
   output [2:0]  rml_ecl_cansave_d;
122
   output [2:0]  rml_ecl_canrestore_d;
123
   output [2:0]  rml_ecl_otherwin_d;
124
   output [5:0]  rml_ecl_wstate_d;
125
   output [2:0]  rml_ecl_cleanwin_d;
126
   output        rml_ecl_fill_e;
127
   output        rml_ecl_clean_window_e;
128
   output        rml_ecl_other_e;
129
   output [2:0] rml_ecl_wtype_e;
130
   output       exu_ifu_spill_e;
131
   output [1:0] rml_ecl_gl_e;
132
 
133
   output [2:0]  rml_irf_old_lo_cwp_e;  // current window pointer for locals and odds
134
   output [2:0]  rml_irf_new_lo_cwp_e;  // current window pointer for locals and odd
135
   output [1:0]  rml_irf_old_e_cwp_e;  // current window pointer for evens
136
   output [1:0]  rml_irf_new_e_cwp_e;  // current window pointer for evens
137
   output        rml_irf_swap_even_e;
138
   output        rml_irf_swap_odd_e;
139
   output        rml_irf_swap_local_e;
140
   output        rml_irf_kill_restore_w;
141
   output [1:0]  rml_irf_cwpswap_tid_e;
142
 
143
   output [3:0] rml_ecl_swap_done;
144
   output       rml_ecl_rmlop_done_e;
145
   output [3:0] exu_ifu_oddwin_s;
146
   output       exu_tlu_spill;
147
   output [1:0] exu_tlu_spill_tid;
148
   output       rml_ecl_kill_m;
149
 
150
   output [1:0]  rml_irf_old_agp; // alternate global pointer
151
   output [1:0]  rml_irf_new_agp; // alternate global pointer
152
   output        rml_irf_swap_global;
153
   output [1:0]  rml_irf_global_tid;
154
 
155
   wire          clk;
156
   wire [1:0]    tid_d;
157
   wire [3:0]    thr_d;
158
   wire [1:0]    tid_e;
159
   wire          rml_reset_l;
160
   wire          reset;
161
   wire          save_e;
162
   wire          save_m;
163
   wire          restore_e;
164
   wire          swap_e;
165
   wire          agp_wen;
166
   wire [1:0]    agp_thr0;
167
   wire [1:0]    agp_thr1;
168
   wire [1:0]    agp_thr2;
169
   wire [1:0]    agp_thr3;
170
   wire [1:0]    agp_thr0_next;
171
   wire [1:0]    agp_thr1_next;
172
   wire [1:0]    agp_thr2_next;
173
   wire [1:0]    agp_thr3_next;
174
   wire          agp_wen_thr0_w;
175
   wire          agp_wen_thr1_w;
176
   wire          agp_wen_thr2_w;
177
   wire          agp_wen_thr3_w;
178
   wire [1:0]    new_agp;
179
   wire [1:0]    agp_tid;
180
   wire [3:0]    agp_thr;
181
   wire        full_swap_e;
182
   wire   did_restore_m;
183
   wire   did_restore_w;
184
   wire   kill_restore_m;
185
   wire   kill_restore_w;
186
 
187
   wire [2:0]  rml_ecl_cwp_e;
188
   wire [2:0]  rml_ecl_cansave_e;
189
   wire [2:0]  rml_ecl_canrestore_e;
190
   wire [2:0]  rml_ecl_otherwin_e;
191
   wire [2:0]  rml_ecl_cleanwin_e;
192
 
193
   wire [2:0]  rml_next_cwp_e;
194
   wire [2:0]  rml_next_cansave_e;// e-stage of rml generated new data
195
   wire [2:0]  rml_next_canrestore_e;
196
   wire [2:0]  rml_next_otherwin_e;
197
   wire [2:0]  rml_next_cleanwin_e;
198
 
199
   wire [2:0]  next_cwp_e;
200
   wire [2:0]  next_cansave_e;  // e-stage of new data
201
   wire [2:0]  next_canrestore_e;
202
   wire [2:0]  next_otherwin_e;
203
   wire [2:0]  next_cleanwin_e;
204
   wire [2:0]  next_cwp_m;      // m-stage of new data
205
   wire [2:0]  next_cansave_m;
206
   wire [2:0]  next_canrestore_m;
207
   wire [2:0]  next_otherwin_m;
208
   wire [2:0]  next_cleanwin_m;
209
   wire [2:0]  next_cansave_w;// w-stage of new data
210
   wire [2:0]  next_canrestore_w;
211
   wire [2:0]  next_otherwin_w;
212
   wire [2:0]  next_cleanwin_w;
213
   wire [2:0]  next_cwp_noreset_w;
214
   wire [2:0]  next_cwp_w;
215
 
216
   wire   rml_cwp_wen_e;        // wen for cwp from rml
217
   wire   rml_cwp_wen_m;        // wen for cwp from rml
218
   wire [2:0] spill_cwp_e;      // next cwp if there is a spill trap 
219
   wire       spill_cwp_carry0; // carry bit from spill cwp computations
220
   wire       spill_cwp_carry1;
221
   wire       next_cwp_sel_inc; // select line to next_cwp mux
222
 
223
   wire        rml_cansave_wen_w;// rml generated wen
224
   wire        rml_canrestore_wen_w;
225
   wire        rml_otherwin_wen_w;
226
   wire        rml_cleanwin_wen_w;
227
 
228
   wire        cansave_wen_w;// wen to registers
229
   wire        canrestore_wen_w;
230
   wire        otherwin_wen_w;
231
   wire        cleanwin_wen_w;
232
   wire        cwp_wen_nokill_w;
233
   wire        cwp_wen_w;
234
   wire        wstate_wen_w;
235
 
236
   wire        cwp_wen_m;       // rml generated wen w/o kills
237
   wire        cansave_wen_m;
238
   wire        canrestore_wen_m;
239
   wire        otherwin_wen_m;
240
   wire        cleanwin_wen_m;
241
   wire        cansave_wen_valid_m;     // rml generated wen w/ kills
242
   wire        canrestore_wen_valid_m;
243
   wire        otherwin_wen_valid_m;
244
   wire        cleanwin_wen_valid_m;
245
 
246
   wire          cwp_wen_e;       // rml generated wen_e
247
   wire        cansave_wen_e;
248
   wire        canrestore_wen_e;
249
   wire        otherwin_wen_e;
250
   wire        cleanwin_wen_e;
251
 
252
   wire        cansave_inc_e;
253
   wire        canrestore_inc_e;
254
 
255
   wire        spill_trap_save;
256
   wire        spill_trap_flush;
257
   wire        spill_m;
258
   wire [2:0]  cleanwin_xor_canrestore;
259
 
260
   wire        otherwin_is0_e;
261
   wire        cansave_is0_e;
262
   wire        canrestore_is0_e;
263
 
264
   wire        swap_locals_ins;
265
   wire        swap_outs;
266
   wire [2:0]  old_cwp_e;
267
   wire [2:0]  new_cwp_e;
268
 
269
   wire [2:0]   rml_ecl_wtype_d;
270
   wire [2:0]   rml_ecl_wtype_e;
271
   wire         rml_ecl_other_d;
272
   wire         rml_ecl_other_e;
273
   wire        exu_tlu_spill_e;
274
   wire         rml_ecl_kill_e;
275
   wire         rml_kill_w;
276
   wire         vld_w;
277
   wire         win_trap_e;
278
   wire         win_trap_m;
279
   wire         win_trap_w;
280
 
281
   assign       clk = rclk;
282
   // Reset flop
283
    dffrl_async rstff(.din (grst_l),
284
                        .q   (rml_reset_l),
285
                        .clk (clk),
286 113 albert.wat
                        .rst_l (arst_l), .se(se), `SIMPLY_RISC_SCANIN, .so());
287 95 fafa1971
   assign       reset = ~rml_reset_l;
288
 
289 113 albert.wat
   dff_s #(2) tid_s2d(.din(ifu_exu_tid_s2[1:0]), .clk(clk), .q(tid_d[1:0]), .se(se), `SIMPLY_RISC_SCANIN, .so());
290
   dff_s #(2) tid_d2e(.din(tid_d[1:0]), .clk(clk), .q(tid_e[1:0]), .se(se), `SIMPLY_RISC_SCANIN, .so());
291 95 fafa1971
   assign       thr_d[3] = tid_d[1] & tid_d[0];
292
   assign       thr_d[2] = tid_d[1] & ~tid_d[0];
293
   assign       thr_d[1] = ~tid_d[1] & tid_d[0];
294
   assign       thr_d[0] = ~tid_d[1] & ~tid_d[0];
295
 
296 113 albert.wat
   dff_s save_d2e(.din(ifu_exu_save_d), .clk(clk), .q(save_e), .se(se), `SIMPLY_RISC_SCANIN, .so());
297
   dff_s save_e2m(.din(save_e), .clk(clk), .q(save_m), .se(se), `SIMPLY_RISC_SCANIN, .so());
298
   dff_s restore_d2e(.din(ifu_exu_restore_d), .clk(clk), .q(restore_e), .se(se), `SIMPLY_RISC_SCANIN, .so());
299 95 fafa1971
 
300
   // don't check flush_pipe in w if caused by rml trap.  Things with a higher priority
301
   // than a window trap have been accumulated into ecl_rml_kill_w
302
   assign       vld_w = ecl_rml_inst_vld_w & (~ecl_rml_early_flush_w | win_trap_w);
303
   assign     rml_kill_w = ecl_rml_kill_w | ~vld_w;
304
 
305
   assign     win_trap_e = rml_ecl_fill_e | exu_tlu_spill_e | rml_ecl_clean_window_e;
306 113 albert.wat
   dff_s win_trap_e2m(.din(win_trap_e), .clk(clk), .q(win_trap_m), .se(se), `SIMPLY_RISC_SCANIN, .so());
307
   dff_s win_trap_m2w(.din(win_trap_m), .clk(clk), .q(win_trap_w), .se(se), `SIMPLY_RISC_SCANIN, .so());
308 95 fafa1971
 
309
   assign canrestore_is0_e = (~rml_ecl_canrestore_e[0] & ~rml_ecl_canrestore_e[1]
310
                              & ~rml_ecl_canrestore_e[2]);
311
   assign cansave_is0_e = (~rml_ecl_cansave_e[0] & ~rml_ecl_cansave_e[1] &
312
                           ~rml_ecl_cansave_e[2]);
313
   assign otherwin_is0_e = ~rml_ecl_other_e;
314
 
315
   ///////////////////////////////////////
316
   // Signals that operations are done
317
   // restore/return is not signalled here
318
   // because it depends on the write to the
319
   // irf (computed in ecl_wb)
320
   ////////////////////////////////////////
321
   assign rml_ecl_rmlop_done_e = (ifu_exu_saved_e | ifu_exu_restored_e |
322
                                  (ifu_exu_flushw_e & ~spill_trap_flush));
323
 
324
   //////////////////////////
325
   // Trap generation
326
   //////////////////////////
327
   // Fill trap generated on restore and canrestore == 0
328
   assign rml_ecl_fill_e = restore_e & canrestore_is0_e;
329
 
330
   // Spill trap on save with cansave == 0
331
   assign spill_trap_save = save_e & cansave_is0_e;
332
   assign exu_ifu_spill_e = spill_trap_save;
333
   // Spill trap on wflush with cansave != (NWINDOWS - 2 = 6)
334
   assign spill_trap_flush = (ifu_exu_flushw_e & ~(rml_ecl_cansave_e[2] &
335
                                                 rml_ecl_cansave_e[1] &
336
                                                 ~rml_ecl_cansave_e[0]));
337
   assign exu_tlu_spill_e = (spill_trap_save | spill_trap_flush);
338 113 albert.wat
   dff_s spill_e2m(.din(exu_tlu_spill_e), .clk(clk), .q(spill_m), .se(se), `SIMPLY_RISC_SCANIN, .so());
339 95 fafa1971
 
340
   // Clean window trap on save w/ cleanwin - canrestore == 0
341
   // or cleanwin == canrestore
342
   // (not signalled on spill traps because spill is higher priority)
343
   assign cleanwin_xor_canrestore = rml_ecl_cleanwin_e ^ rml_ecl_canrestore_e;
344
   assign rml_ecl_clean_window_e = ~(cleanwin_xor_canrestore[2] |
345
                                cleanwin_xor_canrestore[1] |
346
                                cleanwin_xor_canrestore[0]) & save_e & ~exu_tlu_spill_e;
347
 
348
   // Kill signal for w1 wen bit (all others don't care)
349
   assign rml_ecl_kill_e = rml_ecl_fill_e | exu_tlu_spill_e;
350 113 albert.wat
   dff_s rml_kill_e2m(.din(rml_ecl_kill_e), .clk(clk), .q(rml_ecl_kill_m),
351
                    .se(se), `SIMPLY_RISC_SCANIN, .so());
352 95 fafa1971
 
353
 
354
   // WTYPE generation
355
   assign rml_ecl_other_d = (rml_ecl_otherwin_d[0] | rml_ecl_otherwin_d[1]
356
                            | rml_ecl_otherwin_d[2]);
357 113 albert.wat
   dff_s other_d2e(.din(rml_ecl_other_d), .clk(clk), .q(rml_ecl_other_e), .se(se),
358
                 `SIMPLY_RISC_SCANIN, .so());
359 95 fafa1971
   mux2ds #(3) wtype_mux(.dout(rml_ecl_wtype_d[2:0]),
360
                          .in0(rml_ecl_wstate_d[2:0]),
361
                          .in1(rml_ecl_wstate_d[5:3]),
362
                          .sel0(~rml_ecl_other_d),
363
                          .sel1(rml_ecl_other_d));
364 113 albert.wat
   dff_s #(3) wtype_d2e(.din(rml_ecl_wtype_d[2:0]), .clk(clk), .q(rml_ecl_wtype_e[2:0]),
365
                    .se(se), `SIMPLY_RISC_SCANIN, .so());
366 95 fafa1971
 
367
 
368
   ////////////////////////////
369
   // Interface with IRF
370
   ////////////////////////////
371
   assign rml_irf_old_lo_cwp_e[2:0] = old_cwp_e[2:0];
372
   assign rml_irf_new_lo_cwp_e[2:0] = new_cwp_e[2:0];
373
   assign rml_irf_old_e_cwp_e[1:0] = (old_cwp_e[0])? old_cwp_e[2:1] + 2'b01: old_cwp_e[2:1];
374
   assign rml_irf_new_e_cwp_e[1:0] = (new_cwp_e[0])? new_cwp_e[2:1] + 2'b01: new_cwp_e[2:1];
375
 
376
   assign rml_irf_swap_local_e = (swap_e | swap_locals_ins);
377
   assign rml_irf_swap_odd_e = ((save_e | ecl_rml_cwp_wen_e | spill_trap_flush | swap_locals_ins) & old_cwp_e[0]) |
378
                                 ((restore_e | swap_outs) & ~old_cwp_e[0]);
379
   assign rml_irf_swap_even_e = ((save_e | ecl_rml_cwp_wen_e | spill_trap_flush | swap_locals_ins) & ~old_cwp_e[0]) |
380
                                  ((restore_e | swap_outs) & old_cwp_e[0]);
381
 
382
   assign swap_e = save_e | restore_e | ecl_rml_cwp_wen_e | spill_trap_flush;
383 113 albert.wat
   dff_s dff_did_restore_e2m(.din(swap_e), .clk(clk),
384 95 fafa1971
                       .q(did_restore_m), .se(se),
385 113 albert.wat
                       `SIMPLY_RISC_SCANIN, .so());
386
   dff_s dff_did_restore_m2w(.din(did_restore_m), .clk(clk),
387 95 fafa1971
                       .q(did_restore_w), .se(se),
388 113 albert.wat
                       `SIMPLY_RISC_SCANIN, .so());
389 95 fafa1971
   // kill restore on all saves (except those that spill) and any swaps that
390
   // get kill signals
391
   assign kill_restore_m = (~spill_m & save_m);
392 113 albert.wat
   dff_s dff_kill_restore_m2w(.din(kill_restore_m), .clk(clk), .q(kill_restore_w),
393
                            .se(se), `SIMPLY_RISC_SCANIN, .so());
394 95 fafa1971
   assign rml_irf_kill_restore_w = kill_restore_w | (did_restore_w & rml_kill_w);
395
 
396
 
397
   ///////////////////////////////
398
   // CWP logic
399
   ///////////////////////////////
400
   // Logic to compute next_cwp on spill trap.
401
   //  CWP = CWP + CANSAVE + 2
402
   assign spill_cwp_e[0] = rml_ecl_cwp_e[0] ^ rml_ecl_cansave_e[0];
403
   assign spill_cwp_carry0 = rml_ecl_cwp_e[0] & rml_ecl_cansave_e[0];
404
   assign spill_cwp_e[1] = rml_ecl_cwp_e[1] ^ rml_ecl_cansave_e[1] ^ ~spill_cwp_carry0;
405
   assign spill_cwp_carry1 = (rml_ecl_cwp_e[1] | rml_ecl_cansave_e[1] |
406
                              spill_cwp_carry0) & ~(rml_ecl_cwp_e[1] &
407
                                                    rml_ecl_cansave_e[1] &
408
                                                    spill_cwp_carry0);
409
   assign spill_cwp_e[2] = rml_ecl_cwp_e[2] ^ rml_ecl_cansave_e[2] ^ spill_cwp_carry1;
410
 
411
   assign rml_cwp_wen_e = (save_e | restore_e) & ~exu_tlu_spill_e;
412
   assign cwp_wen_e = (rml_cwp_wen_e | ecl_rml_cwp_wen_e) & ~ecl_rml_kill_e;
413
   sparc_exu_rml_inc3 cwp_inc(.dout(rml_next_cwp_e[2:0]), .din(rml_ecl_cwp_e[2:0]),
414
                                  .inc(save_e));
415
 
416
   assign     next_cwp_sel_inc = ~(ecl_rml_cwp_wen_e | exu_tlu_spill_e);
417
   mux3ds #(3) next_cwp_mux(.dout(next_cwp_e[2:0]),
418
                          .in0(rml_next_cwp_e[2:0]),
419
                          .in1(ecl_rml_xor_data_e[2:0]),
420
                          .in2(spill_cwp_e[2:0]),
421
                          .sel0(next_cwp_sel_inc),
422
                          .sel1(ecl_rml_cwp_wen_e),
423
                          .sel2(exu_tlu_spill_e));
424
 
425 113 albert.wat
   dff_s cwp_wen_e2m(.din(cwp_wen_e), .clk(clk), .q(rml_cwp_wen_m),
426
                       .se(se), `SIMPLY_RISC_SCANIN, .so());
427
   dff_s #(3) next_cwp_e2m(.din(next_cwp_e[2:0]), .clk(clk), .q(next_cwp_m[2:0]),
428
                           .se(se), `SIMPLY_RISC_SCANIN, .so());
429 95 fafa1971
   assign     cwp_wen_m = rml_cwp_wen_m;
430 113 albert.wat
   dff_s #(3) next_cwp_m2w(.din(next_cwp_m[2:0]), .clk(clk), .q(next_cwp_noreset_w[2:0]),
431
                         .se(se), `SIMPLY_RISC_SCANIN, .so());
432
   dff_s cwp_wen_m2w(.din(cwp_wen_m), .clk(clk), .q(cwp_wen_nokill_w),
433
                       .se(se), `SIMPLY_RISC_SCANIN, .so());
434 95 fafa1971
   assign cwp_wen_w = cwp_wen_nokill_w & ~rml_kill_w;
435
   assign next_cwp_w[2:0] = next_cwp_noreset_w[2:0];
436
 
437
   assign full_swap_e = (exu_tlu_spill_e | ecl_rml_cwp_wen_e);
438
 
439
 
440
   // oddwin signal for ifu needs bypass from w.  It is done in M and staged for timing.
441
   // This is possible because the thread is switched out so there is only one bypass condition.
442
   // Only save/return will switch in fast enough for a bypass so this is the only write condition
443
   // we need to check
444
   wire [3:0] oddwin_m;
445
   wire [3:0] oddwin_w;
446
   assign     oddwin_m[3] = (cwp_wen_m & ecl_rml_thr_m[3])? next_cwp_m[0]: oddwin_w[3];
447
   assign     oddwin_m[2] = (cwp_wen_m & ecl_rml_thr_m[2])? next_cwp_m[0]: oddwin_w[2];
448
   assign     oddwin_m[1] = (cwp_wen_m & ecl_rml_thr_m[1])? next_cwp_m[0]: oddwin_w[1];
449
   assign     oddwin_m[0] = (cwp_wen_m & ecl_rml_thr_m[0])? next_cwp_m[0]: oddwin_w[0];
450 113 albert.wat
   dff_s #(4) oddwin_dff(.din(oddwin_m[3:0]), .clk(clk), .q(exu_ifu_oddwin_s[3:0]),
451
                       .se(se), `SIMPLY_RISC_SCANIN, .so());
452 95 fafa1971
 
453
   sparc_exu_rml_cwp cwp(
454
                         .swap_outs     (swap_outs),
455
                         .swap_locals_ins(swap_locals_ins),
456
                         .rml_ecl_cwp_e (rml_ecl_cwp_e[2:0]),
457
                         .old_cwp_e     (old_cwp_e[2:0]),
458
                         .new_cwp_e     (new_cwp_e[2:0]),
459
                         .oddwin_w     (oddwin_w[3:0]),
460
                         /*AUTOINST*/
461
                         // Outputs
462
                         .rml_ecl_cwp_d (rml_ecl_cwp_d[2:0]),
463
                         .exu_tlu_cwp0_w(exu_tlu_cwp0_w[2:0]),
464
                         .exu_tlu_cwp1_w(exu_tlu_cwp1_w[2:0]),
465
                         .exu_tlu_cwp2_w(exu_tlu_cwp2_w[2:0]),
466
                         .exu_tlu_cwp3_w(exu_tlu_cwp3_w[2:0]),
467
                         .rml_irf_cwpswap_tid_e(rml_irf_cwpswap_tid_e[1:0]),
468
                         .exu_tlu_spill (exu_tlu_spill),
469
                         .exu_tlu_spill_wtype(exu_tlu_spill_wtype[2:0]),
470
                         .exu_tlu_spill_other(exu_tlu_spill_other),
471
                         .exu_tlu_spill_tid(exu_tlu_spill_tid[1:0]),
472
                         .rml_ecl_swap_done(rml_ecl_swap_done[3:0]),
473
                         .exu_tlu_cwp_cmplt(exu_tlu_cwp_cmplt),
474
                         .exu_tlu_cwp_cmplt_tid(exu_tlu_cwp_cmplt_tid[1:0]),
475
                         .exu_tlu_cwp_retry(exu_tlu_cwp_retry),
476
                         // Inputs
477
                         .clk           (clk),
478
                         .se            (se),
479
                         .reset         (reset),
480
                         .rst_tri_en    (rst_tri_en),
481
                         .rml_ecl_wtype_e(rml_ecl_wtype_e[2:0]),
482
                         .rml_ecl_other_e(rml_ecl_other_e),
483
                         .exu_tlu_spill_e(exu_tlu_spill_e),
484
                         .tlu_exu_cwpccr_update_m(tlu_exu_cwpccr_update_m),
485
                         .tlu_exu_cwp_retry_m(tlu_exu_cwp_retry_m),
486
                         .tlu_exu_cwp_m (tlu_exu_cwp_m[2:0]),
487
                         .thr_d         (thr_d[3:0]),
488
                         .ecl_rml_thr_m (ecl_rml_thr_m[3:0]),
489
                         .ecl_rml_thr_w (ecl_rml_thr_w[3:0]),
490
                         .tid_e         (tid_e[1:0]),
491
                         .next_cwp_w    (next_cwp_w[2:0]),
492
                         .next_cwp_e    (next_cwp_e[2:0]),
493
                         .cwp_wen_w     (cwp_wen_w),
494
                         .save_e        (save_e),
495
                         .restore_e     (restore_e),
496
                         .ifu_exu_flushw_e(ifu_exu_flushw_e),
497
                         .ecl_rml_cwp_wen_e(ecl_rml_cwp_wen_e),
498
                         .full_swap_e   (full_swap_e),
499
                         .rml_kill_w    (rml_kill_w));
500
 
501
   ///////////////////////////////
502
   // Cansave logic
503
   ///////////////////////////////
504
   assign cansave_wen_e = ((save_e & ~cansave_is0_e & ~rml_ecl_clean_window_e) |
505
                           ifu_exu_saved_e |
506
                           (restore_e & ~canrestore_is0_e) |
507
                           (ifu_exu_restored_e & otherwin_is0_e));
508
   sparc_exu_rml_inc3 cansave_inc(.dout(rml_next_cansave_e[2:0]), .din(rml_ecl_cansave_e[2:0]),
509
                                  .inc(cansave_inc_e));
510
   assign cansave_inc_e = restore_e | ifu_exu_saved_e;
511
 
512
   mux2ds #(3) next_cansave_mux(.dout(next_cansave_e[2:0]),
513
                              .in0(ecl_rml_xor_data_e[2:0]),
514
                              .in1(rml_next_cansave_e[2:0]),
515
                              .sel0(~cansave_wen_e),
516
                              .sel1(cansave_wen_e));
517 113 albert.wat
   dff_s cansave_wen_e2m(.din(cansave_wen_e), .clk(clk), .q(cansave_wen_m),
518
                       .se(se), `SIMPLY_RISC_SCANIN, .so());
519
   dff_s #(3) next_cansave_e2m(.din(next_cansave_e[2:0]), .clk(clk), .q(next_cansave_m[2:0]),
520
                           .se(se), `SIMPLY_RISC_SCANIN, .so());
521 95 fafa1971
   assign cansave_wen_valid_m = cansave_wen_m;
522 113 albert.wat
   dff_s cansave_wen_m2w(.din(cansave_wen_valid_m), .clk(clk), .q(rml_cansave_wen_w),
523
                       .se(se), `SIMPLY_RISC_SCANIN, .so());
524
   dff_s #(3) next_cansave_m2w(.din(next_cansave_m[2:0]), .clk(clk), .q(next_cansave_w[2:0]),
525
                           .se(se), `SIMPLY_RISC_SCANIN, .so());
526 95 fafa1971
   assign cansave_wen_w = (rml_cansave_wen_w | ecl_rml_cansave_wen_w) & ~rml_kill_w;
527
 
528
   ///////////////////////////////
529
   // Canrestore logic
530
   ///////////////////////////////
531
   assign canrestore_wen_e = ((save_e & ~cansave_is0_e & ~rml_ecl_clean_window_e) |
532
                              ifu_exu_restored_e |
533
                              (restore_e & ~canrestore_is0_e) |
534
                              (ifu_exu_saved_e & otherwin_is0_e));
535
   sparc_exu_rml_inc3 canrestore_inc(.dout(rml_next_canrestore_e[2:0]),
536
                                     .din(rml_ecl_canrestore_e[2:0]),
537
                                     .inc(canrestore_inc_e));
538
   assign canrestore_inc_e = ifu_exu_restored_e | save_e;
539
 
540
   mux2ds #(3) next_canrestore_mux(.dout(next_canrestore_e[2:0]),
541
                                    .in0(ecl_rml_xor_data_e[2:0]),
542
                                    .in1(rml_next_canrestore_e[2:0]),
543
                                    .sel0(~canrestore_wen_e),
544
                                    .sel1(canrestore_wen_e));
545 113 albert.wat
   dff_s canrestore_wen_e2m(.din(canrestore_wen_e), .clk(clk), .q(canrestore_wen_m),
546
                       .se(se), `SIMPLY_RISC_SCANIN, .so());
547
   dff_s #(3) next_canrestore_e2m(.din(next_canrestore_e[2:0]), .clk(clk), .q(next_canrestore_m[2:0]),
548
                           .se(se), `SIMPLY_RISC_SCANIN, .so());
549 95 fafa1971
   assign canrestore_wen_valid_m = canrestore_wen_m;
550 113 albert.wat
   dff_s canrestore_wen_m2w(.din(canrestore_wen_valid_m), .clk(clk), .q(rml_canrestore_wen_w),
551
                       .se(se), `SIMPLY_RISC_SCANIN, .so());
552
   dff_s #(3) next_canrestore_m2w(.din(next_canrestore_m[2:0]), .clk(clk), .q(next_canrestore_w[2:0]),
553
                           .se(se), `SIMPLY_RISC_SCANIN, .so());
554 95 fafa1971
   assign canrestore_wen_w = (rml_canrestore_wen_w | ecl_rml_canrestore_wen_w) & ~rml_kill_w;
555
 
556
   ///////////////////////////////
557
   // Otherwin logic
558
   ///////////////////////////////
559
   // Decrements on saved or restored if otherwin != 0
560
   assign otherwin_wen_e = ((ifu_exu_saved_e | ifu_exu_restored_e)
561
                            & ~otherwin_is0_e);
562
   assign rml_next_otherwin_e[2] = ((rml_ecl_otherwin_e[2] & rml_ecl_otherwin_e[1]) |
563
                                (rml_ecl_otherwin_e[2] & rml_ecl_otherwin_e[0]));
564
   assign rml_next_otherwin_e[1] = rml_ecl_otherwin_e[1] ^ ~rml_ecl_otherwin_e[0];
565
   assign rml_next_otherwin_e[0] = ~rml_ecl_otherwin_e[0];
566
 
567
   mux2ds #(3) next_otherwin_mux(.dout(next_otherwin_e[2:0]),
568
                               .in0(ecl_rml_xor_data_e[2:0]),
569
                               .in1(rml_next_otherwin_e[2:0]),
570
                               .sel0(~otherwin_wen_e),
571
                               .sel1(otherwin_wen_e));
572 113 albert.wat
   dff_s otherwin_wen_e2m(.din(otherwin_wen_e), .clk(clk), .q(otherwin_wen_m),
573
                       .se(se), `SIMPLY_RISC_SCANIN, .so());
574
   dff_s #(3) next_otherwin_e2m(.din(next_otherwin_e[2:0]), .clk(clk), .q(next_otherwin_m[2:0]),
575
                           .se(se), `SIMPLY_RISC_SCANIN, .so());
576 95 fafa1971
   assign otherwin_wen_valid_m = otherwin_wen_m;
577 113 albert.wat
   dff_s otherwin_wen_m2w(.din(otherwin_wen_valid_m), .clk(clk), .q(rml_otherwin_wen_w),
578
                       .se(se), `SIMPLY_RISC_SCANIN, .so());
579
   dff_s #(3) next_otherwin_m2w(.din(next_otherwin_m[2:0]), .clk(clk), .q(next_otherwin_w[2:0]),
580
                           .se(se), `SIMPLY_RISC_SCANIN, .so());
581 95 fafa1971
   assign otherwin_wen_w = (rml_otherwin_wen_w | ecl_rml_otherwin_wen_w) & ~rml_kill_w;
582
 
583
   ///////////////////////////////
584
   // Cleanwin logic
585
   ///////////////////////////////
586
   // increments on restored if cleanwin != 7
587
   assign cleanwin_wen_e = (ifu_exu_restored_e &
588
                            ~(rml_ecl_cleanwin_e[2] & rml_ecl_cleanwin_e[1]
589
                              & rml_ecl_cleanwin_e[0]));
590
   assign rml_next_cleanwin_e[2] = ((~rml_ecl_cleanwin_e[2] & rml_ecl_cleanwin_e[1]
591
                                 & rml_ecl_cleanwin_e[0]) | rml_ecl_cleanwin_e[2]);
592
   assign rml_next_cleanwin_e[1] = rml_ecl_cleanwin_e[1] ^ rml_ecl_cleanwin_e[0];
593
   assign rml_next_cleanwin_e[0] = ~rml_ecl_cleanwin_e[0];
594
 
595
   mux2ds #(3) next_cleanwin_mux(.dout(next_cleanwin_e[2:0]),
596
                                  .in0(ecl_rml_xor_data_e[2:0]),
597
                                  .in1(rml_next_cleanwin_e[2:0]),
598
                                  .sel0(~cleanwin_wen_e),
599
                                  .sel1(cleanwin_wen_e));
600 113 albert.wat
   dff_s cleanwin_wen_e2m(.din(cleanwin_wen_e), .clk(clk), .q(cleanwin_wen_m),
601
                       .se(se), `SIMPLY_RISC_SCANIN, .so());
602
   dff_s #(3) next_cleanwin_e2m(.din(next_cleanwin_e[2:0]), .clk(clk), .q(next_cleanwin_m[2:0]),
603
                           .se(se), `SIMPLY_RISC_SCANIN, .so());
604 95 fafa1971
   assign cleanwin_wen_valid_m = cleanwin_wen_m;
605 113 albert.wat
   dff_s cleanwin_wen_m2w(.din(cleanwin_wen_valid_m), .clk(clk), .q(rml_cleanwin_wen_w),
606
                       .se(se), `SIMPLY_RISC_SCANIN, .so());
607
   dff_s #(3) next_cleanwin_m2w(.din(next_cleanwin_m[2:0]), .clk(clk), .q(next_cleanwin_w[2:0]),
608
                           .se(se), `SIMPLY_RISC_SCANIN, .so());
609 95 fafa1971
   assign cleanwin_wen_w = (rml_cleanwin_wen_w | ecl_rml_cleanwin_wen_w) & ~rml_kill_w;
610
 
611
   ///////////////////////////////
612
   // WSTATE logic
613
   ///////////////////////////////
614
   assign wstate_wen_w = ecl_rml_wstate_wen_w & ~rml_kill_w;
615
 
616
   ///////////////////////////////
617
   // Storage of other WMRs
618
   ///////////////////////////////
619
   sparc_exu_reg  cansave_reg(.clk(clk), .se(se),
620
                                .data_out(rml_ecl_cansave_d[2:0]), .thr_out(thr_d[3:0]),
621
                                .thr_w(ecl_rml_thr_w[3:0]),
622
                              .wen_w(cansave_wen_w), .data_in_w(next_cansave_w[2:0]));
623 113 albert.wat
   dff_s #(3) cansave_d2e(.din(rml_ecl_cansave_d[2:0]), .clk(clk), .q(rml_ecl_cansave_e[2:0]), .se(se),
624
                  `SIMPLY_RISC_SCANIN, .so());
625 95 fafa1971
   sparc_exu_reg  canrestore_reg(.clk(clk), .se(se),
626
                                   .data_out(rml_ecl_canrestore_d[2:0]), .thr_out(thr_d[3:0]),
627
                                   .thr_w(ecl_rml_thr_w[3:0]),
628
                                   .wen_w(canrestore_wen_w),
629
                                   .data_in_w(next_canrestore_w[2:0]));
630 113 albert.wat
   dff_s #(3) canrestore_d2e(.din(rml_ecl_canrestore_d[2:0]), .clk(clk), .q(rml_ecl_canrestore_e[2:0]),
631
                         .se(se), `SIMPLY_RISC_SCANIN, .so());
632 95 fafa1971
   sparc_exu_reg  otherwin_reg(.clk(clk), .se(se),
633
                                 .data_out(rml_ecl_otherwin_d[2:0]), .thr_out(thr_d[3:0]),
634
                                 .thr_w(ecl_rml_thr_w[3:0]),
635
                                 .wen_w(otherwin_wen_w), .data_in_w(next_otherwin_w[2:0]));
636 113 albert.wat
   dff_s #(3) otherwin_d2e(.din(rml_ecl_otherwin_d[2:0]), .clk(clk), .q(rml_ecl_otherwin_e[2:0]),
637
                       .se(se), `SIMPLY_RISC_SCANIN, .so());
638 95 fafa1971
   sparc_exu_reg  cleanwin_reg(.clk(clk), .se(se),
639
                                 .data_out(rml_ecl_cleanwin_d[2:0]), .thr_out(thr_d[3:0]),
640
                                 .thr_w(ecl_rml_thr_w[3:0]),
641
                                 .wen_w(cleanwin_wen_w), .data_in_w(next_cleanwin_w[2:0]));
642 113 albert.wat
   dff_s #(3) cleanwin_d2e(.din(rml_ecl_cleanwin_d[2:0]), .clk(clk), .q(rml_ecl_cleanwin_e[2:0]),
643
                       .se(se), `SIMPLY_RISC_SCANIN, .so());
644 95 fafa1971
   sparc_exu_reg hi_wstate_reg(.clk(clk), .se(se),
645
                               .data_out(rml_ecl_wstate_d[5:3]), .thr_out(thr_d[3:0]),
646
                               .thr_w(ecl_rml_thr_w[3:0]),
647
                               .wen_w(wstate_wen_w),
648
                               .data_in_w(exu_tlu_wsr_data_w[5:3]));
649
   sparc_exu_reg lo_wstate_reg(.clk(clk), .se(se),
650
                               .data_out(rml_ecl_wstate_d[2:0]), .thr_out(thr_d[3:0]),
651
                               .thr_w(ecl_rml_thr_w[3:0]),
652
                               .wen_w(wstate_wen_w),
653
                               .data_in_w(exu_tlu_wsr_data_w[2:0]));
654
 
655
 
656
   /////////////////////////////////
657
   // Alternate Globals control
658
   //----------------------------
659
   /////////////////////////////////
660
   assign rml_irf_new_agp[1:0] = tlu_exu_agp[1:0];
661
   assign agp_tid[1:0] = tlu_exu_agp_tid[1:0];
662
 
663 113 albert.wat
`ifdef FPGA_SYN_1THREAD
664
   assign rml_irf_old_agp[1:0] = agp_thr0[1:0];
665
   assign        agp_wen_thr0_w = (agp_thr[0] & agp_wen) | reset;
666
   // mux between new and current value
667
   mux2ds #(2) agp_next0_mux(.dout(agp_thr0_next[1:0]),
668
                               .in0(agp_thr0[1:0]),
669
                               .in1(new_agp[1:0]),
670
                               .sel0(~agp_wen_thr0_w),
671
                               .sel1(agp_wen_thr0_w));
672
   dff_s #(2) dff_agp_thr0(.din(agp_thr0_next[1:0]), .clk(clk), .q(agp_thr0[1:0]),
673
                       .se(se), `SIMPLY_RISC_SCANIN, .so());
674
   // generation of controls
675
   assign        agp_wen = tlu_exu_agp_swap;
676
   assign        rml_irf_swap_global = agp_wen;
677
   assign        rml_irf_global_tid[1:0] = agp_tid[1:0];
678 95 fafa1971
 
679 113 albert.wat
   // decode tids
680
   assign        agp_thr[0] = ~agp_tid[1] & ~agp_tid[0];
681
      // Decode agp input
682
   assign new_agp[1:0] = rml_irf_new_agp[1:0] | {2{reset}};
683 95 fafa1971
 
684 113 albert.wat
   // send current global level to ecl for error logging
685
   assign rml_ecl_gl_e[1:0] = agp_thr0[1:0];
686
 
687
`else
688 95 fafa1971
 
689
   //  Output selection for current agp
690
   mux4ds #(2) mux_agp_out1(.dout(rml_irf_old_agp[1:0]),
691
                            .sel0(agp_thr[0]),
692
                            .sel1(agp_thr[1]),
693
                            .sel2(agp_thr[2]),
694
                            .sel3(agp_thr[3]),
695
                            .in0(agp_thr0[1:0]),
696
                            .in1(agp_thr1[1:0]),
697
                            .in2(agp_thr2[1:0]),
698
                            .in3(agp_thr3[1:0]));
699
 
700
   //////////////////////////////////////
701
   //  Storage of agp
702
   //////////////////////////////////////
703
 
704
   // enable input for each thread
705
   assign        agp_wen_thr0_w = (agp_thr[0] & agp_wen) | reset;
706
   assign        agp_wen_thr1_w = (agp_thr[1] & agp_wen) | reset;
707
   assign        agp_wen_thr2_w = (agp_thr[2] & agp_wen) | reset;
708
   assign        agp_wen_thr3_w = (agp_thr[3] & agp_wen) | reset;
709
 
710
   // mux between new and current value
711
   mux2ds #(2) agp_next0_mux(.dout(agp_thr0_next[1:0]),
712
                               .in0(agp_thr0[1:0]),
713
                               .in1(new_agp[1:0]),
714
                               .sel0(~agp_wen_thr0_w),
715
                               .sel1(agp_wen_thr0_w));
716
   mux2ds #(2) agp_next1_mux(.dout(agp_thr1_next[1:0]),
717
                               .in0(agp_thr1[1:0]),
718
                               .in1(new_agp[1:0]),
719
                               .sel0(~agp_wen_thr1_w),
720
                               .sel1(agp_wen_thr1_w));
721
   mux2ds #(2) agp_next2_mux(.dout(agp_thr2_next[1:0]),
722
                               .in0(agp_thr2[1:0]),
723
                               .in1(new_agp[1:0]),
724
                               .sel0(~agp_wen_thr2_w),
725
                               .sel1(agp_wen_thr2_w));
726
   mux2ds #(2) agp_next3_mux(.dout(agp_thr3_next[1:0]),
727
                               .in0(agp_thr3[1:0]),
728
                               .in1(new_agp[1:0]),
729
                               .sel0(~agp_wen_thr3_w),
730
                               .sel1(agp_wen_thr3_w));
731
 
732
   // store new value
733 113 albert.wat
   dff_s #(2) dff_agp_thr0(.din(agp_thr0_next[1:0]), .clk(clk), .q(agp_thr0[1:0]),
734
                       .se(se), `SIMPLY_RISC_SCANIN, .so());
735
   dff_s #(2) dff_agp_thr1(.din(agp_thr1_next[1:0]), .clk(clk), .q(agp_thr1[1:0]),
736
                       .se(se), `SIMPLY_RISC_SCANIN, .so());
737
   dff_s #(2) dff_agp_thr2(.din(agp_thr2_next[1:0]), .clk(clk), .q(agp_thr2[1:0]),
738
                       .se(se), `SIMPLY_RISC_SCANIN, .so());
739
   dff_s #(2) dff_agp_thr3(.din(agp_thr3_next[1:0]), .clk(clk), .q(agp_thr3[1:0]),
740
                       .se(se), `SIMPLY_RISC_SCANIN, .so());
741 95 fafa1971
 
742
   // generation of controls
743
   assign        agp_wen = tlu_exu_agp_swap;
744
   assign        rml_irf_swap_global = agp_wen;
745
   assign        rml_irf_global_tid[1:0] = agp_tid[1:0];
746
 
747
   // decode tids
748
   assign        agp_thr[0] = ~agp_tid[1] & ~agp_tid[0];
749
   assign        agp_thr[1] = ~agp_tid[1] & agp_tid[0];
750
   assign        agp_thr[2] = agp_tid[1] & ~agp_tid[0];
751
   assign        agp_thr[3] = agp_tid[1] & agp_tid[0];
752
 
753
   // Decode agp input
754
   assign new_agp[1:0] = rml_irf_new_agp[1:0] | {2{reset}};
755
 
756
   // send current global level to ecl for error logging
757
   assign rml_ecl_gl_e[1:0] = ((tid_e[1:0] == 2'b00)? agp_thr0[1:0]:
758
                               (tid_e[1:0] == 2'b01)? agp_thr1[1:0]:
759
                               (tid_e[1:0] == 2'b10)? agp_thr2[1:0]:
760
                                                              agp_thr3[1:0]);
761 113 albert.wat
`endif // !`ifdef FPGA_SYN_1THREAD
762 95 fafa1971
 
763
endmodule // sparc_exu_rml

powered by: WebSVN 2.1.0

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