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

Subversion Repositories sparc64soc

[/] [sparc64soc/] [trunk/] [T1-CPU/] [lsu/] [lsu_tlbdp.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: 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
`include        "lsu.h"
23
 
24
module lsu_tlbdp(/*AUTOARG*/
25
   // Outputs
26
   so, lsu_tlb_rd_data, tlb_pgnum_buf, tlb_pgnum_buf2,
27
   tlb_rd_tte_data_ie_buf, stb_cam_vld, tte_data_parity_error,
28
   tte_tag_parity_error, cache_way_hit_buf1, cache_way_hit_buf2,
29
   lsu_tlu_tte_pg_sz_g,
30
   // Inputs
31
   rclk, si, se, tlb_rd_tte_tag, tlb_rd_tte_data,
32
   lsu_tlb_data_rd_vld_g, tlb_pgnum, asi_internal_m, lsu_alt_space_m,
33
   tlb_cam_hit, ifu_lsu_ld_inst_e, lsu_dtlb_bypass_e,
34
   tlb_rd_tte_data_parity, tlb_rd_tte_tag_parity, cache_way_hit
35
   );
36
 
37
   input  rclk;
38
   input  si;
39
   input  se;
40
   output so;
41
 
42
input   [58:0]           tlb_rd_tte_tag ;         // tte tag from tlb
43
input   [42:0]          tlb_rd_tte_data ;        // tte data from tlb
44
input                   lsu_tlb_data_rd_vld_g ;  // select between tte tag/data rd.             
45
 
46
input [39:10]           tlb_pgnum;
47
input                   asi_internal_m;
48
   input                lsu_alt_space_m;
49
 
50
// **new**
51
output  [63:0]           lsu_tlb_rd_data ;       // tag or data rd from tlb
52
 
53
 
54
 
55
   output [39:10]        tlb_pgnum_buf;
56
   output [39:37]        tlb_pgnum_buf2;
57
//   output [42:0]         tlb_rd_tte_data_buf;
58
   output             tlb_rd_tte_data_ie_buf;
59
 
60
//======================================================
61
//stb cam vld mved from stb_rwctl    
62
input     tlb_cam_hit ;
63
input     ifu_lsu_ld_inst_e;
64
input     lsu_dtlb_bypass_e;
65
output    stb_cam_vld;
66
 
67
 
68
input    tlb_rd_tte_data_parity ; // data parity bit from tte data
69
input    tlb_rd_tte_tag_parity ;  // data parity bit from tte tag
70
output   tte_data_parity_error ;
71
output   tte_tag_parity_error ;
72
 
73
   input [3:0] cache_way_hit;
74
   output [3:0] cache_way_hit_buf1;
75
   output [3:0] cache_way_hit_buf2;
76
 
77
output  [2:0]           lsu_tlu_tte_pg_sz_g ;   // page-size of tte 
78
 
79
wire   tlb_rd_tte_data_27_22_sel_buf;
80
wire   tlb_rd_tte_data_21_16_sel_buf;
81
wire   tlb_rd_tte_data_15_13_sel_buf;
82
wire   lsu_tte_pg_sz_b2, lsu_tte_pg_sz_b1, lsu_tte_pg_sz_b0;
83
wire   pg_sz_b0, pg_sz_b1, pg_sz_b2;
84
 
85
//===============================================================
86
   wire   tlb_tte_data_mx_sel2, tlb_tte_data_mx_sel1, tlb_tte_data_mx_sel0;
87
//tlb_tte_data_mx_sel2 ;  // select for bits 21-19
88
//tlb_tte_data_mx_sel1 ;  // select for bits 18-16
89
//tlb_tte_data_mx_sel0 ;  // select for bits 15-13
90
 
91
   assign tlb_tte_data_mx_sel2 = tlb_rd_tte_data_27_22_sel_buf;
92
   assign tlb_tte_data_mx_sel1 = tlb_rd_tte_data_21_16_sel_buf;
93
   assign tlb_tte_data_mx_sel0 = tlb_rd_tte_data_15_13_sel_buf;
94
 
95
// assign  pg_sz_b0 = 
96
//  (~tlb_tte_data_mx_sel1 & tlb_tte_data_mx_sel0) | // 64K
97
//  ( tlb_tte_data_mx_sel1 & tlb_tte_data_mx_sel0) ; // 4M/256M
98
 
99
assign  pg_sz_b0 =  tlb_tte_data_mx_sel0;
100
 
101
assign  pg_sz_b1 =
102
  (~tlb_tte_data_mx_sel2 & tlb_tte_data_mx_sel1 &  tlb_tte_data_mx_sel0) ; // 4M
103
assign  pg_sz_b2 =
104
  ( tlb_tte_data_mx_sel2 & tlb_tte_data_mx_sel1 &  tlb_tte_data_mx_sel0) ; // 256M
105
 
106
assign  lsu_tte_pg_sz_b2 = pg_sz_b2 ;
107
assign  lsu_tte_pg_sz_b1 = pg_sz_b1 ;
108
assign  lsu_tte_pg_sz_b0 = pg_sz_b0 ;
109
 
110
assign lsu_tlu_tte_pg_sz_g[2:0] = {pg_sz_b2,pg_sz_b1,pg_sz_b0} ;
111
 
112
// CAM VLD GENERATION
113
 
114
// Unfortunately because of timing considerations, this cannot be qualified with
115
// flush and inst_vld. Must exclude other conditions though such as internal asi
116
// atomics etc !!! (NOTE : earlier version of inst_vld may be obtained.   
117
   wire   clk;
118
 
119
   assign   clk =rclk;
120
 
121
wire  dtlb_bypass_m ;
122
dff_s #(1) dtlb_bypass_stgm  (
123
  .din    (lsu_dtlb_bypass_e), .q (dtlb_bypass_m),
124
  .clk    (clk),
125
  .se     (se), .si (), .so ()
126
  );
127
 
128
dff_s #(1) ld_inst_vld_stgm  (
129
  .din    (ifu_lsu_ld_inst_e), .q (ld_inst_vld_m),
130
  .clk    (clk),
131
  .se     (se), .si (), .so ()
132
  );
133
 
134
assign  stb_cam_vld = ld_inst_vld_m & (tlb_cam_hit | dtlb_bypass_m) &
135
                      ~(asi_internal_m  & lsu_alt_space_m); //bug 4635, revisit
136
//======================================================================   
137
 
138
//buffer all inputs first
139
wire   [58:0]         tlb_rd_tte_tag_buf ;
140
wire   [42:0]         tlb_rd_tte_data_buf ;
141
wire                                lsu_tte_pg_sz_b1_buf;
142
wire                                lsu_tte_pg_sz_b0_buf;
143
wire                                lsu_tte_pg_sz_b2_buf;
144
wire   [39:10]        tlb_pgnum_l;
145
wire   [39:10]        tlb_pgnum_buf;
146
wire   [39:37]        tlb_pgnum_buf2;
147
 
148
//BUFFERS
149
   assign             tlb_rd_tte_tag_buf[58:0] = tlb_rd_tte_tag[58:0];
150
   assign             lsu_tte_pg_sz_b1_buf = lsu_tte_pg_sz_b1;
151
   assign             lsu_tte_pg_sz_b0_buf = lsu_tte_pg_sz_b0;
152
   assign             lsu_tte_pg_sz_b2_buf = lsu_tte_pg_sz_b2;
153
 
154
   //tlb_pgnum buffer
155
   assign             tlb_pgnum_l [39:10] = ~ tlb_pgnum[39:10];
156
   assign             tlb_pgnum_buf[39:10] = ~ tlb_pgnum_l[39:10];
157
   assign             tlb_pgnum_buf2[39:37] = ~ tlb_pgnum_l[39:37];
158
 
159
   assign             tlb_rd_tte_data_buf[42:0] = tlb_rd_tte_data[42:0];
160
 
161
   assign tlb_rd_tte_data_ie_buf =  tlb_rd_tte_data_buf [`STLB_DATA_IE];
