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

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [hdl/] [rtl/] [sparc_core/] [lsu_dcdp.v] - Blame information for rev 105

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 95 fafa1971
// ========== Copyright Header Begin ==========================================
2
// 
3
// OpenSPARC T1 Processor File: lsu_dcdp.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:    LSU Data Cache Data Path
24
//                      - Final Way-Select Mux.
25
//                      - Alignment, Sign-Extension, Endianness.
26
*/
27
////////////////////////////////////////////////////////////////////////
28
// Global header file includes
29
////////////////////////////////////////////////////////////////////////
30
// system level definition file which contains the /*
31
/* ========== Copyright Header Begin ==========================================
32
*
33
* OpenSPARC T1 Processor File: sys.h
34
* Copyright (c) 2006 Sun Microsystems, Inc.  All Rights Reserved.
35
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
36
*
37
* The above named program is free software; you can redistribute it and/or
38
* modify it under the terms of the GNU General Public
39
* License version 2 as published by the Free Software Foundation.
40
*
41
* The above named program is distributed in the hope that it will be
42
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
43
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
44
* General Public License for more details.
45
*
46
* You should have received a copy of the GNU General Public
47
* License along with this work; if not, write to the Free Software
48
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
49
*
50
* ========== Copyright Header End ============================================
51
*/
52
// -*- verilog -*-
53
////////////////////////////////////////////////////////////////////////
54
/*
55
//
56
// Description:         Global header file that contain definitions that
57
//                      are common/shared at the systme level
58
*/
59
////////////////////////////////////////////////////////////////////////
60
//
61
// Setting the time scale
62
// If the timescale changes, JP_TIMESCALE may also have to change.
63
`timescale      1ps/1ps
64
 
65
//
66
// JBUS clock
67
// =========
68
//
69
 
70
 
71
 
72
// Afara Link Defines
73
// ==================
74
 
75
// Reliable Link
76
 
77
 
78
 
79
 
80
// Afara Link Objects
81
 
82
 
83
// Afara Link Object Format - Reliable Link
84
 
85
 
86
 
87
 
88
 
89
 
90
 
91
 
92
 
93
 
94
// Afara Link Object Format - Congestion
95
 
96
 
97
 
98
 
99
 
100
 
101
 
102
 
103
 
104
 
105
 
106
// Afara Link Object Format - Acknowledge
107
 
108
 
109
 
110
 
111
 
112
 
113
 
114
 
115
 
116
 
117
 
118
// Afara Link Object Format - Request
119
 
120
 
121
 
122
 
123
 
124
 
125
 
126
 
127
 
128
 
129
 
130
 
131
 
132
 
133
 
134
 
135
 
136
// Afara Link Object Format - Message
137
 
138
 
139
 
140
// Acknowledge Types
141
 
142
 
143
 
144
 
145
// Request Types
146
 
147
 
148
 
149
 
150
 
151
// Afara Link Frame
152
 
153
 
154
 
155
//
156
// UCB Packet Type
157
// ===============
158
//
159
 
160
 
161
 
162
 
163
 
164
 
165
 
166
 
167
 
168
 
169
 
170
 
171
 
172
 
173
 
174
 
175
 
176
//
177
// UCB Data Packet Format
178
// ======================
179
//
180
 
181
 
182
 
183
 
184
 
185
 
186
 
187
 
188
 
189
 
190
 
191
 
192
 
193
 
194
 
195
 
196
 
197
 
198
 
199
 
200
 
201
 
202
 
203
 
204
 
205
 
206
 
207
 
208
 
209
 
210
// Size encoding for the UCB_SIZE_HI/LO field
211
// 000 - byte
212
// 001 - half-word
213
// 010 - word
214
// 011 - double-word
215
// 111 - quad-word
216
 
217
 
218
 
219
 
220
 
221
 
222
 
223
//
224
// UCB Interrupt Packet Format
225
// ===========================
226
//
227
 
228
 
229
 
230
 
231
 
232
 
233
 
234
 
235
 
236
 
237
//`define UCB_THR_HI             9      // (6) cpu/thread ID shared with
238
//`define UCB_THR_LO             4             data packet format
239
//`define UCB_PKT_HI             3      // (4) packet type shared with
240
//`define UCB_PKT_LO             0      //     data packet format
241
 
242
 
243
 
244
 
245
 
246
 
247
 
248
//
249
// FCRAM Bus Widths
250
// ================
251
//
252
 
253
 
254
 
255
 
256
 
257
 
258
//
259
// ENET clock periods
260
// ==================
261
//
262
 
263
 
264
 
265
 
266
//
267
// JBus Bridge defines
268
// =================
269
//
270
 
271
 
272
 
273
 
274
 
275
 
276
 
277
 
278
 
279
 
280
 
281
//
282
// PCI Device Address Configuration
283
// ================================
284
//
285
 
286
 
287
 
288
 
289
 
290
 
291
 
292
 
293
 
294
 
295
 
296
 
297
 
298
 
299
 
300
 
301
 
302
 
303
 
304
 
305
 
306
 
307
 
308
                                        // time scale definition
309
 
310
////////////////////////////////////////////////////////////////////////
311
// Local header file includes / local defines
312
////////////////////////////////////////////////////////////////////////
313
 
314
module lsu_dcdp ( /*AUTOARG*/
315
   // Outputs
316
   so, dcache_rdata_wb_buf, mbist_dcache_data_in,
317
   lsu_exu_dfill_data_w2, lsu_ffu_ld_data, stb_rdata_ramc_buf,
318
   // Inputs
319
   rclk, si, se, rst_tri_en, dcache_rdata_wb, dcache_rparity_wb,
320
   dcache_rdata_msb_w0_m, dcache_rdata_msb_w1_m,
321
   dcache_rdata_msb_w2_m, dcache_rdata_msb_w3_m, lsu_bist_rsel_way_e,
322
   dcache_alt_mx_sel_e, cache_way_hit_buf2, morphed_addr_m,
323
   signed_ldst_byte_m, signed_ldst_hw_m, signed_ldst_w_m,
324
   merge7_sel_byte0_m, merge7_sel_byte7_m, merge6_sel_byte1_m,
325
   merge6_sel_byte6_m, merge5_sel_byte2_m, merge5_sel_byte5_m,
326
   merge4_sel_byte3_m, merge4_sel_byte4_m, merge3_sel_byte0_m,
327
   merge3_sel_byte3_m, merge3_sel_byte4_m,
328
   merge3_sel_byte7_default_m, merge3_sel_byte_m, merge2_sel_byte1_m,
329
   merge2_sel_byte2_m, merge2_sel_byte5_m,
330
   merge2_sel_byte6_default_m, merge2_sel_byte_m, merge0_sel_byte0_m,
331
   merge0_sel_byte1_m, merge0_sel_byte2_m,
332
   merge0_sel_byte3_default_m, merge0_sel_byte4_m,
333
   merge0_sel_byte5_m, merge0_sel_byte6_m,
334
   merge0_sel_byte7_default_m, merge1_sel_byte0_m,
335
   merge1_sel_byte1_m, merge1_sel_byte2_m,
336
   merge1_sel_byte3_default_m, merge1_sel_byte4_m,
337
   merge1_sel_byte5_m, merge1_sel_byte6_m,
338
   merge1_sel_byte7_default_m, merge0_sel_byte_1h_m,
339
   merge1_sel_byte_1h_m, merge1_sel_byte_2h_m, stb_rdata_ramc
340
   ) ;
