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

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [hdl/] [rtl/] [sparc_core/] [lsu_tlbdp.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_tlbdp.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
/* ========== Copyright Header Begin ==========================================
24
*
25
* OpenSPARC T1 Processor File: lsu.h
26
* Copyright (c) 2006 Sun Microsystems, Inc.  All Rights Reserved.
27
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
28
*
29
* The above named program is free software; you can redistribute it and/or
30
* modify it under the terms of the GNU General Public
31
* License version 2 as published by the Free Software Foundation.
32
*
33
* The above named program is distributed in the hope that it will be
34
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
35
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
36
* General Public License for more details.
37
*
38
* You should have received a copy of the GNU General Public
39
* License along with this work; if not, write to the Free Software
40
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
41
*
42
* ========== Copyright Header End ============================================
43
*/
44
 
45
 
46
 
47
 
48
 
49
 
50
 
51
 
52
//`define STB_PCX_WY_HI   107
53
//`define STB_PCX_WY_LO   106
54
 
55
 
56
 
57
 
58
 
59
 
60
 
61
 
62
 
63
 
64
 
65
 
66
 
67
 
68
 
69
 
70
 
71
 
72
 
73
 
74
 
75
 
76
 
77
 
78
 
79
 
80
 
81
 
82
 
83
 
84
 
85
 
86
 
87
 
88
 
89
 
90
 
91
 
92
 
93
 
94
 
95
 
96
 
97
 
98
 
99
 
100
 
101
 
102
 
103
 
104
 
105
 
106
 
107
 
108
 
109
 
110
 
111
 
112
 
113
 
114
 
115
 
116
 
117
 
118
 
119
 
120
 
121
 
122
 
123
 
124
 
125
 
126
 
127
 
128
 
129
 
130
 
131
 
132
 
133
 
134
 
135
 
136
 
137
// TLB Tag and Data Format
138
 
139
 
140
 
141
 
142
 
143
 
144
 
145
 
146
 
147
 
148
 
149
 
150
 
151
 
152
 
153
 
154
 
155
 
156
 
157
 
158
 
159
 
160
 
161
 
162
 
163
 
164
 
165
 
166
 
167
 
168
 
169
 
170
 
171
 
172
 
173
 
174
 
175
 
176
 
177
 
178
 
179
 
180
 
181
 
182
 
183
 
184
 
185
 
186
 
187
 
188
 
189
 
190
 
191
 
192
 
193
 
194
 
195
 
196
 
197
 
198
 
199
// I-TLB version - lsu_tlb only.
200
 
201
 
202
 
203
 
204
 
205
 
206
 
207
 
208
 
209
 
210
 
211
 
212
 
213
 
214
 
215
 
216
 
217
 
218
 
219
 
220
 
221
 
222
 
223
 
224
// Invalidate Format
225
//addr<5:4>=00
226
 
227
 
228
 
229
 
230
 
231
 
232
 
233
 
234
 
235
 
236
 
237
 
238
 
239
 
240
 
241
 
242
 
243
//addr<5:4>=01
244
 
245
 
246
 
247
 
248
 
249
 
250
 
251
 
252
 
253
 
254
 
255
 
256
 
257
 
258
 
259
 
260
 
261
//addr<5:4>=10
262
 
263
 
264
 
265
 
266
 
267
 
268
 
269
 
270
 
271
 
272
 
273
 
274
 
275
 
276
 
277
 
278
 
279
//addr<5:4>=11
280
 
281
 
282
 
283
 
284
 
285
 
286
 
287
 
288
 
289
 
290
 
291
 
292
 
293
 
294
 
295
 
296
 
297
// cpuid - 4b
298
 
299
 
300
 
301
// CPUany, addr<5:4>=00,10
302
 
303
 
304
 
305
 
306
 
307
// CPUany, addr<5:4>=01,11
308
 
309
 
310
 
311
 
312
// CPUany, addr<5:4>=01,11
313
 
314
 
315
 
316
 
317
// DTAG parity error Invalidate
318
 
319
 
320
 
321
 
322
// CPX BINIT STORE
323
 
324
 
325
module lsu_tlbdp(/*AUTOARG*/
326
   // Outputs
327
   so, lsu_tlb_rd_data, tlb_pgnum_buf, tlb_pgnum_buf2,
328
   tlb_rd_tte_data_ie_buf, stb_cam_vld, tte_data_parity_error,
329
   tte_tag_parity_error, cache_way_hit_buf1, cache_way_hit_buf2,
330
   lsu_tlu_tte_pg_sz_g,
331
   // Inputs
332
   rclk, si, se, tlb_rd_tte_tag, tlb_rd_tte_data,
333
   lsu_tlb_data_rd_vld_g, tlb_pgnum, asi_internal_m, lsu_alt_space_m,
334
   tlb_cam_hit, ifu_lsu_ld_inst_e, lsu_dtlb_bypass_e,
335
   tlb_rd_tte_data_parity, tlb_rd_tte_tag_parity, cache_way_hit
336
   );
337
 
338
   input  rclk;
339
   input  si;
340
   input  se;
341
   output so;
342
 
343
input   [58:0]           tlb_rd_tte_tag ;         // tte tag from tlb
344
input   [42:0]          tlb_rd_tte_data ;        // tte data from tlb
345
input                   lsu_tlb_data_rd_vld_g ;  // select between tte tag/data rd.             
346
 
347
input [39:10]           tlb_pgnum;
348
input                   asi_internal_m;
349
   input                lsu_alt_space_m;
350
 
351
// **new**
352
output  [63:0]           lsu_tlb_rd_data ;       // tag or data rd from tlb
353
 
354
 
355
 
356
   output [39:10]        tlb_pgnum_buf;
357
   output [39:37]        tlb_pgnum_buf2;
358
//   output [42:0]         tlb_rd_tte_data_buf;
359
   output             tlb_rd_tte_data_ie_buf;
360
 
361
//======================================================
362
//stb cam vld mved from stb_rwctl    
363
input     tlb_cam_hit ;
364
input     ifu_lsu_ld_inst_e;
365
input     lsu_dtlb_bypass_e;
366
output    stb_cam_vld;
367
 
368
 
369
input    tlb_rd_tte_data_parity ; // data parity bit from tte data
370
input    tlb_rd_tte_tag_parity ;  // data parity bit from tte tag
371
output   tte_data_parity_error ;
372
output   tte_tag_parity_error ;
373
 
374
   input [3:0] cache_way_hit;
375
   output [3:0] cache_way_hit_buf1;
376
   output [3:0] cache_way_hit_buf2;
377
 
378
output  [2:0]           lsu_tlu_tte_pg_sz_g ;   // page-size of tte 
379
 
380
wire   tlb_rd_tte_data_27_22_sel_buf;
381
wire   tlb_rd_tte_data_21_16_sel_buf;
382
wire   tlb_rd_tte_data_15_13_sel_buf;
383
wire   lsu_tte_pg_sz_b2, lsu_tte_pg_sz_b1, lsu_tte_pg_sz_b0;
384
wire   pg_sz_b0, pg_sz_b1, pg_sz_b2;
385
 
386
//===============================================================
387
   wire   tlb_tte_data_mx_sel2, tlb_tte_data_mx_sel1, tlb_tte_data_mx_sel0;
388
//tlb_tte_data_mx_sel2 ;  // select for bits 21-19
389
//tlb_tte_data_mx_sel1 ;  // select for bits 18-16
390
//tlb_tte_data_mx_sel0 ;  // select for bits 15-13
391
 
392
   assign tlb_tte_data_mx_sel2 = tlb_rd_tte_data_27_22_sel_buf;
393
   assign tlb_tte_data_mx_sel1 = tlb_rd_tte_data_21_16_sel_buf;
394
   assign tlb_tte_data_mx_sel0 = tlb_rd_tte_data_15_13_sel_buf;
395
 
396
// assign  pg_sz_b0 = 
397
//  (~tlb_tte_data_mx_sel1 & tlb_tte_data_mx_sel0) | // 64K
398
//  ( tlb_tte_data_mx_sel1 & tlb_tte_data_mx_sel0) ; // 4M/256M
399
 
400
assign  pg_sz_b0 =  tlb_tte_data_mx_sel0;
401
 
402
assign  pg_sz_b1 =
403
  (~tlb_tte_data_mx_sel2 & tlb_tte_data_mx_sel1 &  tlb_tte_data_mx_sel0) ; // 4M
404
assign  pg_sz_b2 =
405
  ( tlb_tte_data_mx_sel2 & tlb_tte_data_mx_sel1 &  tlb_tte_data_mx_sel0) ; // 256M
406
 
407
assign  lsu_tte_pg_sz_b2 = pg_sz_b2 ;
408
assign  lsu_tte_pg_sz_b1 = pg_sz_b1 ;
409
assign  lsu_tte_pg_sz_b0 = pg_sz_b0 ;
410
 
411
assign lsu_tlu_tte_pg_sz_g[2:0] = {pg_sz_b2,pg_sz_b1,pg_sz_b0} ;
412
 
413
// CAM VLD GENERATION
414
 
415
// Unfortunately because of timing considerations, this cannot be qualified with
416
// flush and inst_vld. Must exclude other conditions though such as internal asi
417
// atomics etc !!! (NOTE : earlier version of inst_vld may be obtained.   
418
   wire   clk;
419
 
420
   assign   clk =rclk;
421
 
422
wire  dtlb_bypass_m ;
423
dff #(1) dtlb_bypass_stgm  (
424
  .din    (lsu_dtlb_bypass_e), .q (dtlb_bypass_m),
425
  .clk    (clk),
426
  .se     (se), .si (), .so ()
427
  );
