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

Subversion Repositories sparc64soc

[/] [sparc64soc/] [trunk/] [T1-CPU/] [spu/] [spu_mactl.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dmitryr
// ========== Copyright Header Begin ==========================================
2
// 
3
// OpenSPARC T1 Processor File: spu_mactl.v
4
// Copyright (c) 2006 Sun Microsystems, Inc.  All Rights Reserved.
5
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
6
// 
7
// The above named program is free software; you can redistribute it and/or
8
// modify it under the terms of the GNU General Public
9
// License version 2 as published by the Free Software Foundation.
10
// 
11
// The above named program is distributed in the hope that it will be 
12
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
// General Public License for more details.
15
// 
16
// You should have received a copy of the GNU General Public
17
// License along with this work; if not, write to the Free Software
18
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19
// 
20
// ========== Copyright Header End ============================================
21
////////////////////////////////////////////////////////////////////////
22
/*
23
//      Description:    control for MA.
24
*/
25
////////////////////////////////////////////////////////////////////////
26
// Global header file includes
27
////////////////////////////////////////////////////////////////////////
28
 
29
 
30
module spu_mactl (
31
 
32
/*outputs*/
33
spu_mactl_iss_pulse,
34
spu_mactl_mpa_wen,
35
spu_mactl_maaddr_wen,
36
spu_mactl_manp_wen,
37
 
38
spu_mactl_ldop,
39
spu_mactl_stop,
40
spu_mactl_mulop,
41
spu_mactl_redop,
42
spu_mactl_expop,
43
 
44
spu_mactl_memmxsel_l,
45
 
46
spu_mactl_memeve_wen,
47
spu_mactl_memodd_wen,
48
 
49
spu_mactl_mamem_ren,
50
spu_mactl_mamem_wen,
51
 
52
spu_mactl_iss_pulse_dly,
53
 
54
spu_mactl_ldxa_data_w_sel_l,
55
spu_mactl_ldxa_data_w_select,
56
 
57
spu_mactl_mpa_sel,
58
 
59
spu_mactl_madp_parflop_wen,
60
 
61
spu_lsu_ldxa_data_vld_w2,
62
spu_lsu_ldxa_tid_w2,
63
spu_lsu_stxa_ack,
64
 
65
spu_lsu_stxa_ack_tid,
66
 
67
spu_mactl_ldxa_mactl_reg,
68
 
69
spu_mactl_force_perr,
70
 
71
spu_ifu_ttype_w2,
72
spu_ifu_ttype_vld_w2,
73
spu_ifu_ttype_tid_w,
74
 
75
spu_tlu_rsrv_illgl_m,
76
 
77
 
78
spu_ifu_corr_err_w2,
79
spu_ifu_unc_err_w,
80
spu_lsu_unc_error_w,
81
 
82
spu_ifu_mamem_err_w,
83
spu_ifu_int_w2,
84
spu_lsu_ldxa_illgl_va_w2,
85
 
86
 
87
spu_mactl_streq,
88
 
89
spu_mactl_ctl_reset,
90
spu_mactl_mem_reset_l,
91
 
92
 
93
spu_mactl_ma_kill_op,
94
 
95
spu_mactl_stxa_force_abort,
96
 
97
spu_mactl_mactl_len,
98
 
99
spu_mactl_uncerr_rst,
100
 
101
spu_mactl_iss_pulse_pre,
102
 
103
spu_mactl_pcx_wen,
104
spu_mactl_pcx_7170_sel,
105
 
106
spu_mactl_perr_set,
107
 
108
/*inputs*/
109
 
110
spu_mast_streq,
111
 
112
 
113
lsu_spu_stb_empty,
114
 
115
spu_maaddr_maaddr_0,
116
spu_maaddr_mpa_3,
117
 
118
spu_mald_memwen,
119
spu_mamul_memwen,
120
spu_mamul_memren,
121
spu_maaeqb_memwen,
122
spu_maaeqb_memren,
123
 
124
spu_mared_memren,
125
spu_mared_memwen,
126
 
127
spu_mast_memren,
128
 
129
lsu_spu_early_flush_g,
130
tlu_spu_flush_w,
131
ifu_spu_flush_w,
132
ifu_spu_inst_vld_w,
133
lsu_spu_asi_state_e,
134
ifu_lsu_ld_inst_e,
135
ifu_lsu_st_inst_e,
136
ifu_lsu_alt_space_e,
137
ifu_tlu_thrid_e,
138
exu_lsu_ldst_va_e,
139
 
140
spu_mald_done_set,
141
spu_mast_done_set,
142
spu_mared_done_set,
143
spu_maexp_done_set,
144
 
145
spu_maexp_memren,
146
 
147
spu_maaddr_nooddwr_on_leneq1,
148
 
149
spu_mared_not_idle,
150
spu_mamul_oprnd2_bypass,
151
 
152
spu_madp_perr,
153
 
154
ma_ctl_reg_data,
155
 
156
ifu_spu_trap_ack,
157
 
158
 
159
spu_mactl_rsrv_data_e,
160
 
161
 
162
 
163
spu_maaddr_len_cntr,
164
 
165
 
166
spu_wen_ma_unc_err,
167
spu_wen_ma_cor_err,
168
 
169
ifu_spu_nceen,
170
 
171
lsu_spu_ldst_ack,
172
mux_drive_disable,
173
 
174
 
175
se,
176
grst_l,
177
arst_l,
178
rclk);
179
 
180
// ---------------------------------------------
181
input grst_l;
182
input arst_l;
183
input rclk;
184
input se;
185
 
186
 
187
input spu_mald_memwen;
188
input spu_mamul_memwen;
189
input spu_mamul_memren;
190
input spu_maaeqb_memwen;
191
input spu_maaeqb_memren;
192
 
193
input spu_maaddr_maaddr_0;
194
input  spu_maaddr_mpa_3;
195
 
196
input  spu_mared_memren;
197
input  spu_mared_memwen;
198
 
199
input  spu_mast_memren;
200
 
201
 
202
input lsu_spu_early_flush_g;
203
input tlu_spu_flush_w;
204
input ifu_spu_flush_w;
205
input ifu_spu_inst_vld_w;
206
input [7:0] lsu_spu_asi_state_e;
207
input ifu_lsu_ld_inst_e;
208
input ifu_lsu_st_inst_e;
209
input ifu_lsu_alt_space_e;
210
input [1:0] ifu_tlu_thrid_e;
211
input [7:0] exu_lsu_ldst_va_e;
212
 
213
input spu_mald_done_set;
214
input spu_mast_done_set;
215
input spu_mared_done_set;
216
input spu_maexp_done_set;
217
 
218
input spu_maexp_memren;
219
 
220
input spu_maaddr_nooddwr_on_leneq1;
221
 
222
input spu_mared_not_idle;
223
input spu_mamul_oprnd2_bypass;
224
 
225
input spu_madp_perr;
226
 
227
input [13:0] ma_ctl_reg_data;
228
 
229
input ifu_spu_trap_ack;
230
 
231
 
232
input [2:0] spu_mactl_rsrv_data_e;
233
 
234
 
235
 
236
input [3:0] lsu_spu_stb_empty;
237
 
238
input spu_mast_streq;
239
 
240
input [5:0] spu_maaddr_len_cntr;
241
 
242
 
243
 
244
input spu_wen_ma_unc_err;
245
input spu_wen_ma_cor_err;
246
 
247
 
248
input [3:0] ifu_spu_nceen;
249
 
250
input lsu_spu_ldst_ack;
251
input mux_drive_disable;
252
 
253
// ---------------------------------------------
254
 
255
output spu_mactl_iss_pulse;
256
 
257
output spu_mactl_mpa_wen;
258
output spu_mactl_maaddr_wen;
259
output spu_mactl_manp_wen;
260
 
261
output spu_mactl_ldop;
262
output spu_mactl_stop;
263
output spu_mactl_mulop;
264
output spu_mactl_redop;
265
output spu_mactl_expop;
266
 
267
output [2:0] spu_mactl_memmxsel_l;
268
 
269
output spu_mactl_memeve_wen;
270
output spu_mactl_memodd_wen;
271
 
272
output spu_mactl_mamem_ren;
273
output spu_mactl_mamem_wen;
274
 
275
output spu_mactl_iss_pulse_dly;
276
 
277
output [3:0] spu_mactl_ldxa_data_w_sel_l;
278
output spu_mactl_ldxa_data_w_select;
279
 
280
output spu_mactl_mpa_sel;
281
 
282
output spu_mactl_madp_parflop_wen;
283
 
284
output spu_lsu_ldxa_data_vld_w2;
285
output [1:0] spu_lsu_ldxa_tid_w2;
286
output spu_lsu_stxa_ack;
287
output [1:0] spu_lsu_stxa_ack_tid;
288
 
289
 
290
output [13:0] spu_mactl_ldxa_mactl_reg;
291
 
292
output spu_mactl_force_perr;
293
 
294
output spu_ifu_ttype_w2;
295
output spu_ifu_ttype_vld_w2;
296
output [1:0] spu_ifu_ttype_tid_w;
297
 
298
output spu_tlu_rsrv_illgl_m;
299
 
300
 
301
output spu_ifu_corr_err_w2;
302
output spu_ifu_unc_err_w;
303
output spu_lsu_unc_error_w;
304
 
305
output spu_ifu_mamem_err_w;
306
output spu_ifu_int_w2;
307
output spu_lsu_ldxa_illgl_va_w2;
308
 
309
output spu_mactl_streq;
310
 
311
output spu_mactl_ctl_reset;
312
output spu_mactl_mem_reset_l;
313
 
314
 
315
output spu_mactl_ma_kill_op;
316
 
317
output spu_mactl_stxa_force_abort;
318
 
319
output [5:0] spu_mactl_mactl_len;
320
 
321
output spu_mactl_uncerr_rst;
322
 
323
output spu_mactl_iss_pulse_pre;
324
 
325
output spu_mactl_pcx_wen;
326
output spu_mactl_pcx_7170_sel;
327
 
328
output spu_mactl_perr_set;
329
 
330
 
331
// -------------------------------------------------------------------------
332
// -------------------------------------------------------------------------
333
// -------------------------------------------------------------------------
334
 
335
wire [1:0] spu_mactl_ldxa_tid_g2;
336
wire [1:0] spu_mactl_ldxa_tid_w;
337
wire spu_mactl_clr_busy_bit;
338
wire spu_mactl_busy_bit_wen,spu_mactl_busy_bit_wrdata;
339
 
340
wire clr_busy_bit_when_masync;
341
 
342
wire spu_mactl_mactl_wen;
343
wire ma_op_done;
344
wire spu_mactl_rsrv_done_set;
345
wire spu_mactl_rsrv_wrdetect_m;
346
wire spu_mactl_perr_set_int;
347
wire spu_mactl_disable_stxa_ack_g2;
348
wire wait_4stb_tobecome_empty;
349
wire waiting_4stb_tobecome_empty;
350
wire spu_lsu_stxa_ack_q_buf;
351
 
352
wire wait4_trap_ack_set;
353
 
354
wire spu_mactl_nceen_4int;
355
 
356
wire spu_ifu_mamem_unc_w2;
357
// -------------------------------------------------------------------------
358
// -------------------------------------------------------------------------
359
// -------------------------------------------------------------------------
360
// -------------------------------------------------------------------------
361
 
362
/*
363
dffrl_async ma_mem_rst (.din (grst_l),
364
                        .q   (spu_mactl_mem_reset_l),
365
                        .clk (rclk),
366
                        .rst_l (arst_l), .se(se), .si(), .so());
367
*/
368
 
369
wire spu_mactl_ctl_rst_l;
370
dffrl_async ma_enc_rst (.din (grst_l),
371
                        .q   (spu_mactl_ctl_rst_l),
372
                        .clk (rclk),
373
                        .rst_l (arst_l), .se(se), .si(), .so());
374
 
375
 
376
 
377
wire spu_mactl_ctl_rst_local = ~spu_mactl_ctl_rst_l;
378
 
379
assign spu_mactl_ctl_reset = ~spu_mactl_ctl_rst_l;
380
 
381
assign spu_mactl_mem_reset_l = ~spu_mactl_ctl_rst_local;
382
 
383
// -------------------------------------------------------------------------
384
// -------------------------------------------------------------------------
385
// -------------------------------------------------------------------------
386
wire spu_mactl_stxa_2ctl_reg;
387
wire stxa_2ctl_reg = spu_mactl_stxa_2ctl_reg;
388
wire ma_op_complete, spu_mactl_done;
389
wire ma_op_complete_mask;
390
wire [1:0] spu_thrid_m,spu_thrid_g;
391
wire [1:0] spu_thrid_g2;
392
// -----------------------------------------------------------------
393
// -----------------------------------------------------------------
394
// -----------------------------------------------------------------
395
 
396
wire wait4_trap_ack_stxa2ctl = wait4_trap_ack_set & stxa_2ctl_reg;
397
 
398
// -----------------------------------------------------------------
399
// -----------------------------------------------------------------
400
// -----------------------------------------------------------------
401
// -----------------------------------------------------------------
402
wire  state_reset = spu_mactl_ctl_rst_local | spu_mactl_done ;
403
// -------------------------------------------------------------------------
404
 
405
/*************
406
state
407
-----
408
00      idle
409
01      operation inprogress
410
10      wait state
411
11      abort
412
**************/
413
dff_s    #(1) state_00_ff (
414
        .din(nxt_state_00) ,
415
        .q(cur_state_00),
416
        .clk (rclk), .se(se), .si(), .so());