341
 
342
   input rclk;
343
   input si;
344
   input se;
345
   output so;
346
   input  rst_tri_en;
347
 
348
input  [63:0]  dcache_rdata_wb;
349
output [63:0]  dcache_rdata_wb_buf;
350
 
351
input [7:0] dcache_rparity_wb;
352
output [71:0] mbist_dcache_data_in;
353
 
354
output [63:0]            lsu_exu_dfill_data_w2;  // bypass data - d$ fill or hit
355
output [63:0]            lsu_ffu_ld_data ;             // ld data to frf
356
 
357
 
358
//=========================================
359
//dc_fill CP
360
//=========================================
361
   input [7:0]           dcache_rdata_msb_w0_m;    //from D$
362
   input [7:0]           dcache_rdata_msb_w1_m;    //from D$
363
   input [7:0]           dcache_rdata_msb_w2_m;    //from D$
364
   input [7:0]           dcache_rdata_msb_w3_m;    //from D$
365
 
366
   input [3:0]           lsu_bist_rsel_way_e;     //from qdp2
367
 
368
   input                 dcache_alt_mx_sel_e;
369
   input [3:0]           cache_way_hit_buf2;    //from dtlb
370
 
371
   input [7:0]           morphed_addr_m;  //from dctl
372
 
373
   input          signed_ldst_byte_m;    //from dctl
374
//   input          unsigned_ldst_byte_m;  //from dctl 
375
   input          signed_ldst_hw_m;      //from dctl
376
//   input          unsigned_ldst_hw_m;    //from dctl
377
   input          signed_ldst_w_m;       //from dctl
378
//   input          unsigned_ldst_w_m;     //from dctl
379
 
380
input                   merge7_sel_byte0_m;
381
input                   merge7_sel_byte7_m;
382
 
383
input                   merge6_sel_byte1_m;
384
input                   merge6_sel_byte6_m;
385
 
386
input                   merge5_sel_byte2_m;
387
input                   merge5_sel_byte5_m;
388
 
389
input                   merge4_sel_byte3_m;
390
input                   merge4_sel_byte4_m;
391
 
392
input                   merge3_sel_byte0_m;
393
input                   merge3_sel_byte3_m;
394
input                   merge3_sel_byte4_m;
395
input                   merge3_sel_byte7_default_m;
396
input                   merge3_sel_byte_m ;
397
 
398
input                   merge2_sel_byte1_m;
399
input                   merge2_sel_byte2_m;
400
input                   merge2_sel_byte5_m;
401
input                   merge2_sel_byte6_default_m;
402
input                   merge2_sel_byte_m ;
403
 
404
input                   merge0_sel_byte0_m, merge0_sel_byte1_m;
405
input                   merge0_sel_byte2_m, merge0_sel_byte3_default_m;
406
 
407
input                   merge0_sel_byte4_m, merge0_sel_byte5_m;
408
input                   merge0_sel_byte6_m, merge0_sel_byte7_default_m;
409
 
410
input                   merge1_sel_byte0_m, merge1_sel_byte1_m;
411
input                   merge1_sel_byte2_m, merge1_sel_byte3_default_m;
412
input                   merge1_sel_byte4_m, merge1_sel_byte5_m;
413
input                   merge1_sel_byte6_m, merge1_sel_byte7_default_m;
414
 
415
input                                merge0_sel_byte_1h_m ;
416
 
417
input                                merge1_sel_byte_1h_m, merge1_sel_byte_2h_m ;
418
 
419
   input [14:9]        stb_rdata_ramc;
420
   output [14:9]       stb_rdata_ramc_buf;
421
 
422
//wire   [3:1]           lsu_byp_byte_zero_extend ; // zero-extend for bypass bytes 7-1
423
wire   [7:1]           lsu_byp_byte_sign_extend ; // sign-extend by 1 for byp bytes 7-1
424
 
425
wire    [7:0]            byte0,byte1,byte2,byte3;
426
wire    [7:0]            byte4,byte5,byte6,byte7;
427
//wire [3:1] zero_extend_g;
428
wire [7:1] sign_extend_g;
429
 
430
wire    [7:0]            align_byte3 ;
431
wire    [7:0]            align_byte2 ;
432
wire    [7:0]            align_byte1_1h,align_byte1_2h;
433
wire    [7:0]            align_byte0_1h,align_byte0_2h ;
434
wire    [63:0]   align_byte ;
435
 
436
 
437
wire                   merge7_sel_byte0;
438
wire                   merge7_sel_byte7;
439
 
440
wire                   merge6_sel_byte1;
441
wire                   merge6_sel_byte6;
442
 
443
wire                   merge5_sel_byte2;
444
wire                   merge5_sel_byte5;
445
 
446
wire                   merge4_sel_byte3;
447
wire                   merge4_sel_byte4;
448
 
449
wire                   merge3_sel_byte0;
450
wire                   merge3_sel_byte3;
451
wire                   merge3_sel_byte4;
452
wire                   merge3_sel_byte7;
453
wire                   merge3_sel_byte ;
454
 
455
wire                   merge2_sel_byte1;
456
wire                   merge2_sel_byte2;
457
wire                   merge2_sel_byte5;
458
wire                   merge2_sel_byte6;
459
wire                   merge2_sel_byte ;
460
 
461
wire                   merge0_sel_byte0, merge0_sel_byte1;
462
wire                   merge0_sel_byte2, merge0_sel_byte3;
463
wire                   merge0_sel_byte4, merge0_sel_byte5;
464
wire                   merge0_sel_byte6, merge0_sel_byte7;
465
wire                   merge1_sel_byte0, merge1_sel_byte1;
466
wire                   merge1_sel_byte2, merge1_sel_byte3;
467
wire                   merge1_sel_byte4, merge1_sel_byte5;
468
wire                   merge1_sel_byte6, merge1_sel_byte7;
469
 
470
wire                                  merge0_sel_byte_1h ;
471
wire                                  merge1_sel_byte_1h, merge1_sel_byte_2h ;
472
 
473
   wire       clk;
474
   assign     clk = rclk;
475
 
476
   assign     stb_rdata_ramc_buf[14:9] = stb_rdata_ramc[14:9];
477
 
478
//=========================================================================================
479
//      Alignment of Fill Data
480
//=========================================================================================
481
 
482
// Alignment needs to be done for following reasons :
483
// - Write of data to irf on ld hit in l1.
484
// - Write of data to irf on ld fill to l1 after miss in l1.
485
// - Store of irf data to memory.
486
//      - Data must be aligned before write to stb.
487
//      - If data is bypassed from stb by ld then it will
488
//      need realignment thru dfq i.e., it looks like a fill.
489
// This applies to data either read from the dcache (hit) or dfq(fill on miss). 
490
 
491
 