428
 
429
dff #(1) ld_inst_vld_stgm  (
430
  .din    (ifu_lsu_ld_inst_e), .q (ld_inst_vld_m),
431
  .clk    (clk),
432
  .se     (se), .si (), .so ()
433
  );
434
 
435
assign  stb_cam_vld = ld_inst_vld_m & (tlb_cam_hit | dtlb_bypass_m) &
436
                      ~(asi_internal_m  & lsu_alt_space_m); //bug 4635, revisit
437
//======================================================================   
438
 
439
//buffer all inputs first
440
wire   [58:0]         tlb_rd_tte_tag_buf ;
441
wire   [42:0]         tlb_rd_tte_data_buf ;
442
wire                                lsu_tte_pg_sz_b1_buf;
443
wire                                lsu_tte_pg_sz_b0_buf;
444
wire                                lsu_tte_pg_sz_b2_buf;
445
wire   [39:10]        tlb_pgnum_l;
446
wire   [39:10]        tlb_pgnum_buf;
447
wire   [39:37]        tlb_pgnum_buf2;
448
 
449
//BUFFERS
450
   assign             tlb_rd_tte_tag_buf[58:0] = tlb_rd_tte_tag[58:0];
451
   assign             lsu_tte_pg_sz_b1_buf = lsu_tte_pg_sz_b1;
