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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [or1200/] [rtl/] [verilog/] [or1200_dmmu_tlb.v] - Blame information for rev 1063

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

Line No. Rev Author Line
1 504 lampret
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  OR1200's Data TLB                                           ////
4
////                                                              ////
5
////  This file is part of the OpenRISC 1200 project              ////
6
////  http://www.opencores.org/cores/or1k/                        ////
7
////                                                              ////
8
////  Description                                                 ////
9
////  Instantiation of DTLB.                                      ////
10
////                                                              ////
11
////  To Do:                                                      ////
12
////   - make it smaller and faster                               ////
13
////                                                              ////
14
////  Author(s):                                                  ////
15
////      - Damjan Lampret, lampret@opencores.org                 ////
16
////                                                              ////
17
//////////////////////////////////////////////////////////////////////
18
////                                                              ////
19
//// Copyright (C) 2000 Authors and OPENCORES.ORG                 ////
20
////                                                              ////
21
//// This source file may be used and distributed without         ////
22
//// restriction provided that this copyright statement is not    ////
23
//// removed from the file and that any derivative work contains  ////
24
//// the original copyright notice and the associated disclaimer. ////
25
////                                                              ////
26
//// This source file is free software; you can redistribute it   ////
27
//// and/or modify it under the terms of the GNU Lesser General   ////
28
//// Public License as published by the Free Software Foundation; ////
29
//// either version 2.1 of the License, or (at your option) any   ////
30
//// later version.                                               ////
31
////                                                              ////
32
//// This source is distributed in the hope that it will be       ////
33
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
34
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
35
//// PURPOSE.  See the GNU Lesser General Public License for more ////
36
//// details.                                                     ////
37
////                                                              ////
38
//// You should have received a copy of the GNU Lesser General    ////
39
//// Public License along with this source; if not, download it   ////
40
//// from http://www.opencores.org/lgpl.shtml                     ////
41
////                                                              ////
42
//////////////////////////////////////////////////////////////////////
43
//
44
// CVS Revision History
45
//
46
// $Log: not supported by cvs2svn $
47 1063 lampret
// Revision 1.3  2002/02/11 04:33:17  lampret
48
// Speed optimizations (removed duplicate _cyc_ and _stb_). Fixed D/IMMU cache-inhibit attr.
49
//
50 660 lampret
// Revision 1.2  2002/01/28 01:16:00  lampret
51
// Changed 'void' nop-ops instead of insn[0] to use insn[16]. Debug unit stalls the tick timer. Prepared new flag generation for add and and insns. Blocked DC/IC while they are turned off. Fixed I/D MMU SPRs layout except WAYs. TODO: smart IC invalidate, l.j 2 and TLB ways.
52
//
53 617 lampret
// Revision 1.1  2002/01/03 08:16:15  lampret
54
// New prefixes for RTL files, prefixed module names. Updated cache controllers and MMUs.
55
//
56 504 lampret
// Revision 1.8  2001/10/21 17:57:16  lampret
57
// Removed params from generic_XX.v. Added translate_off/on in sprs.v and id.v. Removed spr_addr from dc.v and ic.v. Fixed CR+LF.
58
//
59
// Revision 1.7  2001/10/14 13:12:09  lampret
60
// MP3 version.
61
//
62
// Revision 1.1.1.1  2001/10/06 10:18:36  igorm
63
// no message
64
//
65
//
66
 
67
// synopsys translate_off
68
`include "timescale.v"
69
// synopsys translate_on
70
`include "or1200_defines.v"
71
 
72
//
73
// Data TLB
74
//
75
 
76
module or1200_dmmu_tlb(
77
        // Rst and clk
78
        clk, rst,
79
 
80
        // I/F for translation
81 617 lampret
        tlb_en, vaddr, hit, ppn, uwe, ure, swe, sre, ci,
82 504 lampret
 
83 1063 lampret
`ifdef OR1200_BIST
84
        // RAM BIST
85
        scanb_rst, scanb_si, scanb_so, scanb_en, scanb_clk,
86
`endif
87
 
88 504 lampret
        // SPR access
89
        spr_cs, spr_write, spr_addr, spr_dat_i, spr_dat_o
90
);
91
 