417
 
418
dffr_s  #(1) state_01_ff (
419
        .din(nxt_state_01) ,
420
        .q(cur_state_01),
421
        .rst(state_reset), .clk (rclk), .se(se), .si(), .so());
422
 
423
dffr_s  #(1) state_10_ff (
424
        .din(nxt_state_10) ,
425
        .q(cur_state_10),
426
        .rst(state_reset), .clk (rclk), .se(se), .si(), .so());
427
 
428
dffr_s  #(1) state_11_ff (
429
        .din(nxt_state_11) ,
430
        .q(cur_state_11),
431
        .rst(state_reset), .clk (rclk), .se(se), .si(), .so());
432
// -------------------------------------------------------------------------
433
// transition to 00 state.
434
 
435
assign spu_mactl_done = cur_state_01 & ~stxa_2ctl_reg & ma_op_complete_mask;
436
 
437
assign  nxt_state_00 = (
438
                         state_reset | spu_mactl_done |
439
                         (cur_state_00 & ~stxa_2ctl_reg ));
440
 
441
// -------------------------------------------------------------------------
442
// transition to 01 state.
443
 
444
wire tr2state01_frm_state00 = cur_state_00 & stxa_2ctl_reg & ~wait_4stb_tobecome_empty &
445
                                                                ~wait4_trap_ack_stxa2ctl;
446
wire tr2state01_frm_state10 = cur_state_10 & ~(stxa_2ctl_reg | waiting_4stb_tobecome_empty |
447
                                                                wait4_trap_ack_set);
448
 
449
assign  nxt_state_01 = (
450
                         tr2state01_frm_state00 |
451
                         tr2state01_frm_state10 |
452
                         (cur_state_01 & ~stxa_2ctl_reg & ~ma_op_complete_mask));
453
 
454
// -------------------------------------------------------------------------
455
// transition to 10 state.
456
 
457
wire tr2state10_frm_state11 = cur_state_11 & ~stxa_2ctl_reg & ma_op_complete_mask;
458
wire tr2state10_frm_state10 = cur_state_10 & (stxa_2ctl_reg | waiting_4stb_tobecome_empty |
459
                                                                wait4_trap_ack_set);
460
wire tr2state10_frm_state00 = cur_state_00 & (wait_4stb_tobecome_empty | wait4_trap_ack_stxa2ctl);
461
 
462
assign  nxt_state_10 = (
463
                         tr2state10_frm_state00 | tr2state10_frm_state11 | tr2state10_frm_state10 );
464
 
465
// -------------------------------------------------------------------------
466
// transition to 11 state.
467
 
468
wire tr2state11_frm_state01 = cur_state_01 & stxa_2ctl_reg;
469
wire tr2state11_frm_state11 = cur_state_11 & (stxa_2ctl_reg | ~ma_op_complete_mask);
470
 
471
assign  nxt_state_11 = (
472
                         tr2state11_frm_state11 | tr2state11_frm_state01 );
473
 
474
 
475
// -------------------------------------------------------------------------
476
 
477
assign spu_mactl_mactl_wen = tr2state01_frm_state00 | tr2state01_frm_state10;
478
 
479
wire spu_mactl_mactl_iss_mxsel = tr2state01_frm_state00;
480
wire spu_mactl_mactl_wen_a_reg = stxa_2ctl_reg;
481
 
482
 
483
wire tr2state01_frm_state00_q,tr2state01_frm_state00_qq;
484
dff_s  #(2) tr2state01_frm_state00_dly_ff (
485
        .din({tr2state01_frm_state00,tr2state01_frm_state00_q}) ,
486
        .q({tr2state01_frm_state00_q,tr2state01_frm_state00_qq}),
487
        .clk (rclk), .se(se), .si(), .so());
488
 
489
wire tr2state01_frm_state10_q,tr2state01_frm_state10_qq;
490
dff_s  #(2) tr2state01_frm_state10_dly_ff (
491
        .din({tr2state01_frm_state10,tr2state01_frm_state10_q}) ,
492
        .q({tr2state01_frm_state10_q,tr2state01_frm_state10_qq}),
493
        .clk (rclk), .se(se), .si(), .so());
494
 
495
// since there is a 2 cycle delay between stxa to ctlreg and issue signal getting
496
// asserted and clear of all *_done_set signals. Need to mask out the qualification
497
// with ma_complete for these 2 cycles.
498
assign ma_op_complete_mask = ma_op_complete & ~(tr2state01_frm_state00_q |
499
                                tr2state01_frm_state00_qq) & ~(tr2state01_frm_state10_q |
500
                                tr2state01_frm_state10_qq);
501
 
502
assign spu_mactl_stxa_force_abort = cur_state_11;
503
 
504
// -------------------------------------------------------------------------
505
// -------------------------------------------------------------------------
506
// -------------------------------------------------------------------------
507
//                              CTL REG
508
// -------------------------------------------------------------------------
509
wire [13:0] spu_mactl_mactl_reg;
510
// -------------------------------------------------------------------------
511
// -------------------------------------------------------------------------
512
wire [13:0] spu_mactl_young_ctlreg_data;
513
wire [13:0] spu_mactl_ctlreg_data_mxout;
514
// wire [1:0] old_ctlreg_issue_tid;
515
wire [1:0] young_ctlreg_issue_tid;
516
wire [1:0] ctlreg_tid_4cmp_2ldxa_tid;
517
wire ldxa_tid_match_ctlreg_tid_g2;
518
 
519
dffre_s  #(16) young_ctl_reg_ff (
520
        .din({spu_thrid_g2[1:0], ma_ctl_reg_data[13:0]}) ,
521
        .q({young_ctlreg_issue_tid[1:0],spu_mactl_young_ctlreg_data[13:0]}),
522
        .en(spu_mactl_mactl_wen_a_reg),
523
        .rst(spu_mactl_ctl_rst_local), .clk (rclk), .se(se), .si(), .so());
524
 
525
 
526
assign spu_mactl_ctlreg_data_mxout[13:0] = spu_mactl_mactl_iss_mxsel ?
527
                                                 ma_ctl_reg_data[13:0] :
528
                                                 spu_mactl_young_ctlreg_data[13:0];
529
 
530
assign spu_mactl_ldxa_mactl_reg[13:0] = (cur_state_01 | cur_state_00) ? spu_mactl_mactl_reg[13:0] :
531
                                                        spu_mactl_young_ctlreg_data[13:0];
532
 
533
assign ctlreg_tid_4cmp_2ldxa_tid[1:0] = (cur_state_01 | cur_state_00) ? spu_mactl_mactl_reg[12:11] :
534
                                                        spu_mactl_young_ctlreg_data[12:11];
535
 
536
/*
537
replaced this with following since an ldxatosync followed and stxa2ctl was getting the incoorect timing
538
for compare of tids
539
 
540
assign ldxa_tid_match_ctlreg_tid_g = (ctlreg_tid_4cmp_2ldxa_tid[1:0] == spu_thrid_g[1:0]);
541
 
542
dff_s #(1) ldxa_tid_match_ctl_reg_tid_ff (
543
        .din(ldxa_tid_match_ctlreg_tid_g) ,
544
        .q(ldxa_tid_match_ctlreg_tid_g2),
545
        .clk (rclk), .se(se), .si(), .so());
546
*/
547
 