492
assign  byte7[7:0] = dcache_rdata_wb[63:56];
493
assign  byte6[7:0] = dcache_rdata_wb[55:48];
494
assign  byte5[7:0] = dcache_rdata_wb[47:40];
495
assign  byte4[7:0] = dcache_rdata_wb[39:32];
496
assign  byte3[7:0] = dcache_rdata_wb[31:24];
497
assign  byte2[7:0] = dcache_rdata_wb[23:16];
498
assign  byte1[7:0] = dcache_rdata_wb[15:8];
499
assign  byte0[7:0] = dcache_rdata_wb[7:0];
500
 
501
//assign        zero_extend_g[3:1] = lsu_byp_byte_zero_extend[3:1] ;
502
assign  sign_extend_g[7:1] = lsu_byp_byte_sign_extend[7:1] ;
503
 
504
//buffer
505
   assign     dcache_rdata_wb_buf[63:0] = dcache_rdata_wb[63:0];
506
   assign     mbist_dcache_data_in[71:0] = {dcache_rdata_wb_buf[63:0], dcache_rparity_wb[7:0]};
507
 
508
// Final endian/justified/sign-extend Byte 0.
509
//assign        align_byte0_1h[7:0]
510
//      = merge0_sel_byte0 ? byte0[7:0] :
511
//                merge0_sel_byte1 ? byte1[7:0] :
512
//                        merge0_sel_byte2 ? byte2[7:0] :
513
//                                merge0_sel_byte3 ?  byte3[7:0] :
514
//                                        8'hxx ;
515
 
516
   wire       merge0_sel_byte0_mxsel0, merge0_sel_byte1_mxsel1, merge0_sel_byte2_mxsel2, merge0_sel_byte3_mxsel3;
517
   assign     merge0_sel_byte0_mxsel0 = merge0_sel_byte0 & ~rst_tri_en;
518
   assign     merge0_sel_byte1_mxsel1 = merge0_sel_byte1 & ~rst_tri_en;
519
   assign     merge0_sel_byte2_mxsel2 = merge0_sel_byte2 & ~rst_tri_en;
520
   assign     merge0_sel_byte3_mxsel3 = merge0_sel_byte3 |  rst_tri_en;
521
 
522
mux4ds #(8) align_byte0_1h_mx (
523
      .in0 (byte0[7:0]),
524
      .in1 (byte1[7:0]),
525
      .in2 (byte2[7:0]),
526
      .in3 (byte3[7:0]),
527
      .sel0(merge0_sel_byte0_mxsel0),
528
      .sel1(merge0_sel_byte1_mxsel1),
529
      .sel2(merge0_sel_byte2_mxsel2),
530
      .sel3(merge0_sel_byte3_mxsel3),
531
      .dout(align_byte0_1h[7:0])
532
);
533
 
534
//assign        align_byte0_2h[7:0]
535
//      = merge0_sel_byte4 ? byte4[7:0] :
536
//                merge0_sel_byte5 ? byte5[7:0] :
537
//                        merge0_sel_byte6 ? byte6[7:0] :
538
//                                merge0_sel_byte7 ? byte7[7:0] :
539
//                                        8'hxx ;
540
 
541
   wire       merge0_sel_byte4_mxsel0, merge0_sel_byte5_mxsel1, merge0_sel_byte6_mxsel2, merge0_sel_byte7_mxsel3;
542
   assign     merge0_sel_byte4_mxsel0 = merge0_sel_byte4 & ~rst_tri_en;
543
   assign     merge0_sel_byte5_mxsel1 = merge0_sel_byte5 & ~rst_tri_en;
544
   assign     merge0_sel_byte6_mxsel2 = merge0_sel_byte6 & ~rst_tri_en;
545
   assign     merge0_sel_byte7_mxsel3 = merge0_sel_byte7 |  rst_tri_en;
546
 
547
mux4ds #(8) align_byte0_2h_mx (
548
      .in0 (byte4[7:0]),
549
      .in1 (byte5[7:0]),
550
      .in2 (byte6[7:0]),
551
      .in3 (byte7[7:0]),
552
      .sel0(merge0_sel_byte4_mxsel0),
553
      .sel1(merge0_sel_byte5_mxsel1),
554
      .sel2(merge0_sel_byte6_mxsel2),
555
      .sel3(merge0_sel_byte7_mxsel3),
556
      .dout(align_byte0_2h[7:0])
557
);
558
 
559
// No sign-extension or zero-extension for byte0
560
//assign        align_byte[7:0] 
561
//      = merge0_sel_byte_1h ? align_byte0_1h[7:0] :
562
//                                      align_byte0_2h[7:0] ;
563
 
564
   assign align_byte[7:0] = merge0_sel_byte_1h ? align_byte0_1h[7:0] :
565
                                                 align_byte0_2h[7:0];
566
 
567
 
568
// Final endian/justified/sign-extend Byte 1.
569
// *** The path thru byte1 is the most critical ***
570
//assign        align_byte1_1h[7:0]
571
//      = merge1_sel_byte0 ? byte0[7:0] :
572
//                merge1_sel_byte1 ? byte1[7:0] :
573
//                        merge1_sel_byte2 ? byte2[7:0] :
574
//                                merge1_sel_byte3 ? byte3[7:0] :
575
//                                              8'hxx ;
576
 
577
   wire       merge1_sel_byte0_mxsel0, merge1_sel_byte1_mxsel1, merge1_sel_byte2_mxsel2, merge1_sel_byte3_mxsel3;
578
   assign     merge1_sel_byte0_mxsel0 = merge1_sel_byte0 & ~rst_tri_en;
579
   assign     merge1_sel_byte1_mxsel1 = merge1_sel_byte1 & ~rst_tri_en;
580
   assign     merge1_sel_byte2_mxsel2 = merge1_sel_byte2 & ~rst_tri_en;
581
   assign     merge1_sel_byte3_mxsel3 = merge1_sel_byte3 |  rst_tri_en;
582
 
583
mux4ds #(8) align_byte1_1h_mx (
584
    .in0 (byte0[7:0]),
585
    .in1 (byte1[7:0]),
586
    .in2 (byte2[7:0]),
587
    .in3 (byte3[7:0]),
588
    .sel0(merge1_sel_byte0_mxsel0),
589
    .sel1(merge1_sel_byte1_mxsel1),
590
    .sel2(merge1_sel_byte2_mxsel2),
591
    .sel3(merge1_sel_byte3_mxsel3),
592
    .dout(align_byte1_1h[7:0])
593
);
594
 
595
//assign        align_byte1_2h[7:0]
596
//      = merge1_sel_byte4 ? byte4[7:0] :
597
//                merge1_sel_byte5 ? byte5[7:0] :
598
//                        merge1_sel_byte6 ? byte6[7:0] :
599
//                                      merge1_sel_byte7 ? byte7[7:0] :
600
//                                              8'hxx ; 
601
 
602
   wire       merge1_sel_byte4_mxsel0, merge1_sel_byte5_mxsel1, merge1_sel_byte6_mxsel2, merge1_sel_byte7_mxsel3;
603
   assign     merge1_sel_byte4_mxsel0 = merge1_sel_byte4 & ~rst_tri_en;
604
   assign     merge1_sel_byte5_mxsel1 = merge1_sel_byte5 & ~rst_tri_en;
605
   assign     merge1_sel_byte6_mxsel2 = merge1_sel_byte6 & ~rst_tri_en;