92
parameter dw = `OR1200_OPERAND_WIDTH;
93
parameter aw = `OR1200_OPERAND_WIDTH;
94
 
95
//
96
// I/O
97
//
98
 
99
//
100
// Clock and reset
101
//
102
input                           clk;
103
input                           rst;
104
 
105
//
106
// I/F for translation
107
//
108
input                           tlb_en;
109
input   [aw-1:0]         vaddr;
110
output                          hit;
111
output  [31:`OR1200_DMMU_PS]    ppn;
112
output                          uwe;
113
output                          ure;
114
output                          swe;
115
output                          sre;
116
output                          ci;
117
 
118 1063 lampret
`ifdef OR1200_BIST
119 504 lampret
//
120 1063 lampret
// RAM BIST
121
//
122
input                           scanb_rst,
123
                                scanb_si,
124
                                scanb_en,
125
                                scanb_clk;
126
output                          scanb_so;
127
`endif
128
 
129
//
130 504 lampret
// SPR access
131
//
132
input                           spr_cs;
133
input                           spr_write;
134
input   [31:0]                   spr_addr;
135
input   [31:0]                   spr_dat_i;
136
output  [31:0]                   spr_dat_o;
137
 
138
//
139
// Internal wires and regs
140
//
141
wire    [`OR1200_DTLB_TAG]      vpn;
142
wire                            v;
143
wire    [`OR1200_DTLB_INDXW-1:0] tlb_index;
144
wire                            tlb_mr_en;
145
wire                            tlb_mr_we;
146
wire    [`OR1200_DTLBMRW-1:0]    tlb_mr_ram_in;
147
wire    [`OR1200_DTLBMRW-1:0]    tlb_mr_ram_out;
148
wire                            tlb_tr_en;
149
wire                            tlb_tr_we;
150
wire    [`OR1200_DTLBTRW-1:0]    tlb_tr_ram_in;
151
wire    [`OR1200_DTLBTRW-1:0]    tlb_tr_ram_out;
152 1063 lampret
`ifdef OR1200_BIST
153
//
154
// RAM BIST
155
//
156
wire                            scanb_mr_so;
157
wire                            scanb_tr_so;
158
wire                            scanb_mr_si = scanb_si;
159
wire                            scanb_tr_si = scanb_mr_so;
160
assign                          scanb_so = scanb_tr_so;
161
`endif
162 504 lampret
 
163
//
164
// Implemented bits inside match and translate registers
165
//
166
// dtlbwYmrX: vpn 31-19  v 0
167
// dtlbwYtrX: ppn 31-13  swe 9  sre 8  uwe 7  ure 6
168
//
169
// dtlb memory width:
170
// 19 bits for ppn
171
// 13 bits for vpn
172
// 1 bit for valid
173
// 4 bits for protection
174
// 1 bit for cache inhibit
175
 
176
//
177
// Enable for Match registers
178
//
179
assign tlb_mr_en = tlb_en | (spr_cs & !spr_addr[`OR1200_DTLB_TM_ADDR]);
180
 
181
//
182
// Write enable for Match registers
183
//
184
assign tlb_mr_we = spr_cs & spr_write & !spr_addr[`OR1200_DTLB_TM_ADDR];
185
 
186
//
187
// Enable for Translate registers
188
//
189
assign tlb_tr_en = tlb_en | (spr_cs & spr_addr[`OR1200_DTLB_TM_ADDR]);
190
 