548
assign ldxa_tid_match_ctlreg_tid_g2 = (ctlreg_tid_4cmp_2ldxa_tid[1:0] == spu_thrid_g2[1:0]);
549
// -------------------------------------------------------------------------
550
// -------------------------------------------------------------------------
551
wire spu_mactl_busy_bit;
552
mux2ds #(1) busy_bit_mx (
553
        .in0    (spu_mactl_busy_bit_wrdata),
554
        .in1    (spu_mactl_ctlreg_data_mxout[10]),
555
        .sel0    (spu_mactl_busy_bit_wen),
556
        .sel1    (~spu_mactl_busy_bit_wen),
557
        .dout   (spu_mactl_busy_bit));
558
 
559
dffre_s  #(1) ctl_reg_busybit_ff (
560
        .din(spu_mactl_busy_bit ) ,
561
        .q(spu_mactl_mactl_reg[10]),
562
        .en(spu_mactl_busy_bit_wen),
563
        .rst(spu_mactl_ctl_rst_local|spu_mactl_clr_busy_bit), .clk (rclk), .se(se), .si(), .so());
564
 
565
///wire ma_is_busy = spu_mactl_mactl_reg[10];
566
 
567
 
568
/*
569
dffre_s  #(9) mactl_reg_ff (
570
        .din({spu_mactl_ctlreg_data_mxout[15:11],spu_mactl_ctlreg_data_mxout[9:6]}) ,
571
        .q({old_ctlreg_issue_tid[1:0], spu_mactl_mactl_reg[13:11],spu_mactl_mactl_reg[9:6]}),
572
        .en(spu_mactl_mactl_wen),
573
        .rst(spu_mactl_ctl_rst_local), .clk (rclk), .se(se), .si(), .so());
574
*/
575
 
576
dffre_s  #(7) mactl_reg_ff (
577
        .din({spu_mactl_ctlreg_data_mxout[13:11],spu_mactl_ctlreg_data_mxout[9:6]}) ,
578
        .q({spu_mactl_mactl_reg[13:11],spu_mactl_mactl_reg[9:6]}),
579
        .en(spu_mactl_mactl_wen),
580
        .rst(spu_mactl_ctl_rst_local), .clk (rclk), .se(se), .si(), .so());
581
 
582
 
583
wire spu_mactl_int_set = spu_mactl_mactl_reg[9];
584
 
585
 
586
 
587
/////////   NEED TO DO LEN UPDATE AT THE END also
588
 
589
wire [5:0] spu_mactl_len_cntr_mx;
590
dffre_s  #(6) mactl_reg_len_ff (
591
        .din(spu_mactl_len_cntr_mx[5:0]) ,
592
        .q(spu_mactl_mactl_reg[5:0]),
593
        .en(spu_mactl_mactl_wen | spu_mast_streq),
594
        .rst(spu_mactl_ctl_rst_local), .clk (rclk), .se(se), .si(), .so());
595
 
596
 
597
assign spu_mactl_mactl_len = spu_mactl_mactl_reg[5:0];
598
 
599
// -------------------------------------------------------------------------
600
// -------------------------------------------------------------------------
601
// -------------------------------------------------------------------------
602
// LEN field update
603
 
604
 
605
assign spu_mactl_len_cntr_mx[5:0] = (spu_maaddr_len_cntr[5:0] & {6{~spu_mactl_mactl_wen}}) |
606
                                        (spu_mactl_ctlreg_data_mxout[5:0] & {6{spu_mactl_mactl_wen}}) ;
607
 
608
 
609
 
610
// -------------------------------------------------------------------------
611
// -------------------------------------------------------------------------
612
// -------------------------------------------------------------------------
613
// -------------------------------------------------------------------------
614
// -------------------------------------------------------------------------
615
// stb empty logic
616
 
617
wire allow_stxaack_waiting4trapack_pulse;
618
 
619
wire spu_thrid_decode_tid0 = ~spu_thrid_g2[1] & ~spu_thrid_g2[0];
620
wire spu_thrid_decode_tid1 = ~spu_thrid_g2[1] & spu_thrid_g2[0];
621
wire spu_thrid_decode_tid2 = spu_thrid_g2[1] & ~spu_thrid_g2[0];
622
wire spu_thrid_decode_tid3 = spu_thrid_g2[1] & spu_thrid_g2[0];
623
 
624
 
625
wire stb_isempty =
626
                                (lsu_spu_stb_empty[0] & spu_thrid_decode_tid0) |
627
                                (lsu_spu_stb_empty[1] & spu_thrid_decode_tid1) |
628
                                (lsu_spu_stb_empty[2] & spu_thrid_decode_tid2) |
629
                                (lsu_spu_stb_empty[3] & spu_thrid_decode_tid3) ;
630
 
631
 
632
wire wait_4stb_empty_wen = stxa_2ctl_reg & ~stb_isempty;
633
wire wait_4stb_empty_rst = (stxa_2ctl_reg & stb_isempty) |
634
                                tr2state01_frm_state10 |
635
                                (allow_stxaack_waiting4trapack_pulse & ~wait_4stb_empty_wen) ;
636
 
637
assign spu_mactl_disable_stxa_ack_g2 = wait_4stb_empty_wen;
638
assign wait_4stb_tobecome_empty = wait_4stb_empty_wen;
639
 
640
wire waiting_4stb_empty_set;
641
dffre_s #(1) wait_4stb_empty_ff (
642
        .din(1'b1) ,
643
        .q(waiting_4stb_empty_set),
644
        .en(wait_4stb_empty_wen),
645
        .rst(spu_mactl_ctl_rst_local | wait_4stb_empty_rst), .clk (rclk), .se(se), .si(), .so());
646
 
647
wire young_thrid_decode_tid0 = ~young_ctlreg_issue_tid[1] & ~young_ctlreg_issue_tid[0];
648
wire young_thrid_decode_tid1 = ~young_ctlreg_issue_tid[1] & young_ctlreg_issue_tid[0];
649
wire young_thrid_decode_tid2 = young_ctlreg_issue_tid[1] & ~young_ctlreg_issue_tid[0];
650
wire young_thrid_decode_tid3 = young_ctlreg_issue_tid[1] & young_ctlreg_issue_tid[0];
651
 
652
wire stb_hasbecome_empty_while_instate10 =
653
                                (lsu_spu_stb_empty[0] & young_thrid_decode_tid0) |
654
                                (lsu_spu_stb_empty[1] & young_thrid_decode_tid1) |
655
                                (lsu_spu_stb_empty[2] & young_thrid_decode_tid2) |
656
                                (lsu_spu_stb_empty[3] & young_thrid_decode_tid3) ;
657
 
658
assign waiting_4stb_tobecome_empty  = (~stb_hasbecome_empty_while_instate10 & waiting_4stb_empty_set) |
659
                                                                                wait_4stb_empty_wen;
660
 
661
wire allow_stxa_ack_while_instate10 =
662
        //(waiting_4stb_empty_set & wait_4stb_empty_wen & cur_state_10) | // when in state10 & waiting 
663
        //(waiting_4stb_empty_set & wait_4stb_empty_wen ) | // when in state10 & waiting 
664
        (waiting_4stb_empty_set & stxa_2ctl_reg ) | // when in state10 & waiting 
665
                                                                        // 4stb_empty & there is stxa_2ctlreg.
666
        (waiting_4stb_empty_set & tr2state01_frm_state10 & stb_hasbecome_empty_while_instate10) | // when in state10 & 
667
                                                                        // waiting 4stb_empty and stb becomes empty. 
668
        allow_stxaack_waiting4trapack_pulse;
669
 
670
 
671
 
672
wire delayed_allow_stxa_ack;
673
wire delayed_allow_stxa_ack_pre = (stxa_2ctl_reg & stb_isempty & waiting_4stb_empty_set) |
674
                                        (spu_lsu_stxa_ack_q_buf & stxa_2ctl_reg & stb_isempty);//this is to resolve
675
                                                                        //b-b-b stxa's
676
 
677
wire waiting_4stb_empty_set_dly;
678
dff_s #(1) waiting_4stb_empty_set_dly_ff (
679
        .din(waiting_4stb_empty_set) ,
680
        .q(waiting_4stb_empty_set_dly),
681
        .clk (rclk), .se(se), .si(), .so());
682
 
683
wire waiting_4stb_empty_set_dly2;
684
dff_s #(1) waiting_4stb_empty_set_dly2_ff (
685
        .din(waiting_4stb_empty_set_dly) ,
686
        .q(waiting_4stb_empty_set_dly2),
687
        .clk (rclk), .se(se), .si(), .so());
688
 
689
 
690
wire delayed_allow_stxa_ack_pre_qual = delayed_allow_stxa_ack_pre & (waiting_4stb_empty_set |
691
                                                waiting_4stb_empty_set_dly | waiting_4stb_empty_set_dly2);
692
 
693
dffr_s #(1) delayed_allow_stxa_ack_pre_ff (
694
        .din(delayed_allow_stxa_ack_pre_qual) ,
695
        .q(delayed_allow_stxa_ack),
696
        .rst(spu_mactl_ctl_rst_local), .clk (rclk), .se(se), .si(), .so());
697
 
698
// ################################################################################ 
699
// ECO bug5326.
700
// this is related to stxa not getting acked when in state 10 and stb becomes empty and wait4_trap_ack is
701
// asserted and becaues of this tr2state01_frm_state10 does not occur and as a result no ack is sent out
702
// and when stb becomes empty(wait4_trap_ack is still waiting for ack) still no ack and stxa hangs.
703
 
704
wire  allow_stxaack_waiting4trapack = waiting_4stb_empty_set & stb_hasbecome_empty_while_instate10 &
705
                                                cur_state_10 & wait4_trap_ack_set;
706
 
707
wire allow_stxaack_waiting4trapack_q;
708
dff_s  #(1) allow_stxaack_waiting4trapack_ff (
709
        .din(allow_stxaack_waiting4trapack) ,
710
        .q(allow_stxaack_waiting4trapack_q),
711
        .clk (rclk), .se(se), .si(), .so());
712
 
713
assign allow_stxaack_waiting4trapack_pulse = ~allow_stxaack_waiting4trapack_q & allow_stxaack_waiting4trapack;
714
 
715
// -------------------------------------------------------------------------
716
// -------------------------------------------------------------------------
717
// -------------------------------------------------------------------------
718
 