162
   assign tlb_rd_tte_data_27_22_sel_buf = tlb_rd_tte_data_buf [`STLB_DATA_27_22_SEL];
163
   assign tlb_rd_tte_data_21_16_sel_buf = tlb_rd_tte_data_buf [`STLB_DATA_21_16_SEL];
164
   assign tlb_rd_tte_data_15_13_sel_buf = tlb_rd_tte_data_buf [`STLB_DATA_15_13_SEL];
165
 
166
 
167
wire    [63:0]   formatted_tte_tag, formatted_tte_data;
168
 
169
//=================================================================================================
170
//      Format TLB Tag 
171
//=================================================================================================
172
 
173
assign  formatted_tte_tag[63:0] =
174
        {
175
        tlb_rd_tte_tag_buf[58:56],
176
        tlb_rd_tte_tag_buf[55],
177
        // ECO 4265 begin
178
        tlb_rd_tte_tag_buf[`STLB_TAG_PARITY],     // Parity
179
        tlb_rd_tte_tag_buf[`STLB_TAG_VA_27_22_V], // mxsel2 - b27:22 vld 
180
        tlb_rd_tte_tag_buf[`STLB_TAG_VA_21_16_V], // mxsel1 - b21:16 vld
181
        tlb_rd_tte_tag_buf[`STLB_TAG_VA_15_13_V], // mxsel0 - b15:13 vld
182
        {8{tlb_rd_tte_tag_buf[53]}},                                        // (8b)
183
        // ECO 4265 end
184
        tlb_rd_tte_tag_buf[`STLB_TAG_VA_47_28_HI:`STLB_TAG_VA_47_28_LO],    // (20b)
185
        tlb_rd_tte_tag_buf[`STLB_TAG_VA_27_22_HI:`STLB_TAG_VA_27_22_LO],    // (6b)
186
        tlb_rd_tte_tag_buf[`STLB_TAG_VA_21_16_HI:`STLB_TAG_VA_21_16_LO],    // (6b)
187
        tlb_rd_tte_tag_buf[`STLB_TAG_VA_15_13_HI:`STLB_TAG_VA_15_13_LO],    // (3b)
188
        tlb_rd_tte_tag_buf[`STLB_TAG_CTXT_12_0_HI:`STLB_TAG_CTXT_12_0_LO] // (13b)
189
        } ;
190
/*
191
assign  formatted_tte_tag[63:0] =
192
        {
193
        {16{tlb_rd_tte_tag_buf[54]}},                                       // (16b)
194
        tlb_rd_tte_tag_buf[`STLB_TAG_VA_47_22_HI:`STLB_TAG_VA_47_22_LO],    // (26b)
195
        tlb_rd_tte_tag_buf[`STLB_TAG_VA_21_20_HI:`STLB_TAG_VA_21_20_LO],    // (3b)
196
        tlb_rd_tte_tag_buf[`STLB_TAG_VA_19],