191
//
192
// Write enable for Translate registers
193
//
194
assign tlb_tr_we = spr_cs & spr_write & spr_addr[`OR1200_DTLB_TM_ADDR];
195
 
196
//
197
// Output to SPRS unit
198
//
199
assign spr_dat_o = (spr_cs & !spr_write & !spr_addr[`OR1200_DTLB_TM_ADDR]) ?
200 660 lampret
                        {vpn, tlb_index & {`OR1200_DTLB_INDXW{v}}, {`OR1200_DTLB_TAGW-7{1'b0}}, 1'b0, 5'b00000, v} :
201 504 lampret
                (spr_cs & !spr_write & spr_addr[`OR1200_DTLB_TM_ADDR]) ?
202 617 lampret
                        {ppn, {`OR1200_DMMU_PS-10{1'b0}}, swe, sre, uwe, ure, {4{1'b0}}, ci, 1'b0} :
203 504 lampret
                        32'h00000000;
204
 
205
//
206
// Assign outputs from Match registers
207
//
208
assign {vpn, v} = tlb_mr_ram_out;
209
 
210
//
211
// Assign to Match registers inputs
212
//
213
assign tlb_mr_ram_in = {spr_dat_i[`OR1200_DTLB_TAG], spr_dat_i[`OR1200_DTLBMR_V_BITS]};
214
 
215
//
216
// Assign outputs from Translate registers
217
//
218
assign {ppn, swe, sre, uwe, ure, ci} = tlb_tr_ram_out;
219
 
220
//
221
// Assign to Translate registers inputs
222
//
223
assign tlb_tr_ram_in = {spr_dat_i[31:`OR1200_DMMU_PS],
224
                        spr_dat_i[`OR1200_DTLBTR_SWE_BITS],
225
                        spr_dat_i[`OR1200_DTLBTR_SRE_BITS],
226
                        spr_dat_i[`OR1200_DTLBTR_UWE_BITS],
227
                        spr_dat_i[`OR1200_DTLBTR_URE_BITS],
228
                        spr_dat_i[`OR1200_DTLBTR_CI_BITS]};
229
 
230
//
231
// Generate hit
232
//
233
assign hit = (vpn == vaddr[`OR1200_DTLB_TAG]) & v;
234
 
235
//
236
// TLB index is normally vaddr[18:13]. If it is SPR access then index is
237
// spr_addr[5:0].
238
//
239
assign tlb_index = spr_cs ? spr_addr[`OR1200_DTLB_INDXW-1:0] : vaddr[`OR1200_DTLB_INDX];
240
 
241
//
242
// Instantiation of DTLB Match Registers
243
//
244
or1200_spram_64x14 dtlb_mr_ram(
245
        .clk(clk),
246
        .rst(rst),
247 1063 lampret
`ifdef OR1200_BIST
248
        // RAM BIST
249
        .scanb_rst(scanb_rst),
250
        .scanb_si(scanb_mr_si),
251
        .scanb_so(scanb_mr_so),
252
        .scanb_en(scanb_en),
253
        .scanb_clk(scanb_clk),
254
`endif
255 504 lampret
        .ce(tlb_mr_en),
256
        .we(tlb_mr_we),
257
        .oe(1'b1),
258
        .addr(tlb_index),
259
        .di(tlb_mr_ram_in),
260
        .do(tlb_mr_ram_out)
261
);
262
 
263
//
264
// Instantiation of DTLB Translate Registers
265
//
266
or1200_spram_64x24 dtlb_tr_ram(
267
        .clk(clk),
268
        .rst(rst),
269 1063 lampret
`ifdef OR1200_BIST
270
        // RAM BIST
271
        .scanb_rst(scanb_rst),
272
        .scanb_si(scanb_tr_si),
273
        .scanb_so(scanb_tr_so),
274
        .scanb_en(scanb_en),
275
        .scanb_clk(scanb_clk),
276
`endif
277 504 lampret
        .ce(tlb_tr_en),
278
        .we(tlb_tr_we),
279
        .oe(1'b1),
280
        .addr(tlb_index),
281
        .di(tlb_tr_ram_in),
282
        .do(tlb_tr_ram_out)
283
);
284
 
285
endmodule

powered by: WebSVN 2.1.0

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