719
/*
720
dffr_s  #(1) spu_mactl_streq_ff (
721
        .din(spu_mast_streq) ,
722
        .q(spu_mactl_streq),
723
        .rst(lsu_spu_ldst_ack),
724
        .clk (rclk), .se(se), .si(), .so());
725
*/
726
 
727
wire spu_mactl_streq_set;
728
dffre_s  #(1) spu_mactl_streq_ff (
729
        .din(1'b1) ,
730
        .q(spu_mactl_streq_set),
731
        .en(spu_mast_streq),
732
        .rst(spu_mactl_ctl_rst_local | lsu_spu_ldst_ack), .clk (rclk), .se(se), .si(), .so());
733
 
734
//assign spu_mactl_streq = spu_mast_streq | spu_mactl_streq_set;
735
assign spu_mactl_streq = spu_mactl_streq_set ;
736
 
737
 
738
wire spu_mactl_pcx_7170_sel_pre = spu_mast_streq | spu_mactl_ldop;
739
 
740
dff_s  #(1) spu_mactl_pcx_7170_sel_ff (
741
        .din(spu_mactl_pcx_7170_sel_pre) ,
742
        .q(spu_mactl_pcx_7170_sel),
743
        .clk (rclk), .se(se), .si(), .so());
744
 
745
dff_s  #(1) spu_mactl_pcx_wen_ff (
746
        .din(spu_mactl_pcx_7170_sel_pre) ,
747
        .q(spu_mactl_pcx_wen),
748
        .clk (rclk), .se(se), .si(), .so());
749
 
750
/*
751
assign spu_mactl_pcx_7170_sel = spu_mast_streq_q | spu_mactl_ldop;
752
assign spu_mactl_pcx_wen = spu_mactl_pcx_7170_sel;
753
*/
754
 
755
// -------------------------------------------------------------------------
756
// -------------------------------------------------------------------------
757
// -------------------------------------------------------------------------
758
// -------------------------------------------------------------------------
759
// -------------------------------------------------------------------------
760
// SETTING THE BUSY BIT.
761
// -------------------------------------------------------------------------
762
// when spu_mactl_iss_pulse_dly is set busy_bit is set and when operation
763
// is done it is cleared.
764
 
765
 
766
assign spu_mactl_busy_bit_wen = spu_mactl_iss_pulse_dly |
767
                                        spu_mactl_mactl_wen;
768
 
769
assign spu_mactl_busy_bit_wrdata = spu_mactl_iss_pulse_dly;
770
 
771
 
772
 
773
wire clr_busy_bit_when_maint = spu_mactl_int_set & ifu_spu_trap_ack;
774
//wire clr_busy_bit_when_maint = spu_mactl_int_set & 1'b0;
775
 
776
//wire spu_mactl_clr_all_done_set = clr_busy_bit_when_maint;
777
 
778
assign spu_mactl_clr_busy_bit = clr_busy_bit_when_masync | clr_busy_bit_when_maint;
779
 
780
 
781
/******************************************************************************/
782
// completion by interrupt.
783
// ----------------------------------------
784
 
785
wire done_set_pulse_q;
786
dff_s  #(1) doneset_pulse_ff (
787
        .din(ma_op_done) ,
788
        .q(done_set_pulse_q),
789
        .clk (rclk), .se(se), .si(), .so());
790
 
791
 
792
wire spu_mactl_ttype_vld = (~done_set_pulse_q & ma_op_done & spu_mactl_int_set) &
793
                                        (cur_state_00 | cur_state_01) & ~stxa_2ctl_reg ;
794
                                                                        // prevent from sending completion
795
                                                                        // interrupt when in abort mode.
796
 
797
wire spu_mactl_ttype_vld_dly;
798
dff_s    #(1) ma_ttype_vld_ff (
799
        .din(spu_mactl_ttype_vld) ,
800
        .q(spu_mactl_ttype_vld_dly),
801
        .clk (rclk), .se(se), .si(), .so());
802
 
803
// ----------------------------------------
804
// ----ttype logic, 1 => 74(ma), 0 => 70(enc); enc has higher priority.
805
wire spu_mactl_ttype;
806
assign spu_mactl_ttype = 1'b1;
807
 
808
// ----------------------------------------
809
// ----tid logic
810
assign spu_ifu_ttype_tid_w = spu_mactl_int_set ? spu_mactl_mactl_reg[12:11] :
811
                                                spu_mactl_ldxa_tid_g2[1:0];// changed to _g2 since
812
                                                                                //ifu_errctl flops it as well.
813
 
814
// ----------------------------------------
815
dff_s    #(2) spu_ifu_ttype_ff (
816
        .din({spu_mactl_ttype,spu_mactl_ttype_vld_dly}) ,
817
        .q({spu_ifu_ttype_w2,spu_ifu_ttype_vld_w2}),
818
        .clk (rclk), .se(se), .si(), .so());
819
 
820
// ----------------------------------------
821
 
822
wire ctl_tid_decode0 = ~spu_mactl_mactl_reg[12] & ~spu_mactl_mactl_reg[11];
823
wire ctl_tid_decode1 = ~spu_mactl_mactl_reg[12] & spu_mactl_mactl_reg[11];
824
wire ctl_tid_decode2 = spu_mactl_mactl_reg[12] & ~spu_mactl_mactl_reg[11];
825
wire ctl_tid_decode3 = spu_mactl_mactl_reg[12] & spu_mactl_mactl_reg[11];
826
 
827
//wire [3:0] ifu_spu_nceen_q;
828
assign spu_mactl_nceen_4int =
829
                                (ifu_spu_nceen[0] & ctl_tid_decode0) |
830
                                (ifu_spu_nceen[1] & ctl_tid_decode1) |
831
                                (ifu_spu_nceen[2] & ctl_tid_decode2) |
832
                                (ifu_spu_nceen[3] & ctl_tid_decode3) ;
833
 
834
// ----------------------------------------
835
 
836
wire wait4_trap_ack_rst = spu_ifu_mamem_unc_w2 & spu_mactl_nceen_4int ;
837
 
838
dffre_s  #(1) wait4_trap_ack_ff (
839
        .din(1'b1) ,
840
        .q(wait4_trap_ack_set),
841
        .en(spu_mactl_ttype_vld),
842
        .rst(spu_mactl_ctl_rst_local | ifu_spu_trap_ack | wait4_trap_ack_rst), .clk (rclk), .se(se), .si(), .so());
843
 
844
 
845
// -------------------------------------------------------------------------
846
// ***************** VA COMPARES ********************
847
// -------------------------------------------------------------------------
848
wire [7:0] spu_ldst_va_m,spu_ldst_va_m_buf,spu_ldst_va_g;
849
wire spu_mactl_mactl_va_vld_g;
850
 
851
wire spu_mactl_masync_va_vld_g  = (spu_ldst_va_g[7:0] == 8'ha0);
852
wire spu_mactl_mpa_va_vld_g     = (spu_ldst_va_g[7:0] == 8'h88);
853
wire spu_mactl_maaddr_va_vld_g  = (spu_ldst_va_g[7:0] == 8'h90);
854
wire spu_mactl_manp_va_vld_g    = (spu_ldst_va_g[7:0] == 8'h98);
855
 
856
wire spu_mactl_mactl_va_vld_m   = (spu_ldst_va_m[7:0] == 8'h80);
857
 
858
dff_s  #(1) spu_mactl_mactl_va_vld_m_ff (
859
        .din(spu_mactl_mactl_va_vld_m) ,
860
        .q(spu_mactl_mactl_va_vld_g),
861
        .clk (rclk), .se(se), .si(), .so());
862
 
863
 
864
wire spu_mactl_ma_va_vld_g = spu_mactl_masync_va_vld_g | spu_mactl_mpa_va_vld_g |
865
                                        spu_mactl_maaddr_va_vld_g | spu_mactl_manp_va_vld_g |
866
                                        spu_mactl_mactl_va_vld_g;
867
 
868
wire spu_mactl_illgl_va_g = ~spu_mactl_ma_va_vld_g ;
869
 
870
 
871
wire spu_mactl_masync_va_vld_g2, spu_mactl_mpa_va_vld_g2, spu_mactl_maaddr_va_vld_g2,
872
                        spu_mactl_manp_va_vld_g2, spu_mactl_mactl_va_vld_g2, spu_mactl_illgl_va_g2;
873
 
874
dff_s  #(6) mactl_va_vld_g2_ff (
875
        .din({spu_mactl_masync_va_vld_g, spu_mactl_mpa_va_vld_g, spu_mactl_maaddr_va_vld_g,
876
                        spu_mactl_manp_va_vld_g, spu_mactl_mactl_va_vld_g, spu_mactl_illgl_va_g}) ,
877
        .q({spu_mactl_masync_va_vld_g2, spu_mactl_mpa_va_vld_g2, spu_mactl_maaddr_va_vld_g2,
878
                        spu_mactl_manp_va_vld_g2, spu_mactl_mactl_va_vld_g2, spu_mactl_illgl_va_g2}),
879
        .clk (rclk), .se(se), .si(), .so());
880
 
881
 
882
 
883
// -------------------------------------------------------------------------
884
// -------------------------------------------------------------------------
885
// -------------------------------------------------------------------------
886
// -------------------------------------------------------------------------
887
// -------------------------------------------------------------------------
888
// -------------------------------------------------------------------------
889
 
890
wire spu_ld_inst_m,spu_st_inst_m,spu_alt_space_m;
891
wire spu_mactl_asi_is_40_m;
892
wire spu_mactl_asi_is_40_m_buf;
893
wire spu_mactl_asi_is_40_e;
894
 
895
dff_s  #(13) ifu_spu_pipe_ff (
896
        .din({ifu_lsu_ld_inst_e,ifu_lsu_st_inst_e,ifu_lsu_alt_space_e,
897
              ifu_tlu_thrid_e[1:0],exu_lsu_ldst_va_e[7:0]}) ,
898
        .q({spu_ld_inst_m,spu_st_inst_m,spu_alt_space_m,
899
              spu_thrid_m[1:0],spu_ldst_va_m[7:0]}),
900
        .clk (rclk), .se(se), .si(), .so());
901
 
902
assign spu_ldst_va_m_buf = spu_ldst_va_m;
903
 
904
// asi addr = 80
905
 
906
wire spu_mactl_mactl_wen_m_prequal = spu_mactl_asi_is_40_m_buf & spu_alt_space_m & spu_st_inst_m ;
907
/*
908
wire spu_mactl_mactl_wen_m = spu_mactl_mactl_va_vld_m & spu_mactl_asi_is_40_m &
909
                                spu_alt_space_m & spu_st_inst_m ;
910
*/
911
                                //ifu_tlu_inst_vld_m;
912
 
913
wire spu_mactl_mactl_wen_m = spu_mactl_mactl_va_vld_m & spu_mactl_mactl_wen_m_prequal ;
914
 
915
wire spu_mactl_mactl_wen_g;
916
dff_s  #(1) spu_mactl_mactl_ack_ff (
917
        .din(spu_mactl_mactl_wen_m) ,
918
        .q(spu_mactl_mactl_wen_g),
919
        .clk (rclk), .se(se), .si(), .so());
920
 
921
 
922
///wire spu_mactl_mactl_wen_busy_m = spu_mactl_mactl_wen_m & ~ma_is_busy;
923
// wire spu_mactl_mactl_wen_vld_m = spu_mactl_mactl_wen_busy_m & ifu_tlu_inst_vld_m;
924
 
925
/*
926
wire spu_mactl_mactl_wen_busy_g;
927
dff_s  #(1) spu_mactl_mactl_wen_busy_m_ff (
928
        .din(spu_mactl_mactl_wen_busy_m) ,
929
        .q(spu_mactl_mactl_wen_busy_g),
930
        .clk (rclk), .se(se), .si(), .so());
931
 
932
wire spu_mactl_mactl_wen_vld_g = spu_mactl_mactl_wen_busy_g & ifu_spu_inst_vld_w;
933
 
934
*/
935
 
936
 
937
wire spu_mactl_mactl_wen_vld_g = spu_mactl_mactl_wen_g & ifu_spu_inst_vld_w;
938
 
939
wire spu_mactl_mactl_wen_vld_g2;
940
dff_s  #(1) spu_mactl_mactl_wen_vld_g_ff (
941
        .din(spu_mactl_mactl_wen_vld_g) ,
942
        .q(spu_mactl_mactl_wen_vld_g2),
943
        .clk (rclk), .se(se), .si(), .so());