197
        tlb_rd_tte_tag_buf[`STLB_TAG_VA_18_17_HI:`STLB_TAG_VA_18_17_LO],    // (3b)
198
        tlb_rd_tte_tag_buf[`STLB_TAG_VA_16],
199
        tlb_rd_tte_tag_buf[`STLB_TAG_VA_15_14_HI:`STLB_TAG_VA_15_14_LO],    // (3b)
200
        tlb_rd_tte_tag_buf[`STLB_TAG_VA_13],
201
        tlb_rd_tte_tag_buf[`STLB_TAG_CTXT_12_7_HI:`STLB_TAG_CTXT_12_7_LO],  // (13b)
202
        tlb_rd_tte_tag_buf[`STLB_TAG_CTXT_6_0_HI:`STLB_TAG_CTXT_6_0_LO]
203
        } ;
204
*/
205
 
206
 
207
//=================================================================================================
208
//      Format TLB Data 
209
//=================================================================================================
210
 
211
assign  formatted_tte_data[63:0] =
212
        {
213
        tlb_rd_tte_tag_buf[`STLB_TAG_V],            // V    (1b)
214
        lsu_tte_pg_sz_b1_buf,                       // SZ   (2b)
215
        lsu_tte_pg_sz_b0_buf,
216
        tlb_rd_tte_data_buf[`STLB_DATA_NFO],        // NFO  (1b)
217
        tlb_rd_tte_data_buf[`STLB_DATA_IE],         // IE   (1b)
218
        9'd0,                                       // Soft2
219
        1'b0,
220
        lsu_tte_pg_sz_b2_buf,                       // SZ   (1b)
221
        tlb_rd_tte_tag_buf[`STLB_TAG_U],            // U    (1b)
222
        // ECO 4265 - begin
223
        tlb_rd_tte_data_buf[`STLB_DATA_PARITY],      // Parity   (1b)
224
        tlb_rd_tte_data_buf[`STLB_DATA_27_22_SEL],   // mxsel2_l (1b)
225
        tlb_rd_tte_data_buf[`STLB_DATA_21_16_SEL],   // mxsel1_l (1b)
226
        tlb_rd_tte_data_buf[`STLB_DATA_15_13_SEL],   // mxsel0_l (1b)
227
        2'd0,                                        // Unused Diag bits
228
        // ECO 4265 - end 
229
        1'b0,                                        // PA   (28b)
230
        tlb_rd_tte_data_buf[`STLB_DATA_PA_39_28_HI:`STLB_DATA_PA_39_28_LO],
231
        tlb_rd_tte_data_buf[`STLB_DATA_PA_27_22_HI:`STLB_DATA_PA_27_22_LO],
232
        tlb_rd_tte_data_buf[`STLB_DATA_PA_21_16_HI:`STLB_DATA_PA_21_16_LO],
233
        tlb_rd_tte_data_buf[`STLB_DATA_PA_15_13_HI:`STLB_DATA_PA_15_13_LO],
234
        6'd0,                                   // ?? 12-7 (6b)
235
        tlb_rd_tte_data_buf[`STLB_DATA_L],          // L    (1b)
236
        tlb_rd_tte_data_buf[`STLB_DATA_CP],         // CP   (1b)
237
        tlb_rd_tte_data_buf[`STLB_DATA_CV],         // CV   (1b)
238
        tlb_rd_tte_data_buf[`STLB_DATA_E],          // E    (1b)
239
        tlb_rd_tte_data_buf[`STLB_DATA_P],          // P    (1b)
240
        tlb_rd_tte_data_buf[`STLB_DATA_W],          // W    (1b)
241
        1'b0
242
        } ;