452
   assign             lsu_tte_pg_sz_b0_buf = lsu_tte_pg_sz_b0;
453
   assign             lsu_tte_pg_sz_b2_buf = lsu_tte_pg_sz_b2;
454
 
455
   //tlb_pgnum buffer
456
   assign             tlb_pgnum_l [39:10] = ~ tlb_pgnum[39:10];
457
   assign             tlb_pgnum_buf[39:10] = ~ tlb_pgnum_l[39:10];
458
   assign             tlb_pgnum_buf2[39:37] = ~ tlb_pgnum_l[39:37];
459
 
460
   assign             tlb_rd_tte_data_buf[42:0] = tlb_rd_tte_data[42:0];
461
 
462
   assign tlb_rd_tte_data_ie_buf =  tlb_rd_tte_data_buf [9];
463
   assign tlb_rd_tte_data_27_22_sel_buf = tlb_rd_tte_data_buf [23];
464
   assign tlb_rd_tte_data_21_16_sel_buf = tlb_rd_tte_data_buf [16];
465
   assign tlb_rd_tte_data_15_13_sel_buf = tlb_rd_tte_data_buf [12];
466
 
467
 
468
wire    [63:0]   formatted_tte_tag, formatted_tte_data;
469
 
470
//=================================================================================================
471
//      Format TLB Tag 
472
//=================================================================================================
473
 
474
assign  formatted_tte_tag[63:0] =
475
        {
476
        tlb_rd_tte_tag_buf[58:56],
477
        tlb_rd_tte_tag_buf[55],
478
        // ECO 4265 begin
479
        tlb_rd_tte_tag_buf[54],           // Parity
480
        tlb_rd_tte_tag_buf[27], // mxsel2 - b27:22 vld 
481
        tlb_rd_tte_tag_buf[17], // mxsel1 - b21:16 vld
482
        tlb_rd_tte_tag_buf[13], // mxsel0 - b15:13 vld
483
        {8{tlb_rd_tte_tag_buf[53]}},                                        // (8b)
484
        // ECO 4265 end
485
        tlb_rd_tte_tag_buf[53:34],    // (20b)
486
        tlb_rd_tte_tag_buf[33:28],    // (6b)
487
        tlb_rd_tte_tag_buf[23:18],    // (6b)
488
        tlb_rd_tte_tag_buf[16:14],    // (3b)
489
        tlb_rd_tte_tag_buf[12:0] // (13b)
490
        } ;