944
 
945
 
946
 
947
dff_s  #(10) spu_pipe_ff (
948
        .din({spu_thrid_m[1:0],spu_ldst_va_m_buf[7:0]}),
949
        .q({spu_thrid_g[1:0],spu_ldst_va_g[7:0]}),
950
        .clk (rclk), .se(se), .si(), .so());
951
 
952
 
953
dff_s  #(2) tid_g2_ff (
954
        .din(spu_thrid_g[1:0]) ,
955
        .q(spu_thrid_g2[1:0]),
956
        .clk (rclk), .se(se), .si(), .so());
957
 
958
/*
959
wire [7:0] spu_mactl_asi_state_m;
960
dff_s  #(8) spu_mactl_asi_state_ff (
961
        .din(lsu_spu_asi_state_e[7:0]) ,
962
        .q(spu_mactl_asi_state_m[7:0]),
963
        .clk (rclk), .se(se), .si(), .so());
964
*/
965
 
966
assign spu_mactl_asi_is_40_e = (lsu_spu_asi_state_e[7:0] == 8'h40);
967
 
968
dff_s  #(2) spu_mactl_asi_is_40_e_ff (
969
        .din({spu_mactl_asi_is_40_e, spu_mactl_asi_is_40_e}) ,
970
        .q({spu_mactl_asi_is_40_m, spu_mactl_asi_is_40_m_buf}),
971
        .clk (rclk), .se(se), .si(), .so());
972
 
973
wire spu_mactl_asi40_alt_st_m = spu_mactl_asi_is_40_m & spu_alt_space_m & spu_st_inst_m ;
974
wire spu_mactl_asi40_alt_ld_m = spu_mactl_asi_is_40_m & spu_alt_space_m & spu_ld_inst_m ;
975
 
976
// wire spu_mactl_asi40_alt_st_vld_m = spu_mactl_asi40_alt_st_m & ifu_tlu_inst_vld_m;
977
// wire spu_mactl_asi40_alt_ld_vld_m = spu_mactl_asi40_alt_ld_m & ifu_tlu_inst_vld_m;
978
 
979
 
980
wire spu_mactl_asi40_alt_st_g,spu_mactl_asi40_alt_ld_g;
981
dff_s  #(2) vld_ldst_alt_asi40_ff (
982
        .din({spu_mactl_asi40_alt_st_m,spu_mactl_asi40_alt_ld_m}) ,
983
        .q({spu_mactl_asi40_alt_st_g,spu_mactl_asi40_alt_ld_g}),
984
        .clk (rclk), .se(se), .si(), .so());
985
 
986
 
987
wire spu_mactl_asi40_alt_st_vld_g = spu_mactl_asi40_alt_st_g & ifu_spu_inst_vld_w;
988
wire spu_mactl_asi40_alt_ld_vld_g = spu_mactl_asi40_alt_ld_g & ifu_spu_inst_vld_w;
989
 
990
 
991
wire spu_mactl_asi40_alt_st_vld_g2,spu_mactl_asi40_alt_ld_vld_g2;
992
dff_s  #(2) vld_ldst_alt_asi40_g2_ff (
993
        .din({spu_mactl_asi40_alt_st_vld_g,spu_mactl_asi40_alt_ld_vld_g}) ,
994
        .q({spu_mactl_asi40_alt_st_vld_g2,spu_mactl_asi40_alt_ld_vld_g2}),
995
        .clk (rclk), .se(se), .si(), .so());
996
 
997
 
998
 
999
wire all_flush = lsu_spu_early_flush_g | tlu_spu_flush_w | ifu_spu_flush_w;
1000
 
1001
wire spu_mactl_flush_g2;
1002
dff_s  #(1) flush_ff (
1003
        .din(all_flush) ,
1004
        .q(spu_mactl_flush_g2),
1005
        .clk (rclk), .se(se), .si(), .so());
1006
 
1007
 
1008
wire spu_mactl_st_asi_vld = spu_mactl_asi40_alt_st_vld_g2 & ~spu_mactl_flush_g2;
1009
wire spu_mactl_ld_asi_vld = spu_mactl_asi40_alt_ld_vld_g2 & ~spu_mactl_flush_g2;
1010
 
1011
 
1012
wire spu_mactl_st_asi_vld_local = spu_mactl_st_asi_vld;
1013
wire spu_mactl_ld_asi_vld_local = spu_mactl_ld_asi_vld;
1014
 
1015
wire spu_mactl_illgl_va_vld_g2 = spu_mactl_illgl_va_g2 & spu_mactl_ld_asi_vld_local;
1016
 
1017
 
1018
 
1019
// -------------------------------------------------------------------------
1020
// ******************* ST ASI ***********************
1021
// -------------------------------------------------------------------------
1022
// ST ASI decode and generate write enables.
1023
 
1024
// asi addr = 88
1025
assign spu_mactl_mpa_wen = spu_mactl_mpa_va_vld_g2 & spu_mactl_st_asi_vld_local ;
1026
 
1027
// asi addr = 90
1028
assign spu_mactl_maaddr_wen = spu_mactl_maaddr_va_vld_g2 & spu_mactl_st_asi_vld_local ;
1029
 
1030
// asi addr = 98
1031
assign spu_mactl_manp_wen = spu_mactl_manp_va_vld_g2 & spu_mactl_st_asi_vld_local ;
1032
 
1033
// asi addr = 80
1034
assign spu_mactl_stxa_2ctl_reg = spu_mactl_mactl_wen_vld_g2 & ~spu_mactl_flush_g2 ;
1035
 
1036
 
1037
 
1038
// -------------------------------------------------------------------------
1039
// STXA ACK 
1040
// -------------------------------------------------------------------------
1041
wire spu_lsu_stxa_ack_g2;
1042
wire disable_stxa_ack_4b2b_same_tid;
1043
 
1044
wire spu_lsu_stxa_ack_g2_prequal = ( spu_mactl_stxa_2ctl_reg & ~spu_mactl_disable_stxa_ack_g2) |
1045
                                allow_stxa_ack_while_instate10 |
1046
                                delayed_allow_stxa_ack;
1047
 
1048
assign spu_lsu_stxa_ack_g2 = spu_lsu_stxa_ack_g2_prequal & ~disable_stxa_ack_4b2b_same_tid;
1049
 
1050
dff_s  #(1) stxa_ack_g2_ff (
1051
        .din(spu_lsu_stxa_ack_g2) ,
1052
        .q(spu_lsu_stxa_ack),
1053
        .clk (rclk), .se(se), .si(), .so());
1054
 
1055
assign spu_lsu_stxa_ack_q_buf = spu_lsu_stxa_ack;
1056
 
1057
assign spu_lsu_stxa_ack_tid[1:0] =  (allow_stxa_ack_while_instate10 |
1058
                                     delayed_allow_stxa_ack) ? young_ctlreg_issue_tid[1:0] :
1059
                                                                        spu_thrid_g2[1:0];
1060
 
1061
 
1062
// following is to avoid the case when the logic generates a b2b stxa ack for the same tid.
1063
wire [1:0] spu_lsu_stxa_ack_tid_g3;
1064
dff_s  #(2) stxa_ack_tid_g2_ff (
1065
        .din(spu_lsu_stxa_ack_tid[1:0]) ,
1066
        .q(spu_lsu_stxa_ack_tid_g3[1:0]),
1067
        .clk (rclk), .se(se), .si(), .so());
1068
 
1069
wire g2_g3_tids_match = (spu_lsu_stxa_ack_tid[1:0] == spu_lsu_stxa_ack_tid_g3[1:0]);
1070
 
1071
assign disable_stxa_ack_4b2b_same_tid = spu_lsu_stxa_ack & g2_g3_tids_match;
1072
 
1073
// -------------------------------------------------------------------------
1074
// ******************* LD ASI ***********************
1075
// -------------------------------------------------------------------------
1076
// LD ASI decode and generate write enables.
1077
wire masync_set;
1078
wire spu_mactl_masync_ldxa;
1079
wire spu_mactl_masync_ldxa_sel;
1080
wire spu_mactl_masync_ldxa_sel_pre;
1081
// asi addr = A0
1082
 
1083
assign spu_mactl_masync_ldxa = spu_mactl_masync_va_vld_g2 & spu_mactl_ld_asi_vld_local;
1084
 