606
   assign     merge1_sel_byte7_mxsel3 = merge1_sel_byte7 |  rst_tri_en;
607
 
608
mux4ds #(8) align_byte1_2h_mx (
609
    .in0 (byte4[7:0]),
610
    .in1 (byte5[7:0]),
611
    .in2 (byte6[7:0]),
612
    .in3 (byte7[7:0]),
613
    .sel0(merge1_sel_byte4_mxsel0),
614
    .sel1(merge1_sel_byte5_mxsel1),
615
    .sel2(merge1_sel_byte6_mxsel2),
616
    .sel3(merge1_sel_byte7_mxsel3),
617
    .dout(align_byte1_2h[7:0])
618
);
619
 
620
//assign        align_byte[15:8] =      
621
//      zero_extend_g[1] ? 8'h00 :
622
//              sign_extend_g[1] ? 8'hff :
623
//                      merge1_sel_byte_1h ? align_byte1_1h[7:0] :
624
//                              merge1_sel_byte_2h ? align_byte1_2h[7:0] :
625
//                                              8'hxx ;
626
 
627
//mux4ds #(8) align_byte1_mx (
628
//    .in0 (8'h00),
629
//    .in1 (8'hff),
630
//    .in2 (align_byte1_1h[7:0]), 
631
//    .in3 (align_byte1_2h[7:0]),
632
//    .sel0(zero_extend_g[1]),
633
//    .sel1(sign_extend_g[1]),
634
//    .sel2(merge1_sel_byte_1h),
635
//    .sel3(merge1_sel_byte_2h),
636
//    .dout(align_byte[15:8])
637
//);
638
 
639
   //change to aoi from pass gate
640
   //don't need zero_extend
641
 
642
assign  align_byte[15:8] =
643
 (sign_extend_g[1] ? 8'hff : 8'h00) |