243
 
244
 
245
//=================================================================================================
246
//      Select TLB Read data / TLB Read tag
247
//=================================================================================================
248
 
249
assign lsu_tlb_rd_data[63:0] =
250
                lsu_tlb_data_rd_vld_g ? formatted_tte_data[63:0] : formatted_tte_tag[63:0];
251
 
252
 
253
//=================================================================================================
254
//      Calculate parity for TLB Tag and Data
255
//=================================================================================================
256
   wire lsu_rd_tte_data_parity, lsu_rd_tte_tag_parity;
257
 
258
assign  lsu_rd_tte_data_parity = ^tlb_rd_tte_data_buf[41:0] ;
259
assign  lsu_rd_tte_tag_parity =  ^{tlb_rd_tte_tag_buf[58:55],tlb_rd_tte_tag_buf[53:27],
260
                                tlb_rd_tte_tag_buf[25],tlb_rd_tte_tag_buf[23:0]} ;
261
 
262
assign  tte_data_parity_error =
263
  tlb_rd_tte_data_parity ^ lsu_rd_tte_data_parity ;
264
assign  tte_tag_parity_error  =
265
  tlb_rd_tte_tag_parity ^ lsu_rd_tte_tag_parity ;
266
 
267
   assign cache_way_hit_buf1[3:0] = cache_way_hit[3:0] ;
268
   assign cache_way_hit_buf2[3:0] = cache_way_hit[3:0];
269
 
270
 
271
endmodule

powered by: WebSVN 2.1.0

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