1085
//wire spu_mactl_masync_ldxa_qual = spu_mactl_masync_ldxa & ~masync_set;
1086
wire spu_mactl_masync_ldxa_qual = spu_mactl_masync_ldxa & ldxa_tid_match_ctlreg_tid_g2;
1087
 
1088
wire spu_mactl_masync_ldxa_rst = spu_mactl_ctl_rst_local | spu_mactl_masync_ldxa_sel_pre;
1089
 
1090
wire [1:0] masync_tid;
1091
 
1092
dffre_s  #(3) masync_ff (
1093
        .din({1'b1,spu_thrid_g2[1:0]}) ,
1094
        .q({masync_set,masync_tid[1:0]}),
1095
        .en(spu_mactl_masync_ldxa_qual),
1096
        .rst(spu_mactl_masync_ldxa_rst), .clk (rclk), .se(se), .si(), .so());
1097
 
1098
//wire multi_masync_ldxa_sel = masync_set & spu_mactl_masync_ldxa;
1099
//&&&&&&&&&&&&&&&&&&&&&
1100
// following should signal to lsu spu_lsu_ldxa_data_vld and also spu_lsu_illgl_va.
1101
//&&&&&&&&&&&&&&&&&&&&&
1102
 
1103
wire ldxa_2masync_tid_notmatch_ctlreg_tid = ~ldxa_tid_match_ctlreg_tid_g2 & spu_mactl_masync_ldxa;
1104
 
1105
 
1106
wire spu_mactl_rst_done_set;
1107
dffre_s #(1) spu_mactl_rst_done_ff (
1108
        .din(1'b1) ,
1109
        .q(spu_mactl_rst_done_set),
1110
        .en(spu_mactl_ctl_rst_local),
1111
        .rst(spu_mactl_iss_pulse_dly), .clk (rclk), .se(se), .si(), .so());
1112
 
1113
 
1114
assign ma_op_done = spu_mald_done_set | spu_mared_done_set | spu_mast_done_set |
1115
                        spu_maexp_done_set | spu_mactl_rsrv_done_set | spu_mactl_rst_done_set;
1116
 
1117
assign ma_op_complete = spu_mald_done_set | spu_mared_done_set | spu_mast_done_set |
1118
                                spu_maexp_done_set;
1119
 
1120
 
1121
//&&&&&&&&&&&&&&&&&&&&&
1122
// mask(or delay) ma_op_done if ldxa to mpa_maaddr_manp_mactl register's is in progress to avoid conflicts
1123
// with masync response when operation completes/aborts.
1124
//&&&&&&&&&&&&&&&&&&&&&
1125
 
1126
 
1127
wire spu_mactl_mask_done_set_4abort = cur_state_11 | cur_state_10 | tr2state01_frm_state10_q |
1128
                                                                        tr2state01_frm_state10_qq;
1129
 
1130
 
1131
 
1132
wire spu_mactl_ldxa_mpa_maaddr_manp_mactl;
1133
 
1134
wire spu_mactl_masync_ldxa_set = ma_op_done & masync_set & ~spu_mactl_ldxa_mpa_maaddr_manp_mactl &
1135
                                                        ~spu_mactl_masync_ldxa & // this is when ldxa to masync and
1136
                                                                                // compleion occur at same time
1137
                                                        ~spu_mactl_mask_done_set_4abort;
1138
 
1139
wire masync_pulse_q;
1140
 
1141
dff_s  #(1) masync_pulse_ff (
1142
        .din(spu_mactl_masync_ldxa_set) ,
1143
        .q(masync_pulse_q),
1144
        .clk (rclk), .se(se), .si(), .so());
1145
 
1146
 
1147
//&&&&&&&&&&&&&&&&&&&&&
1148
// following _pre signal is to signal an operation completed normally or was aborted.
1149
//&&&&&&&&&&&&&&&&&&&&&
1150
 
1151
assign spu_mactl_masync_ldxa_sel_pre = (~masync_pulse_q & spu_mactl_masync_ldxa_set) |
1152
                                        (masync_set & stxa_2ctl_reg); //this unblocks ldxa to sync reg since
1153
                                                                        // this is an abort
1154
 
1155
assign spu_mactl_masync_ldxa_sel = spu_mactl_masync_ldxa_sel_pre | ldxa_2masync_tid_notmatch_ctlreg_tid;
1156
 
1157
//&&&&&&&&&&&&&&&&&&&&&
1158
// mask out clearing the busy bit when another stxa is aborting the older operation. Since the timing
1159
// of setting the busy bit is earlier than clearing it. So in this case the busy bit set for younger
1160
// operation will be cleared when ldxa to sync is reponded as a result of the abort. And we want to avoid that.
1161
//&&&&&&&&&&&&&&&&&&&&&
1162
 
1163
assign clr_busy_bit_when_masync = spu_mactl_masync_ldxa_sel_pre & ~(masync_set & stxa_2ctl_reg);
1164
 
1165
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1166
// asi addr = 88
1167
wire spu_mactl_mpa_ldxa_g2 = spu_mactl_mpa_va_vld_g2 & spu_mactl_ld_asi_vld_local ;
1168
 
1169
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1170
// asi addr = 90
1171
wire spu_mactl_maaddr_ldxa_g2 = spu_mactl_maaddr_va_vld_g2 & spu_mactl_ld_asi_vld_local ;
1172
 
1173
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1174
// asi addr = 98
1175
wire spu_mactl_manp_ldxa_g2 = spu_mactl_manp_va_vld_g2 & spu_mactl_ld_asi_vld_local ;
1176
 
1177
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1178
// asi addr = 80
1179
wire spu_mactl_mactl_ldxa_g2 = spu_mactl_mactl_va_vld_g2 & spu_mactl_ld_asi_vld_local ;
1180
 
1181
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1182
/*
1183
assign spu_mactl_ldxa_tid_g2[1:0] = (({2{spu_mactl_mpa_ldxa_g2}} & spu_thrid_g2[1:0]) |
1184
                                    ({2{spu_mactl_maaddr_ldxa_g2}} & spu_thrid_g2[1:0]) |
1185
                                    ({2{spu_mactl_manp_ldxa_g2}} & spu_thrid_g2[1:0]) |
1186
                                    ({2{spu_mactl_mactl_ldxa_g2}} & spu_thrid_g2[1:0]) |
1187
                                    ({2{spu_mactl_masync_ldxa_sel}} & masync_tid[1:0]) );
1188
*/
1189
 
1190
 
1191
assign spu_mactl_ldxa_tid_g2[1:0] = spu_mactl_masync_ldxa_sel_pre ? masync_tid[1:0] :
1192
                                                                        spu_thrid_g2[1:0];
1193
 
1194
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1195
 
1196
assign spu_mactl_ldxa_mpa_maaddr_manp_mactl = spu_mactl_mpa_ldxa_g2 | spu_mactl_maaddr_ldxa_g2 |
1197
                                                spu_mactl_manp_ldxa_g2 | spu_mactl_mactl_ldxa_g2;
1198
 
1199
wire spu_mactl_ldxa_data_vld_g2 =       spu_mactl_ldxa_mpa_maaddr_manp_mactl |
1200
                                        spu_mactl_illgl_va_vld_g2 |
1201
                                        spu_mactl_masync_ldxa_sel;
1202
 
1203
// any ldxa to masync reg that its tid does not match tid of ctlreg should generate an
1204
// illgl_va to lsu, so lsu silently drops it(no writes to the reg file).
1205
 
1206
wire illgl_va_vld_or_drop_ldxa2masync = spu_mactl_illgl_va_vld_g2 | ldxa_2masync_tid_notmatch_ctlreg_tid |
1207
                                                (masync_set & stxa_2ctl_reg);
1208
 
1209
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1210
 
1211
// fix for bug 4918, when ldxa to tid3 which causes illl_va and masyc completion to another tid 
1212
// that causes unc_err. both of these happen at the same time, need to delay unc_err.
1213
 
1214
wire spu_mactl_ldxa_data_vld_qual = spu_mactl_masync_ldxa_sel | spu_mactl_ldxa_mpa_maaddr_manp_mactl;
1215
 
1216
wire spu_mactl_illgl_va_vld_w;
1217
wire spu_mactl_ldxa_data_vld_qual_w;
1218
dff_s #(1) spu_mactl_ldxa_data_vld_qual_ff (
1219
        .din(spu_mactl_ldxa_data_vld_qual) ,
1220
        .q(spu_mactl_ldxa_data_vld_qual_w),
1221
        .clk (rclk), .se(se), .si(), .so());
1222
 
1223
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1224
wire spu_mactl_ldxa_data_vld_w;
1225
dff_s  #(4) ldxa_tid_vld_ff (
1226
        //.din({spu_mactl_ldxa_tid_g2[1:0],spu_mactl_ldxa_data_vld_g2, spu_mactl_illgl_va_vld_g2}) ,
1227
 
1228
        .din({spu_mactl_ldxa_tid_g2[1:0],spu_mactl_ldxa_data_vld_g2, illgl_va_vld_or_drop_ldxa2masync}) ,
1229
        .q({spu_mactl_ldxa_tid_w[1:0],spu_mactl_ldxa_data_vld_w, spu_mactl_illgl_va_vld_w}),
1230
        .clk (rclk), .se(se), .si(), .so());
1231
 
1232
 
1233
assign spu_lsu_ldxa_data_vld_w2 = spu_mactl_ldxa_data_vld_w ;
1234
assign spu_lsu_ldxa_tid_w2[1:0] = spu_mactl_ldxa_tid_w[1:0] ;
1235
 
1236
wire spu_mactl_perr_rst;
1237
assign spu_lsu_ldxa_illgl_va_w2 = spu_mactl_illgl_va_vld_w & ~spu_lsu_unc_error_w;
1238
 
1239
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1240
 
1241
wire [3:0] spu_mactl_ldxa_data_g2_sel;
1242
wire spu_mactl_ldxa_data_g2_select;
1243
 
1244
/******                         *************
1245
assign spu_mactl_ldxa_data_g2_sel[3:0] = {spu_mactl_mactl_ldxa_g2,
1246
                                         spu_mactl_manp_ldxa_g2,
1247
                                         spu_mactl_maaddr_ldxa_g2,
1248
                                         spu_mactl_mpa_ldxa_g2};
1249
*******                         *************/
1250
 
1251
 
