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 113

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

powered by: WebSVN 2.1.0

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