491
/*
492
assign  formatted_tte_tag[63:0] =
493
        {
494
        {16{tlb_rd_tte_tag_buf[54]}},                                       // (16b)
495
        tlb_rd_tte_tag_buf[`STLB_TAG_VA_47_22_HI:`STLB_TAG_VA_47_22_LO],    // (26b)
496
        tlb_rd_tte_tag_buf[`STLB_TAG_VA_21_20_HI:`STLB_TAG_VA_21_20_LO],    // (3b)
497
        tlb_rd_tte_tag_buf[`STLB_TAG_VA_19],
498
        tlb_rd_tte_tag_buf[`STLB_TAG_VA_18_17_HI:`STLB_TAG_VA_18_17_LO],    // (3b)
499
        tlb_rd_tte_tag_buf[`STLB_TAG_VA_16],
500
        tlb_rd_tte_tag_buf[`STLB_TAG_VA_15_14_HI:`STLB_TAG_VA_15_14_LO],    // (3b)
501
        tlb_rd_tte_tag_buf[`STLB_TAG_VA_13],
502
        tlb_rd_tte_tag_buf[`STLB_TAG_CTXT_12_7_HI:`STLB_TAG_CTXT_12_7_LO],  // (13b)
503
        tlb_rd_tte_tag_buf[`STLB_TAG_CTXT_6_0_HI:`STLB_TAG_CTXT_6_0_LO]
504
        } ;
505
*/
506
 
507
 
508
//=================================================================================================
509
//      Format TLB Data 
510
//=================================================================================================
511
 
512
assign  formatted_tte_data[63:0] =
513
        {
514
        tlb_rd_tte_tag_buf[26],            // V    (1b)
515
        lsu_tte_pg_sz_b1_buf,                       // SZ   (2b)
516
        lsu_tte_pg_sz_b0_buf,
517
        tlb_rd_tte_data_buf[10],        // NFO  (1b)
518
        tlb_rd_tte_data_buf[9],         // IE   (1b)
519
        9'd0,                                       // Soft2
520
        1'b0,
521
        lsu_tte_pg_sz_b2_buf,                       // SZ   (1b)
522
        tlb_rd_tte_tag_buf[24],            // U    (1b)
523
        // ECO 4265 - begin
524
        tlb_rd_tte_data_buf[42],      // Parity   (1b)
525
        tlb_rd_tte_data_buf[23],   // mxsel2_l (1b)
526
        tlb_rd_tte_data_buf[16],   // mxsel1_l (1b)
527
        tlb_rd_tte_data_buf[12],   // mxsel0_l (1b)
528
        2'd0,                                        // Unused Diag bits
529
        // ECO 4265 - end 
530
        1'b0,                                        // PA   (28b)
531
        tlb_rd_tte_data_buf[41:30],
532
        tlb_rd_tte_data_buf[29:24],
533
        tlb_rd_tte_data_buf[22:17],
534
        tlb_rd_tte_data_buf[15:13],
535
        6'd0,                                   // ?? 12-7 (6b)
536
        tlb_rd_tte_data_buf[8],          // L    (1b)
537
        tlb_rd_tte_data_buf[7],         // CP   (1b)
538
        tlb_rd_tte_data_buf[6],         // CV   (1b)
539
        tlb_rd_tte_data_buf[5],          // E    (1b)
540
        tlb_rd_tte_data_buf[4],          // P    (1b)
541
        tlb_rd_tte_data_buf[3],          // W    (1b)
542
        1'b0
543
        } ;
544
 
545
 
546
//=================================================================================================
547
//      Select TLB Read data / TLB Read tag
548
//=================================================================================================
549
 
550
assign lsu_tlb_rd_data[63:0] =
551
                lsu_tlb_data_rd_vld_g ? formatted_tte_data[63:0] : formatted_tte_tag[63:0];
552
 
553
 
554
//=================================================================================================
555
//      Calculate parity for TLB Tag and Data
556
//=================================================================================================
557
   wire lsu_rd_tte_data_parity, lsu_rd_tte_tag_parity;
558
 
559
assign  lsu_rd_tte_data_parity = ^tlb_rd_tte_data_buf[41:0] ;
560
assign  lsu_rd_tte_tag_parity =  ^{tlb_rd_tte_tag_buf[58:55],tlb_rd_tte_tag_buf[53:27],
561
                                tlb_rd_tte_tag_buf[25],tlb_rd_tte_tag_buf[23:0]} ;
562
 
563
assign  tte_data_parity_error =
564
  tlb_rd_tte_data_parity ^ lsu_rd_tte_data_parity ;
565
assign  tte_tag_parity_error  =
566
  tlb_rd_tte_tag_parity ^ lsu_rd_tte_tag_parity ;
567
 
568
   assign cache_way_hit_buf1[3:0] = cache_way_hit[3:0] ;
569
   assign cache_way_hit_buf2[3:0] = cache_way_hit[3:0];
570
 
571
 
572
endmodule

powered by: WebSVN 2.1.0

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