1252
assign spu_mactl_ldxa_data_g2_sel[0] = spu_mactl_mpa_ldxa_g2;
1253
assign spu_mactl_ldxa_data_g2_sel[1] = ~spu_mactl_mpa_ldxa_g2 & spu_mactl_maaddr_ldxa_g2;
1254
assign spu_mactl_ldxa_data_g2_sel[2] = ~spu_mactl_mpa_ldxa_g2 & ~spu_mactl_maaddr_ldxa_g2 &
1255
                                                spu_mactl_manp_ldxa_g2;
1256
assign spu_mactl_ldxa_data_g2_sel[3] = ~spu_mactl_mpa_ldxa_g2 & ~spu_mactl_maaddr_ldxa_g2 &
1257
                                                ~spu_mactl_manp_ldxa_g2;
1258
 
1259
 
1260
 
1261
 
1262
assign spu_mactl_ldxa_data_g2_select = ~(spu_mactl_mactl_ldxa_g2 |
1263
                                         spu_mactl_manp_ldxa_g2 |
1264
                                         spu_mactl_maaddr_ldxa_g2 |
1265
                                         spu_mactl_mpa_ldxa_g2);
1266
 
1267
wire [3:0] spu_mactl_ldxa_data_w_sel;
1268
dff_s  #(5) ldxa_data_sel_ff (
1269
        .din({spu_mactl_ldxa_data_g2_sel[3:0],spu_mactl_ldxa_data_g2_select}) ,
1270
        .q({spu_mactl_ldxa_data_w_sel[3:0],spu_mactl_ldxa_data_w_select}),
1271
        .clk (rclk), .se(se), .si(), .so());
1272
 
1273
 
1274
wire [3:0] spu_mactl_ldxa_data_w_sel_s;
1275
assign spu_mactl_ldxa_data_w_sel_s[0] = spu_mactl_ldxa_data_w_sel[0] | mux_drive_disable;
1276
assign spu_mactl_ldxa_data_w_sel_s[1] = spu_mactl_ldxa_data_w_sel[1] & ~mux_drive_disable;
1277
assign spu_mactl_ldxa_data_w_sel_s[2] = spu_mactl_ldxa_data_w_sel[2] & ~mux_drive_disable;
1278
assign spu_mactl_ldxa_data_w_sel_s[3] = spu_mactl_ldxa_data_w_sel[3] & ~mux_drive_disable;
1279
 
1280
 
1281
assign spu_mactl_ldxa_data_w_sel_l = ~spu_mactl_ldxa_data_w_sel_s;
1282
 
1283
// -------------------------------------------------------------------------
1284
// -------------------------------------------------------------------------
1285
 
1286
// -------------------------------------------------------------------------
1287
// -------------------------------------------------------------------------
1288
// reserve bit write detect. Kill start signal(spu_encctl_iss_pulse_dly) and
1289
// signal a completion signal.
1290
// ---------------------------------------------------
1291
 
1292
wire [2:0] spu_mactl_op_field_e;
1293
//wire [2:0] spu_mactl_op_field_m;
1294
 
1295
assign spu_mactl_op_field_e[2:0] = spu_mactl_rsrv_data_e[2:0];
1296
 
1297
wire spu_mactl_rsrv_wrdetect_e = spu_mactl_op_field_e[2] & ~(~(spu_mactl_op_field_e[1]|spu_mactl_op_field_e[0]));
1298
 
1299
wire spu_mactl_rsrv_wrdetect_noqual_m;
1300
dff_s #(1) spu_mactl_rsrv_wrdetect_e_ff (
1301
        .din(spu_mactl_rsrv_wrdetect_e) ,
1302
        .q(spu_mactl_rsrv_wrdetect_noqual_m),
1303
        .clk (rclk), .se(se), .si(), .so());
1304
 
1305
assign spu_mactl_rsrv_wrdetect_m = spu_mactl_rsrv_wrdetect_noqual_m & spu_mactl_mactl_wen_m;
1306
 
1307
/*
1308
dffr_s #(3) rsrv_data_ff (
1309
        .din(spu_mactl_rsrv_data_e[2:0]) ,
1310
        .q(spu_mactl_op_field_m[2:0]),
1311
        .rst(spu_mactl_ctl_rst_local), .clk (rclk), .se(se), .si(), .so());
1312
 
1313
 
1314
assign spu_mactl_rsrv_wrdetect_m =
1315
                spu_mactl_op_field_m[2] & ~(~(spu_mactl_op_field_m[1]|spu_mactl_op_field_m[0])) &
1316
                spu_mactl_mactl_wen_m;
1317
 
1318
*/
1319
 
1320
wire spu_mactl_rsrv_done_wen;
1321
wire spu_mactl_rsrv_done_rst = spu_mactl_ctl_rst_local | spu_mactl_iss_pulse_dly;
1322
 
1323
dffre_s #(1) spu_mactl_rsrv_done_ff (
1324
        .din(1'b1) ,
1325
        .q(spu_mactl_rsrv_done_set),
1326
        .en(spu_mactl_rsrv_done_wen),
1327
        .rst(spu_mactl_rsrv_done_rst), .clk (rclk), .se(se), .si(), .so());
1328
 
1329
wire spu_mactl_rsrv_wrdetect_m2;
1330
 
1331
dff_s #(1) spu_mactl_rsrv_wrdetect_m_ff (
1332
        .din(spu_mactl_rsrv_wrdetect_m) ,
1333
        .q(spu_mactl_rsrv_wrdetect_m2),
1334
        .clk (rclk), .se(se), .si(), .so());
1335
 
1336
 
1337
assign spu_tlu_rsrv_illgl_m = spu_mactl_rsrv_wrdetect_m ;
1338
 
1339
// ----------------------------------------------
1340
 
1341
wire spu_mactl_rsrv_wrdetect_m3;
1342
dff_s #(1) spu_mactl_rsrv_wrdetect_m2_ff (
1343
        .din(spu_mactl_rsrv_wrdetect_m2) ,
1344
        .q(spu_mactl_rsrv_wrdetect_m3),
1345
        .clk (rclk), .se(se), .si(), .so());
1346
 
1347
wire ifu_spu_inst_vld_w2;
1348
dff_s #(1) ifu_spu_inst_vld_w_dff (
1349
        .din(ifu_spu_inst_vld_w) ,
1350
        .q(ifu_spu_inst_vld_w2),
1351
        .clk (rclk), .se(se), .si(), .so());
1352
 
1353
assign spu_mactl_rsrv_done_wen = ~spu_mactl_flush_g2 & ifu_spu_inst_vld_w2 & spu_mactl_rsrv_wrdetect_m3;
1354
 
1355
// -------------------------------------------------------------------------
1356
// -------------------------------------------------------------------------
1357
// ^^^^^^^^^^^^^^ ISSUE VALID SIGNAL ^^^^^^^^^^^^^^
1358
// -------------------------------------------------------------------------
1359
wire maop_vld_set;
1360
 
1361
wire maop_vld_rst = spu_mactl_ctl_rst_local | spu_mactl_iss_pulse_dly;
1362
 
1363
wire maop_vld_wen = spu_mactl_mactl_wen & ~spu_mactl_rsrv_wrdetect_m3;
1364
 
1365
assign spu_mactl_iss_pulse_pre = maop_vld_wen;
1366
 
1367
dffre_s  #(1) maop_vld_ff (
1368
        .din(1'b1) ,
1369
        .q(maop_vld_set),
1370
        .en(maop_vld_wen),
1371
        .rst(maop_vld_rst), .clk (rclk), .se(se), .si(), .so());
1372
 
1373
// -------------------------------------------------------------------------
1374
// -------------------------------------------------------------------------
1375
wire maop_vld_set_q;
1376
 
1377
dff_s  #(1) iss_pulse_ff (
1378
        .din(maop_vld_set) ,
1379
        .q(maop_vld_set_q),
1380
        .clk (rclk), .se(se), .si(), .so());
1381
 
1382
 
1383
assign spu_mactl_iss_pulse = ~maop_vld_set_q & maop_vld_set;
1384
 
1385
dff_s  #(1) iss_pulse_dly_ff (
1386
        .din(spu_mactl_iss_pulse) ,
1387
        .q(spu_mactl_iss_pulse_dly),
1388
        .clk (rclk), .se(se), .si(), .so());
1389
 
1390
// -------------------------------------------------------------------------
1391
// ^^^^^^^^^^^^^^^ OPCODE DECODE ^^^^^^^^^^^^^^^^
1392
// -------------------------------------------------------------------------
1393
// OPCODE decode.
1394
wire [2:0] spu_madp_mactl_op;
1395
 
1396
assign spu_madp_mactl_op = spu_mactl_mactl_reg[8:6];
1397
 
1398
wire spu_mactl_ldop_pre = ~(|spu_madp_mactl_op[2:0]) ;
1399
 
1400
wire spu_mactl_stop_pre = ~spu_madp_mactl_op[2] & ~spu_madp_mactl_op[1] &
1401
                                spu_madp_mactl_op[0];
1402
 
1403
wire spu_mactl_mulop_pre = ~spu_madp_mactl_op[2] & spu_madp_mactl_op[1] &
1404
                                ~spu_madp_mactl_op[0];
1405
 
1406
wire spu_mactl_redop_pre = ~spu_madp_mactl_op[2] & spu_madp_mactl_op[1] &
1407
                                spu_madp_mactl_op[0] ;
1408
 
1409
wire spu_mactl_expop_pre = spu_madp_mactl_op[2] & ~spu_madp_mactl_op[1] &
1410
                                ~spu_madp_mactl_op[0];
1411
 
1412
dff_s #(1) ldop_ff (
1413
        .din(spu_mactl_ldop_pre) ,
1414
        .q(spu_mactl_ldop),
1415
        .clk (rclk), .se(se), .si(), .so());
1416
 
1417
dff_s #(1) stop_ff (
1418
        .din(spu_mactl_stop_pre) ,
1419
        .q(spu_mactl_stop),
1420
        .clk (rclk), .se(se), .si(), .so());
1421
 
1422
dff_s #(1) mulop_ff (
1423
        .din(spu_mactl_mulop_pre) ,
1424
        .q(spu_mactl_mulop),
1425
        .clk (rclk), .se(se), .si(), .so());
1426
 
1427
dff_s #(1) redop_ff (
1428
        .din(spu_mactl_redop_pre) ,
1429
        .q(spu_mactl_redop),
1430
        .clk (rclk), .se(se), .si(), .so());
1431
 
1432
dff_s #(1) expop_ff (
1433
        .din(spu_mactl_expop_pre) ,
1434
        .q(spu_mactl_expop),