644
 (merge1_sel_byte_1h ? align_byte1_1h[7:0] : 8'h00) |
645
 (merge1_sel_byte_2h ? align_byte1_2h[7:0] : 8'h00);
646
 
647
// Final endian/justified/sign-extend Byte 2.
648
//assign        align_byte2[7:0]
649
//      = merge2_sel_byte1 ? byte1[7:0] :
650
//                merge2_sel_byte2 ? byte2[7:0] :
651
//                                      merge2_sel_byte5 ? byte5[7:0] :
652
//           merge2_sel_byte6 ?  byte6[7:0] :
653
//                                                      8'hxx ;
654
 
655
   wire       merge2_sel_byte1_mxsel0, merge2_sel_byte2_mxsel1, merge2_sel_byte5_mxsel2, merge2_sel_byte6_mxsel3;
656
   assign     merge2_sel_byte1_mxsel0 = merge2_sel_byte1 & ~rst_tri_en;
657
   assign     merge2_sel_byte2_mxsel1 = merge2_sel_byte2 & ~rst_tri_en;
658
   assign     merge2_sel_byte5_mxsel2 = merge2_sel_byte5 & ~rst_tri_en;
659
   assign     merge2_sel_byte6_mxsel3 = merge2_sel_byte6 |  rst_tri_en;
660
 
661
mux4ds #(8) align_byte2_1st_mx (
662
         .in0 (byte1[7:0]),
663
         .in1 (byte2[7:0]),
664
         .in2 (byte5[7:0]),
665
         .in3 (byte6[7:0]),
666
         .sel0(merge2_sel_byte1_mxsel0),
667
         .sel1(merge2_sel_byte2_mxsel1),
668
         .sel2(merge2_sel_byte5_mxsel2),
669
         .sel3(merge2_sel_byte6_mxsel3),
670
         .dout(align_byte2[7:0])
671
                                );
672
 
673
//assign        align_byte[23:16] =     
674
//      zero_extend_g[2] ? 8'h00 :
675
//              sign_extend_g[2] ? 8'hff :
676
//                              merge2_sel_byte ? align_byte2[7:0] :
677
//                                                              8'hxx ;
678
 
679
//mux3ds #(8) align_byte2_2nd_mx  (
680
//         .in0 (8'h00),
681
//         .in1 (8'hff),
682
//         .in2 (align_byte2[7:0]),
683
//         .sel0(zero_extend_g[2]),
684
//         .sel1(sign_extend_g[2]),
685
//         .sel2(merge2_sel_byte),
686
//         .dout(align_byte[23:16])
687
//                                      );
688
 
689
assign    align_byte[23:16] =
690
( sign_extend_g[2] ? 8'hff : 8'h00) |
691
(  merge2_sel_byte ? align_byte2[7:0] : 8'h00);
692
 
693
// Final endian/justified/sign-extend Byte 3.
694
//assign        align_byte3[7:0]
695
//      = merge3_sel_byte0 ? byte0[7:0] :
696
//                      merge3_sel_byte3 ? byte3[7:0] :
697
//                              merge3_sel_byte4 ? byte4[7:0] :
698
//                              merge3_sel_byte7 ? byte7[7:0] :
699
//                                        8'hxx ;
700
 
701
   wire       merge3_sel_byte0_mxsel0, merge3_sel_byte3_mxsel1, merge3_sel_byte4_mxsel2, merge3_sel_byte7_mxsel3;
702
   assign     merge3_sel_byte0_mxsel0 = merge3_sel_byte0 & ~rst_tri_en;
703
   assign     merge3_sel_byte3_mxsel1 = merge3_sel_byte3 & ~rst_tri_en;
704
   assign     merge3_sel_byte4_mxsel2 = merge3_sel_byte4 & ~rst_tri_en;
705
   assign     merge3_sel_byte7_mxsel3 = merge3_sel_byte7 |  rst_tri_en;
706
 
707
mux4ds #(8) align_byte3_1st_mx (
708
         .in0 (byte0[7:0]),
709
         .in1 (byte3[7:0]),
710
         .in2 (byte4[7:0]),
711
         .in3 (byte7[7:0]),
712
         .sel0(merge3_sel_byte0_mxsel0),
713
         .sel1(merge3_sel_byte3_mxsel1),
714
         .sel2(merge3_sel_byte4_mxsel2),
715
         .sel3(merge3_sel_byte7_mxsel3),
716
         .dout(align_byte3[7:0])
717
                                     );
718
 
719
//assign        align_byte[31:24] =     
720
//      zero_extend_g[3] ? 8'h00 :
721
//              sign_extend_g[3] ? 8'hff :
722
//                      merge3_sel_byte ? align_byte3[7:0] :
723
//                              8'hxx ;
724
 
725
//mux3ds #(8) align_byte3_2nd_mx (
726
//         .in0 (8'h00),
727
//         .in1 (8'hff), 
728
//         .in2 (align_byte3[7:0]),
729
//         .sel0(zero_extend_g[3]),
730
//         .sel1(sign_extend_g[3]),
731
//         .sel2(merge3_sel_byte),
732
//         .dout(align_byte[31:24])
733
//                                     );
734
 
735
assign    align_byte[31:24] =
736
  (sign_extend_g[3] ? 8'hff : 8'h00 ) |
737
  (merge3_sel_byte  ?  align_byte3[7:0] : 8'h00);
738
 
739
// Final endian/justified/sign-extend Byte 4.
740
//assign        align_byte[39:32]
741
//      = zero_extend_g[4] ? 8'h00 :
742
//               sign_extend_g[4] ? 8'hff :
743
//       merge4_sel_byte3 ? byte3[7:0] : 
744
//         merge4_sel_byte4 ? byte4[7:0] : 
745
//           8'hxx;
746
 
747
//mux4ds #(8) align_byte4_mx (
748
//        .in0 (8'h00),
749
//        .in1 (8'hff),
750
//        .in2 (byte3[7:0]),
751
//        .in3 (byte4[7:0]),
752
//        .sel0(zero_extend_g[4]),
753
//        .sel1(sign_extend_g[4]),
754
//        .sel2(merge4_sel_byte3),
755
//        .sel3(merge4_sel_byte4),
756
//        .dout(align_byte[39:32])
757
//                                 );
758
 
759
assign align_byte[39:32] =
760
  (sign_extend_g[4] ? 8'hff : 8'h00) |
761
  (merge4_sel_byte3 ? byte3[7:0] : 8'h00) |
762
  (merge4_sel_byte4 ? byte4[7:0] : 8'h00);
763
 
764
// Final endian/justified/sign-extend Byte 5.
765
//assign        align_byte[47:40]
766
//  = zero_extend_g[5] ? 8'h00 :
767
//                sign_extend_g[5] ? 8'hff :
768
//            merge5_sel_byte2 ? byte2[7:0] : 
769
//          merge5_sel_byte5 ? byte5[7:0] :
770
//            8'hxx ;
771
 
772
//mux4ds #(8) align_byte5_mx (
773
//        .in0 (8'h00),
774
//        .in1 (8'hff),
775
//        .in2 (byte2[7:0]),
776
//        .in3 (byte5[7:0]),
777
//        .sel0(zero_extend_g[5]),
778
//        .sel1(sign_extend_g[5]),
779
//        .sel2(merge5_sel_byte2),
780
//        .sel3(merge5_sel_byte5),
781
//        .dout(align_byte[47:40])
782
//                                 );
783
 
784
assign align_byte[47:40] =
785
 (sign_extend_g[5] ? 8'hff : 8'h00) |
786
 (merge5_sel_byte2 ? byte2[7:0] : 8'h00) |
787
 (merge5_sel_byte5 ? byte5[7:0] : 8'h00);
788
 
789
 
790
// Final endian/justified/sign-extend Byte 6.
791
//assign        align_byte[55:48]
792
//  = zero_extend_g[6] ? 8'h00 :
793
//                sign_extend_g[6] ? 8'hff :     
794
//            merge6_sel_byte1 ? byte1[7:0] : 
795
//         merge6_sel_byte6 ? byte6[7:0] :
796
//            8'hxx ;
797
 
798
//mux4ds #(8) align_byte6_mx (
799
//        .in0 (8'h00),
800
//        .in1 (8'hff),
801
//        .in2 (byte1[7:0]),
802
//        .in3 (byte6[7:0]),
803
//        .sel0(zero_extend_g[6]),
804
//        .sel1(sign_extend_g[6]),
805
//        .sel2(merge6_sel_byte1),
806
//        .sel3(merge6_sel_byte6),
807
//        .dout(align_byte[55:48])
808
//                                 );
809
 
810
assign  align_byte[55:48] =
811
 (sign_extend_g[6] ? 8'hff : 8'h00) |
812
 (merge6_sel_byte1 ? byte1[7:0] : 8'h00) |
813
 (merge6_sel_byte6 ? byte6[7:0] : 8'h00);
814
 
815
 
816
// Final endian/justified/sign-extend Byte 7.
817
//assign        align_byte[63:56] =     
818
//      zero_extend_g[7] ? 8'h00 :
819
//              sign_extend_g[7] ? 8'hff :
820
//                      merge7_sel_byte0 ? byte0[7:0] :
821
//                      merge7_sel_byte7 ? byte7[7:0] :
822
//                                      8'hxx ;
823
 
824
//mux4ds #(8) align_byte7_mx (
825
//        .in0 (8'h00),
826
//        .in1 (8'hff),
827
//        .in2 (byte0[7:0]),
828
//        .in3 (byte7[7:0]),
829
//        .sel0(zero_extend_g[7]),
830
//        .sel1(sign_extend_g[7]),
831
//        .sel2(merge7_sel_byte0),
832
//        .sel3(merge7_sel_byte7),
833
//        .dout(align_byte[63:56])
834
//                                 );
835
 
836
assign align_byte[63:56] =
837
  (sign_extend_g[7] ?  8'hff : 8'h00 ) |
838
  (merge7_sel_byte0 ?  byte0[7:0] : 8'h00) |
839
  (merge7_sel_byte7 ?  byte7[7:0] : 8'h00);
840
 
841
//====================================================
842
//dc_fill CP sign/zero control signals
843
//====================================================
844
   wire [7:0] ld_data_msb_w0_m;
845
   wire [7:0] ld_data_msb_w1_m;
846
   wire [7:0] ld_data_msb_w2_m;
847
   wire [7:0] ld_data_msb_w3_m;
848
 
849
   wire [7:0] ld_data_msb_w0_g;
850
   wire [7:0] ld_data_msb_w1_g;
851
   wire [7:0] ld_data_msb_w2_g;
852
   wire [7:0] ld_data_msb_w3_g;
853
 
854
assign ld_data_msb_w0_m[7:0] = dcache_rdata_msb_w0_m[7:0];
855
assign ld_data_msb_w1_m[7:0] = dcache_rdata_msb_w1_m[7:0];
856
assign ld_data_msb_w2_m[7:0] = dcache_rdata_msb_w2_m[7:0];
857
assign ld_data_msb_w3_m[7:0] = dcache_rdata_msb_w3_m[7:0];
858
 
859
dff #(32) ld_data_msb_stgg (
860
        .din    ({ld_data_msb_w0_m[7:0], ld_data_msb_w1_m[7:0], ld_data_msb_w2_m[7:0], ld_data_msb_w3_m[7:0]}),
861
        .q      ({ld_data_msb_w0_g[7:0], ld_data_msb_w1_g[7:0], ld_data_msb_w2_g[7:0], ld_data_msb_w3_g[7:0]}),
862
        .clk    (clk),
863
        .se     (se),       .si (),          .so ()
864
        );
865
 
866
   wire [3:0] dcache_alt_rsel_way_m;
867
   wire       dcache_alt_mx_sel_m;
868
 
869
dff #(5) dcache_alt_stgm  (
870
        .din    ({lsu_bist_rsel_way_e[3:0],  dcache_alt_mx_sel_e}),
871
        .q      ({dcache_alt_rsel_way_m[3:0], dcache_alt_mx_sel_m}),
872
        .clk    (clk),
873
        .se     (se),       .si (),          .so ()
874
        );
875
 
876
   wire [3:0] dcache_alt_rsel_way_g;
877
   wire       dcache_alt_mx_sel_g;
878
 
879
dff #(5) dcache_alt_stgg  (
880
        .din    ({dcache_alt_rsel_way_m[3:0],  dcache_alt_mx_sel_m}),
881
        .q      ({dcache_alt_rsel_way_g[3:0],  dcache_alt_mx_sel_g}),
882
        .clk    (clk),
883
        .se     (se),       .si (),          .so ()
884
        );
885
   wire [3:0] cache_way_mx_sel;
886
 
887
   assign     cache_way_mx_sel [3:0] = dcache_alt_mx_sel_g ? dcache_alt_rsel_way_g[3:0] : cache_way_hit_buf2[3:0];
888
 
889
//   wire [7:0] align_bytes_msb;
890
 
891
//mux4ds  #(8) align_bytes_msb_mux (
892
//        .in0    (ld_data_msb_w0_g[7:0]),
893
//        .in1    (ld_data_msb_w1_g[7:0]),
894
//        .in2    (ld_data_msb_w2_g[7:0]),
895
//        .in3    (ld_data_msb_w3_g[7:0]),
896
//        .sel0   (cache_way_mx_sel[0]),  
897
//        .sel1   (cache_way_mx_sel[1]),
898
//        .sel2   (cache_way_mx_sel[2]),  
899
//        .sel3   (cache_way_mx_sel[3]),
900
//        .dout   (align_bytes_msb[7:0])
901
//);
902
 
903
   wire       signed_ldst_byte_g;
904
   wire       signed_ldst_hw_g;
905
   wire       signed_ldst_w_g;
906
 
907
dff #(3) ldst_size_stgg(
908
 .din    ({signed_ldst_byte_m, signed_ldst_hw_m, signed_ldst_w_m}),
909
 .q      ({signed_ldst_byte_g, signed_ldst_hw_g, signed_ldst_w_g}),
910
 .clk    (clk),
911
 .se     (se),       .si (),          .so ()
912
);
913
 
914
wire [7:0] morphed_addr_g;
915
 
916
dff #(8) stgg_morphadd(
917
        .din    (morphed_addr_m[7:0]),
918
        .q      (morphed_addr_g[7:0]),
919
        .clk    (clk),
920
        .se     (se),       .si (),          .so ()
921
        );
922
 
923
   wire       sign_bit_w0_g, sign_bit_w1_g, sign_bit_w2_g, sign_bit_w3_g;
924
 
925
assign  sign_bit_w0_g =
926
  (morphed_addr_g[0] & ld_data_msb_w0_g[7]) |
927
  (morphed_addr_g[1] & ld_data_msb_w0_g[6]) |
928
  (morphed_addr_g[2] & ld_data_msb_w0_g[5]) |
929
  (morphed_addr_g[3] & ld_data_msb_w0_g[4]) |
930
  (morphed_addr_g[4] & ld_data_msb_w0_g[3]) |
931
  (morphed_addr_g[5] & ld_data_msb_w0_g[2]) |
932
  (morphed_addr_g[6] & ld_data_msb_w0_g[1]) |
933
  (morphed_addr_g[7] & ld_data_msb_w0_g[0]) ;
934
 
935
assign  sign_bit_w1_g =
936
  (morphed_addr_g[0] & ld_data_msb_w1_g[7]) |
937
  (morphed_addr_g[1] & ld_data_msb_w1_g[6]) |
938
  (morphed_addr_g[2] & ld_data_msb_w1_g[5]) |
939
  (morphed_addr_g[3] & ld_data_msb_w1_g[4]) |
940
  (morphed_addr_g[4] & ld_data_msb_w1_g[3]) |
941
  (morphed_addr_g[5] & ld_data_msb_w1_g[2]) |
942
  (morphed_addr_g[6] & ld_data_msb_w1_g[1]) |
943
  (morphed_addr_g[7] & ld_data_msb_w1_g[0]) ;
944
 
945
assign  sign_bit_w2_g =
946
  (morphed_addr_g[0] & ld_data_msb_w2_g[7]) |
947
  (morphed_addr_g[1] & ld_data_msb_w2_g[6]) |
948
  (morphed_addr_g[2] & ld_data_msb_w2_g[5]) |
949
  (morphed_addr_g[3] & ld_data_msb_w2_g[4]) |
950
  (morphed_addr_g[4] & ld_data_msb_w2_g[3]) |
951
  (morphed_addr_g[5] & ld_data_msb_w2_g[2]) |
952
  (morphed_addr_g[6] & ld_data_msb_w2_g[1]) |
953
  (morphed_addr_g[7] & ld_data_msb_w2_g[0]) ;
954
 
955
assign  sign_bit_w3_g =
956
  (morphed_addr_g[0] & ld_data_msb_w3_g[7]) |
957
  (morphed_addr_g[1] & ld_data_msb_w3_g[6]) |
958
  (morphed_addr_g[2] & ld_data_msb_w3_g[5]) |
959
  (morphed_addr_g[3] & ld_data_msb_w3_g[4]) |
960
  (morphed_addr_g[4] & ld_data_msb_w3_g[3]) |
961
  (morphed_addr_g[5] & ld_data_msb_w3_g[2]) |
962
  (morphed_addr_g[6] & ld_data_msb_w3_g[1]) |
963
  (morphed_addr_g[7] & ld_data_msb_w3_g[0]) ;
964
 
965
//assign  sign_bit_g =
966
//  (morphed_addr_g[0] & align_bytes_msb[7]) |
967
//  (morphed_addr_g[1] & align_bytes_msb[6]) |
968
//  (morphed_addr_g[2] & align_bytes_msb[5]) |
969
//  (morphed_addr_g[3] & align_bytes_msb[4]) |
970
//  (morphed_addr_g[4] & align_bytes_msb[3]) |
971
//  (morphed_addr_g[5] & align_bytes_msb[2]) |
972
//  (morphed_addr_g[6] & align_bytes_msb[1]) |
973
//  (morphed_addr_g[7] & align_bytes_msb[0]) ;
974
 
975
 
976
//dff #(4) ssign_bit_stgg (
977
//        .din    ({sign_bit_w0_m, sign_bit_w1_m, sign_bit_w2_m, sign_bit_w3_m}),
978
//        .q      ({sign_bit_w0_g, sign_bit_w1_g, sign_bit_w2_g, sign_bit_w3_g}),
979
//        .clk    (clk),
980
//        .se     (se),       .si (),          .so ()
981
//        );
982
 
983
// byte0 never requires sign or zero extension.
984
//w0
985
//   wire [3:1] lsu_byp_byte_zero_extend_w0;
986
   wire [7:1] lsu_byp_byte_sign_extend_w0;
987
 
988
//assign  lsu_byp_byte_zero_extend_w0[1] =
989
//        unsigned_ldst_byte_g | (signed_ldst_byte_g & ~sign_bit_w0_g);
990
 
991
assign  lsu_byp_byte_sign_extend_w0[1] =
992
        signed_ldst_byte_g & sign_bit_w0_g;
993
 
994
//assign  lsu_byp_byte_zero_extend_w0[2] =
995
//        unsigned_ldst_hw_g | (signed_ldst_hw_g & ~sign_bit_w0_g);
996
 
997
assign  lsu_byp_byte_sign_extend_w0[2] =
998
        signed_ldst_hw_g & sign_bit_w0_g;
999
 
1000
//assign  lsu_byp_byte_zero_extend_w0[3] =
1001
//        lsu_byp_byte_zero_extend_w0[2] ;
1002
 
1003
assign  lsu_byp_byte_sign_extend_w0[3] =
1004
        lsu_byp_byte_sign_extend_w0[2] ;
1005
 
1006
//assign  lsu_byp_byte_zero_extend_w0[4] =
1007
//        unsigned_ldst_w_g | (signed_ldst_w_g & ~sign_bit_w0_g);
1008
 
1009
assign  lsu_byp_byte_sign_extend_w0[4] =
1010
        signed_ldst_w_g & sign_bit_w0_g;
1011
 
1012
//assign  lsu_byp_byte_zero_extend_w0[5] =
1013
//    lsu_byp_byte_zero_extend_w0[4] ;
1014
assign  lsu_byp_byte_sign_extend_w0[5] =
1015
    lsu_byp_byte_sign_extend_w0[4] ;
1016
//assign  lsu_byp_byte_zero_extend_w0[6] =
1017
//    lsu_byp_byte_zero_extend_w0[4] ;
1018
assign  lsu_byp_byte_sign_extend_w0[6] =
1019
    lsu_byp_byte_sign_extend_w0[4] ;
1020
//assign  lsu_byp_byte_zero_extend_w0[7] =
1021
//    lsu_byp_byte_zero_extend_w0[4] ;
1022
assign  lsu_byp_byte_sign_extend_w0[7] =
1023
    lsu_byp_byte_sign_extend_w0[4] ;
1024
 
1025
//w1
1026
//   wire [3:1] lsu_byp_byte_zero_extend_w1;
1027
   wire [7:1] lsu_byp_byte_sign_extend_w1;
1028
 
1029
//assign  lsu_byp_byte_zero_extend_w1[1] =
1030
//        unsigned_ldst_byte_g | (signed_ldst_byte_g & ~sign_bit_w1_g);
1031
 
1032
assign  lsu_byp_byte_sign_extend_w1[1] =
1033
        signed_ldst_byte_g & sign_bit_w1_g;
1034
 
1035
//assign  lsu_byp_byte_zero_extend_w1[2] =
1036
//        unsigned_ldst_hw_g | (signed_ldst_hw_g & ~sign_bit_w1_g);
1037
 
1038
assign  lsu_byp_byte_sign_extend_w1[2] =
1039
        signed_ldst_hw_g & sign_bit_w1_g;
1040
 
1041
//assign  lsu_byp_byte_zero_extend_w1[3] =
1042
//        lsu_byp_byte_zero_extend_w1[2] ;
1043
 
1044
assign  lsu_byp_byte_sign_extend_w1[3] =
1045
        lsu_byp_byte_sign_extend_w1[2] ;
1046
 
1047
//assign  lsu_byp_byte_zero_extend_w1[4] =
1048
//        unsigned_ldst_w_g | (signed_ldst_w_g & ~sign_bit_w1_g);
1049
 
1050
assign  lsu_byp_byte_sign_extend_w1[4] =
1051
        signed_ldst_w_g & sign_bit_w1_g;
1052
 
1053
//assign  lsu_byp_byte_zero_extend_w1[5] =
1054
//    lsu_byp_byte_zero_extend_w1[4] ;
1055
assign  lsu_byp_byte_sign_extend_w1[5] =
1056
    lsu_byp_byte_sign_extend_w1[4] ;
1057
//assign  lsu_byp_byte_zero_extend_w1[6] =
1058
//    lsu_byp_byte_zero_extend_w1[4] ;
1059
assign  lsu_byp_byte_sign_extend_w1[6] =
1060
    lsu_byp_byte_sign_extend_w1[4] ;
1061
//assign  lsu_byp_byte_zero_extend_w1[7] =
1062
//    lsu_byp_byte_zero_extend_w1[4] ;
1063
assign  lsu_byp_byte_sign_extend_w1[7] =
1064
    lsu_byp_byte_sign_extend_w1[4] ;
1065
 
1066
//w2
1067
//   wire [3:1] lsu_byp_byte_zero_extend_w2;
1068
   wire [7:1] lsu_byp_byte_sign_extend_w2;
1069
 
1070
//assign  lsu_byp_byte_zero_extend_w2[1] =
1071
//        unsigned_ldst_byte_g | (signed_ldst_byte_g & ~sign_bit_w2_g);
1072
 
1073
assign  lsu_byp_byte_sign_extend_w2[1] =
1074
        signed_ldst_byte_g & sign_bit_w2_g;
1075
 
1076
//assign  lsu_byp_byte_zero_extend_w2[2] =
1077
//        unsigned_ldst_hw_g | (signed_ldst_hw_g & ~sign_bit_w2_g);
1078
 
1079
assign  lsu_byp_byte_sign_extend_w2[2] =
1080
        signed_ldst_hw_g & sign_bit_w2_g;
1081
 
1082
//assign  lsu_byp_byte_zero_extend_w2[3] =
1083
//        lsu_byp_byte_zero_extend_w2[2] ;
1084
 
1085
assign  lsu_byp_byte_sign_extend_w2[3] =
1086
        lsu_byp_byte_sign_extend_w2[2] ;
1087
 
1088
//assign  lsu_byp_byte_zero_extend_w2[4] =
1089
//        unsigned_ldst_w_g | (signed_ldst_w_g & ~sign_bit_w2_g);
1090
 
1091
assign  lsu_byp_byte_sign_extend_w2[4] =
1092
        signed_ldst_w_g & sign_bit_w2_g;
1093
 
1094
//assign  lsu_byp_byte_zero_extend_w2[5] =
1095
//    lsu_byp_byte_zero_extend_w2[4] ;
1096
assign  lsu_byp_byte_sign_extend_w2[5] =
1097
    lsu_byp_byte_sign_extend_w2[4] ;
1098
//assign  lsu_byp_byte_zero_extend_w2[6] =
1099
//    lsu_byp_byte_zero_extend_w2[4] ;
1100
assign  lsu_byp_byte_sign_extend_w2[6] =
1101
    lsu_byp_byte_sign_extend_w2[4] ;
1102
//assign  lsu_byp_byte_zero_extend_w2[7] =
1103
//    lsu_byp_byte_zero_extend_w2[4] ;
1104
assign  lsu_byp_byte_sign_extend_w2[7] =
1105
    lsu_byp_byte_sign_extend_w2[4] ;
1106
 
1107
//w3
1108
//   wire [3:1] lsu_byp_byte_zero_extend_w3;
1109
   wire [7:1] lsu_byp_byte_sign_extend_w3;
1110
 
1111
//assign  lsu_byp_byte_zero_extend_w3[1] =
1112
//        unsigned_ldst_byte_g | (signed_ldst_byte_g & ~sign_bit_w3_g);
1113
 
1114
assign  lsu_byp_byte_sign_extend_w3[1] =
1115
        signed_ldst_byte_g & sign_bit_w3_g;
1116
 
1117
//assign  lsu_byp_byte_zero_extend_w3[2] =
1118
//        unsigned_ldst_hw_g | (signed_ldst_hw_g & ~sign_bit_w3_g);
1119
 
1120
assign  lsu_byp_byte_sign_extend_w3[2] =
1121
        signed_ldst_hw_g & sign_bit_w3_g;
1122
 
1123
//assign  lsu_byp_byte_zero_extend_w3[3] =
1124
//        lsu_byp_byte_zero_extend_w3[2] ;
1125
 
1126
assign  lsu_byp_byte_sign_extend_w3[3] =
1127
        lsu_byp_byte_sign_extend_w3[2] ;
1128
 
1129
//assign  lsu_byp_byte_zero_extend_w3[4] =
1130
//        unsigned_ldst_w_g | (signed_ldst_w_g & ~sign_bit_w3_g);
1131
 
1132
assign  lsu_byp_byte_sign_extend_w3[4] =
1133
        signed_ldst_w_g & sign_bit_w3_g;
1134
 
1135
//assign  lsu_byp_byte_zero_extend_w3[5] =
1136
//    lsu_byp_byte_zero_extend_w3[4] ;
1137
assign  lsu_byp_byte_sign_extend_w3[5] =
1138
    lsu_byp_byte_sign_extend_w3[4] ;
1139
//assign  lsu_byp_byte_zero_extend_w3[6] =
1140
//    lsu_byp_byte_zero_extend_w3[4] ;
1141
assign  lsu_byp_byte_sign_extend_w3[6] =
1142
    lsu_byp_byte_sign_extend_w3[4] ;
1143
//assign  lsu_byp_byte_zero_extend_w3[7] =
1144
//    lsu_byp_byte_zero_extend_w3[4] ;
1145
assign  lsu_byp_byte_sign_extend_w3[7] =
1146
    lsu_byp_byte_sign_extend_w3[4] ;
1147
 
1148
 
1149
//mux4ds  #(14) zero_sign_sel_mux (
1150
//        .in0    ({lsu_byp_byte_zero_extend_w0[7:1],lsu_byp_byte_sign_extend_w0[7:1]}),
1151
//        .in1    ({lsu_byp_byte_zero_extend_w1[7:1],lsu_byp_byte_sign_extend_w1[7:1]}),
1152
//        .in2    ({lsu_byp_byte_zero_extend_w2[7:1],lsu_byp_byte_sign_extend_w2[7:1]}),
1153
//        .in3    ({lsu_byp_byte_zero_extend_w3[7:1],lsu_byp_byte_sign_extend_w3[7:1]}),
1154
//        .sel0   (cache_way_mx_sel[0]),  
1155
//        .sel1   (cache_way_mx_sel[1]),
1156
//        .sel2   (cache_way_mx_sel[2]),  
1157
//        .sel3   (cache_way_mx_sel[3]),
1158
//        .dout   ({lsu_byp_byte_zero_extend[7:1],lsu_byp_byte_sign_extend[7:1]})
1159
//);
1160
 
1161
//assign lsu_byp_byte_zero_extend[3:1] =
1162
//   (cache_way_mx_sel[0] ?  lsu_byp_byte_zero_extend_w0[3:1] : 3'b0 ) |   
1163
//   (cache_way_mx_sel[1] ?  lsu_byp_byte_zero_extend_w1[3:1] : 3'b0 ) |   
1164
//   (cache_way_mx_sel[2] ?  lsu_byp_byte_zero_extend_w2[3:1] : 3'b0 ) |   
1165
//   (cache_way_mx_sel[3] ?  lsu_byp_byte_zero_extend_w3[3:1] : 3'b0 ) ;
1166
 
1167
assign lsu_byp_byte_sign_extend[7:1] =
1168
   (cache_way_mx_sel[0] ?  lsu_byp_byte_sign_extend_w0[7:1] : 7'b0) |
1169
   (cache_way_mx_sel[1] ?  lsu_byp_byte_sign_extend_w1[7:1] : 7'b0) |
1170
   (cache_way_mx_sel[2] ?  lsu_byp_byte_sign_extend_w2[7:1] : 7'b0) |
1171
   (cache_way_mx_sel[3] ?  lsu_byp_byte_sign_extend_w3[7:1] : 7'b0) ;
1172
 
1173
 
1174
 
1175
dff #(37) stgg_mergesel(
1176
        .din    ({
1177
         merge7_sel_byte0_m, merge7_sel_byte7_m,
1178
         merge6_sel_byte1_m, merge6_sel_byte6_m,
1179
         merge5_sel_byte2_m, merge5_sel_byte5_m,
1180
         merge4_sel_byte3_m, merge4_sel_byte4_m,
1181
         merge3_sel_byte0_m, merge3_sel_byte3_m,
1182
         merge3_sel_byte4_m, merge3_sel_byte7_default_m, merge3_sel_byte_m,
1183
         merge2_sel_byte1_m, merge2_sel_byte2_m,         merge2_sel_byte5_m,
1184
         merge2_sel_byte6_default_m, merge2_sel_byte_m,
1185
         merge0_sel_byte0_m, merge0_sel_byte1_m,
1186
         merge0_sel_byte2_m, merge0_sel_byte3_default_m,
1187
         merge0_sel_byte4_m, merge0_sel_byte5_m,
1188
         merge0_sel_byte6_m, merge0_sel_byte7_default_m,
1189
         merge1_sel_byte0_m, merge1_sel_byte1_m,
1190
         merge1_sel_byte2_m, merge1_sel_byte3_default_m,
1191
         merge1_sel_byte4_m, merge1_sel_byte5_m,
1192
         merge1_sel_byte6_m, merge1_sel_byte7_default_m,
1193
         merge0_sel_byte_1h_m,merge1_sel_byte_1h_m, merge1_sel_byte_2h_m
1194
                }),
1195
        .q      ({
1196
         merge7_sel_byte0, merge7_sel_byte7,
1197
         merge6_sel_byte1, merge6_sel_byte6,
1198
         merge5_sel_byte2, merge5_sel_byte5,
1199
         merge4_sel_byte3, merge4_sel_byte4,
1200
         merge3_sel_byte0, merge3_sel_byte3,
1201
         merge3_sel_byte4, merge3_sel_byte7,merge3_sel_byte,
1202
         merge2_sel_byte1, merge2_sel_byte2, merge2_sel_byte5,
1203
         merge2_sel_byte6, merge2_sel_byte,
1204
         merge0_sel_byte0, merge0_sel_byte1,
1205
         merge0_sel_byte2, merge0_sel_byte3,
1206
         merge0_sel_byte4, merge0_sel_byte5,
1207
         merge0_sel_byte6, merge0_sel_byte7,
1208
         merge1_sel_byte0, merge1_sel_byte1,
1209
         merge1_sel_byte2, merge1_sel_byte3,
1210
         merge1_sel_byte4, merge1_sel_byte5,
1211
         merge1_sel_byte6, merge1_sel_byte7,
1212
         merge0_sel_byte_1h,merge1_sel_byte_1h, merge1_sel_byte_2h
1213
                }),
1214
        .clk    (clk),
1215
        .se     (se),       .si (),          .so ()
1216
        );
1217
 
1218
 
1219
assign  lsu_exu_dfill_data_w2[63:0] = align_byte[63:0] ;
1220
assign  lsu_ffu_ld_data[63:0] = align_byte[63:0] ;
1221
 
1222
endmodule
1223
 
1224
 

powered by: WebSVN 2.1.0

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