1435
        .clk (rclk), .se(se), .si(), .so());
1436
 
1437
 
1438
// -------------------------------------------------------------------------
1439
 
1440
assign spu_mactl_mpa_sel = spu_mactl_ldop | spu_mactl_stop;
1441
 
1442
// -------------------------------------------------------------------------
1443
// -------------------------------------------------------------------------
1444
// ^^^^^^^^^^^^^^^ MEM WR/D ENABLE ^^^^^^^^^^^^^^^
1445
// -------------------------------------------------------------------------
1446
// -------------------------------------------------------------------------
1447
// the follwoing are for MAMEM(load) write and mux selection
1448
/*******************************
1449
 
1450
MPA[3] MAADDR[0] |
1451
------------------------------
1452
 
1453
 
1454
  1      0       | 64b  | eve     | mxsel[1]
1455
  1      1       | 64b  | odd     | mxsel[0]
1456
 
1457
********************************/
1458
 
1459
wire spu_mactl_memwen = spu_mamul_memwen | spu_maaeqb_memwen | spu_mald_memwen | spu_mared_memwen;
1460
wire spu_mactl_memren = spu_mamul_memren | spu_maaeqb_memren |spu_mared_memren | spu_mast_memren |
1461
                                spu_maexp_memren;
1462
 
1463
assign spu_mactl_memeve_wen = ~spu_maaddr_maaddr_0 & spu_mactl_memwen;
1464
assign spu_mactl_memodd_wen = (spu_maaddr_maaddr_0 & spu_mactl_memwen) |
1465
                        (spu_mald_memwen & ~spu_maaddr_maaddr_0 & ~spu_maaddr_mpa_3 &
1466
                                spu_maaddr_nooddwr_on_leneq1);
1467
 
1468
wire mem_swap = (~spu_maaddr_mpa_3 & spu_maaddr_maaddr_0) |
1469
                  (spu_maaddr_mpa_3 & ~spu_maaddr_maaddr_0);
1470
 
1471
wire [2:0] spu_mactl_memmxsel;
1472
assign spu_mactl_memmxsel[2] = ~spu_mactl_ldop_pre; // its a mulop
1473
assign spu_mactl_memmxsel[1] = spu_mactl_ldop_pre & mem_swap ;
1474
assign spu_mactl_memmxsel[0] = spu_mactl_ldop_pre & ~mem_swap;
1475
 
1476
assign spu_mactl_memmxsel_l[2:0] = ~spu_mactl_memmxsel[2:0];
1477
// -------------------------------------------------------------------------
1478
// -------------------------------------------------------------------------
1479
// -------------------------------------------------------------------------
1480
 
1481
assign spu_mactl_mamem_ren = spu_mactl_memren;
1482
assign spu_mactl_mamem_wen = spu_mactl_memwen;
1483
 
1484
// -------------------------------------------------------------------------
1485
// -------------------------------------------------------------------------
1486
// ^^^^^^^^^^^^^^ FLOP ENABLE FOR MA MUL/RED OPERATIONS ^^^^^^^^^^
1487
// -------------------------------------------------------------------------
1488
 
1489
assign spu_mactl_madp_parflop_wen = spu_mared_not_idle | spu_mamul_oprnd2_bypass;
1490
 
1491
// -------------------------------------------------------------------------
1492
// -------------------------------------------------------------------------
1493
// ^^^^^^^^^^^^ PERR ^^^^^^^^^^^^^^
1494
// -------------------------------------------------------------------------
1495
 
1496
wire spu_mactl_mamem_ren_dly1,spu_mactl_mamem_ren_dly2;
1497
dff_s    #(2) dly_ren_ff (
1498
        .din({spu_mactl_mamem_ren,spu_mactl_mamem_ren_dly1}) ,
1499
        .q({spu_mactl_mamem_ren_dly1,spu_mactl_mamem_ren_dly2}),
1500
        .clk (rclk), .se(se), .si(), .so());
1501
 
1502
 
1503
wire spu_mactl_perr_wen = spu_madp_perr & spu_mactl_mamem_ren_dly2;
1504
 
1505
dffre_s  #(1) perr_ff (
1506
        .din(1'b1) ,
1507
        .q(spu_mactl_perr_set_int),
1508
        .en(spu_mactl_perr_wen),
1509
        //.rst(spu_mactl_ctl_rst_local | spu_mactl_iss_pulse_dly), .clk (rclk), .se(se), .si(), .so());
1510
        .rst(spu_mactl_ctl_rst_local | spu_mactl_perr_rst), .clk (rclk), .se(se), .si(), .so());
1511
 
1512
assign spu_mactl_perr_set = spu_mactl_perr_set_int;
1513
 
1514
wire spu_mactl_perr_kill_op;
1515
dff_s  #(1) perr_dly_ff (
1516
        .din(spu_mactl_perr_wen) ,
1517
        .q(spu_mactl_perr_kill_op),
1518
        .clk (rclk), .se(se), .si(), .so());
1519
 
1520
 
1521
 
1522
assign spu_mactl_ma_kill_op = spu_mactl_perr_kill_op;
1523
 
1524
// -------------------------------------------------------------------------
1525
// -------------------------------------------------------------------------
1526
 
1527
// force perr during ma_ldop for testing only.
1528
/*
1529
wire [3:0] dumy_cntr_add,dumy_cntr_q;
1530
 
1531
wire dummy_count_eq = (dumy_cntr_q[3:0] == 4'b1001);
1532
assign dumy_cntr_add[3:0] = dumy_cntr_q[3:0] + 4'b0001;
1533
 
1534
dffre_s  #(4) dumy_cntr_ff (
1535
        .din(dumy_cntr_add[3:0]) ,
1536
        .q(dumy_cntr_q[3:0]),
1537
        .en(spu_mactl_ldop & lsu_spu_ldst_ack),
1538
        .rst(spu_mactl_ctl_rst_local | (dummy_count_eq&lsu_spu_ldst_ack)  | spu_mactl_iss_pulse), .clk (rclk), .se(se), .si(), .so());
1539
 
1540
*/
1541
 
1542
//assign spu_mactl_force_perr = spu_mactl_mactl_reg[13] | (dummy_count_eq & spu_mactl_ldop);
1543
assign spu_mactl_force_perr = spu_mactl_mactl_reg[13] ;
1544
 
1545
 
1546
// -------------------------------------------------------------------------
1547
// -------------------------------------------------------------------------
1548
// -------------------------------------------------------------------------
1549
// -------------------------------------------------------------------------
1550
// -------------------------------------------------------------------------
1551
 
1552
 
1553
wire ldxa_tid_decode0 = ~spu_mactl_ldxa_tid_w[1] & ~spu_mactl_ldxa_tid_w[0];
1554
wire ldxa_tid_decode1 = ~spu_mactl_ldxa_tid_w[1] & spu_mactl_ldxa_tid_w[0];
1555
wire ldxa_tid_decode2 = spu_mactl_ldxa_tid_w[1] & ~spu_mactl_ldxa_tid_w[0];
1556
wire ldxa_tid_decode3 = spu_mactl_ldxa_tid_w[1] & spu_mactl_ldxa_tid_w[0];
1557
 
1558
/*
1559
dff_s  #(4) ifu_spu_nceen_ff (
1560
        .din(ifu_spu_nceen[3:0]) ,
1561
        .q(ifu_spu_nceen_q[3:0]),
1562
        .clk (rclk), .se(se), .si(), .so());
1563
*/
1564
 
1565
wire spu_mactl_nceen_w =
1566
                                (ifu_spu_nceen[0] & ldxa_tid_decode0) |
1567
                                (ifu_spu_nceen[1] & ldxa_tid_decode1) |
1568
                                (ifu_spu_nceen[2] & ldxa_tid_decode2) |
1569
                                (ifu_spu_nceen[3] & ldxa_tid_decode3) ;
1570
 
1571
// -------------------------------------------------------------------------
1572
// -------------------------------------------------------------------------
1573
// -------------------------------------------------------------------------
1574
// -------------------------------------------------------------------------
1575
// -------------------------------------------------------------------------
1576
 
1577
 
1578
wire spu_ifu_corr_err_w =  spu_wen_ma_cor_err; // this is a pulse. 
1579
 
1580
dff_s  #(1) spu_ifu_corr_err_w2_ff (
1581
        .din(spu_ifu_corr_err_w) ,
1582
        .q(spu_ifu_corr_err_w2),
1583
        .clk (rclk), .se(se), .si(), .so());
1584
 
1585
// ------------------------------------------------
1586
 
1587
 
1588
wire spu_ifu_unc_err_w =  (spu_mactl_ttype_vld_dly | spu_mactl_ldxa_data_vld_qual_w) &
1589
                                                spu_wen_ma_unc_err;
1590
 
1591
assign spu_mactl_uncerr_rst = spu_ifu_unc_err_w;
1592
// ------------------------------------------------
1593
 
1594
wire spu_lsu_unc_error_w = spu_mactl_ldxa_data_vld_qual_w &  spu_mactl_nceen_w & ~spu_mactl_int_set &
1595
                                (spu_mactl_perr_set_int | spu_wen_ma_unc_err) ;
1596
 
1597
// ------------------------------------------------
1598
 
1599
wire spu_ifu_mamem_err_w = (spu_mactl_ttype_vld_dly | spu_mactl_ldxa_data_vld_qual_w) &
1600
                                                spu_mactl_perr_set_int;
1601
 
1602
assign spu_mactl_perr_rst = spu_ifu_mamem_err_w;
1603
// ------------------------------------------------
1604
 
1605
wire spu_ifu_int_set = spu_mactl_int_set;
1606
 
1607
 
1608
dff_s  #(1) spu_ifu_int_w2_ff (
1609
        .din(spu_ifu_int_set ) ,
1610
        .q(spu_ifu_int_w2),
1611
        .clk (rclk), .se(se), .si(), .so());
1612
 
1613
// ------------------------------------------------
1614
 
1615
wire spu_ifu_mamem_unc_w = spu_ifu_unc_err_w | spu_ifu_mamem_err_w;
1616
 
1617
 
1618
dff_s  #(1) spu_ifu_mamem_unc_ff (
1619
        .din(spu_ifu_mamem_unc_w ) ,
1620
        .q(spu_ifu_mamem_unc_w2),
1621
        .clk (rclk), .se(se), .si(), .so());
1622
 
1623
 
1624
endmodule

powered by: WebSVN 2.1.0

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