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

Subversion Repositories or1k

[/] [or1k/] [tags/] [rel_1/] [or1200/] [rtl/] [verilog/] [or1200_dmmu_tlb.v] - Blame information for rev 617

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 617 lampret
// Revision 1.1  2002/01/03 08:16:15  lampret
48
// New prefixes for RTL files, prefixed module names. Updated cache controllers and MMUs.
49
//
50 504 lampret
// Revision 1.8  2001/10/21 17:57:16  lampret
51
// 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.
52
//
53
// Revision 1.7  2001/10/14 13:12:09  lampret
54
// MP3 version.
55
//
56
// Revision 1.1.1.1  2001/10/06 10:18:36  igorm
57
// no message
58
//
59
//
60
 
61
// synopsys translate_off
62
`include "timescale.v"
63
// synopsys translate_on
64
`include "or1200_defines.v"
65
 
66
//
67
// Data TLB
68
//
69
 
70
module or1200_dmmu_tlb(
71
        // Rst and clk
72
        clk, rst,
73
 
74
        // I/F for translation
75 617 lampret
        tlb_en, vaddr, hit, ppn, uwe, ure, swe, sre, ci,
76 504 lampret
 
77
        // SPR access
78
        spr_cs, spr_write, spr_addr, spr_dat_i, spr_dat_o
79
);
80
 
81
parameter dw = `OR1200_OPERAND_WIDTH;
82
parameter aw = `OR1200_OPERAND_WIDTH;
83
 
84
//
85
// I/O
86
//
87
 
88
//
89
// Clock and reset
90
//
91
input                           clk;
92
input                           rst;
93
 
94
//
95
// I/F for translation
96
//
97
input                           tlb_en;
98
input   [aw-1:0]         vaddr;
99
output                          hit;
100
output  [31:`OR1200_DMMU_PS]    ppn;
101
output                          uwe;
102
output                          ure;
103
output                          swe;
104
output                          sre;
105
output                          ci;
106
 
107
//
108
// SPR access
109
//
110
input                           spr_cs;
111
input                           spr_write;
112
input   [31:0]                   spr_addr;
113
input   [31:0]                   spr_dat_i;
114
output  [31:0]                   spr_dat_o;
115
 
116
//
117
// Internal wires and regs
118
//
119
wire    [`OR1200_DTLB_TAG]      vpn;
120
wire                            v;
121
wire    [`OR1200_DTLB_INDXW-1:0] tlb_index;
122
wire                            tlb_mr_en;
123
wire                            tlb_mr_we;
124
wire    [`OR1200_DTLBMRW-1:0]    tlb_mr_ram_in;
125
wire    [`OR1200_DTLBMRW-1:0]    tlb_mr_ram_out;
126
wire                            tlb_tr_en;
127
wire                            tlb_tr_we;
128
wire    [`OR1200_DTLBTRW-1:0]    tlb_tr_ram_in;
129
wire    [`OR1200_DTLBTRW-1:0]    tlb_tr_ram_out;
130
 
131
//
132
// Implemented bits inside match and translate registers
133
//
134
// dtlbwYmrX: vpn 31-19  v 0
135
// dtlbwYtrX: ppn 31-13  swe 9  sre 8  uwe 7  ure 6
136
//
137
// dtlb memory width:
138
// 19 bits for ppn
139
// 13 bits for vpn
140
// 1 bit for valid
141
// 4 bits for protection
142
// 1 bit for cache inhibit
143
 
144
//
145
// Enable for Match registers
146
//
147
assign tlb_mr_en = tlb_en | (spr_cs & !spr_addr[`OR1200_DTLB_TM_ADDR]);
148
 
149
//
150
// Write enable for Match registers
151
//
152
assign tlb_mr_we = spr_cs & spr_write & !spr_addr[`OR1200_DTLB_TM_ADDR];
153
 
154
//
155
// Enable for Translate registers
156
//
157
assign tlb_tr_en = tlb_en | (spr_cs & spr_addr[`OR1200_DTLB_TM_ADDR]);
158
 
159
//
160
// Write enable for Translate registers
161
//
162
assign tlb_tr_we = spr_cs & spr_write & spr_addr[`OR1200_DTLB_TM_ADDR];
163
 
164
//
165
// Output to SPRS unit
166
//
167
assign spr_dat_o = (spr_cs & !spr_write & !spr_addr[`OR1200_DTLB_TM_ADDR]) ?
168 617 lampret
                        {vpn, tlb_index, {`OR1200_DTLB_TAGW-1{1'b0}}, v} :
169 504 lampret
                (spr_cs & !spr_write & spr_addr[`OR1200_DTLB_TM_ADDR]) ?
170 617 lampret
                        {ppn, {`OR1200_DMMU_PS-10{1'b0}}, swe, sre, uwe, ure, {4{1'b0}}, ci, 1'b0} :
171 504 lampret
                        32'h00000000;
172
 
173
//
174
// Assign outputs from Match registers
175
//
176
assign {vpn, v} = tlb_mr_ram_out;
177
 
178
//
179
// Assign to Match registers inputs
180
//
181
assign tlb_mr_ram_in = {spr_dat_i[`OR1200_DTLB_TAG], spr_dat_i[`OR1200_DTLBMR_V_BITS]};
182
 
183
//
184
// Assign outputs from Translate registers
185
//
186
assign {ppn, swe, sre, uwe, ure, ci} = tlb_tr_ram_out;
187
 
188
//
189
// Assign to Translate registers inputs
190
//
191
assign tlb_tr_ram_in = {spr_dat_i[31:`OR1200_DMMU_PS],
192
                        spr_dat_i[`OR1200_DTLBTR_SWE_BITS],
193
                        spr_dat_i[`OR1200_DTLBTR_SRE_BITS],
194
                        spr_dat_i[`OR1200_DTLBTR_UWE_BITS],
195
                        spr_dat_i[`OR1200_DTLBTR_URE_BITS],
196
                        spr_dat_i[`OR1200_DTLBTR_CI_BITS]};
197
 
198
//
199
// Generate hit
200
//
201
assign hit = (vpn == vaddr[`OR1200_DTLB_TAG]) & v;
202
 
203
//
204
// TLB index is normally vaddr[18:13]. If it is SPR access then index is
205
// spr_addr[5:0].
206
//
207
assign tlb_index = spr_cs ? spr_addr[`OR1200_DTLB_INDXW-1:0] : vaddr[`OR1200_DTLB_INDX];
208
 
209
//
210
// Instantiation of DTLB Match Registers
211
//
212
or1200_spram_64x14 dtlb_mr_ram(
213
        .clk(clk),
214
        .rst(rst),
215
        .ce(tlb_mr_en),
216
        .we(tlb_mr_we),
217
        .oe(1'b1),
218
        .addr(tlb_index),
219
        .di(tlb_mr_ram_in),
220
        .do(tlb_mr_ram_out)
221
);
222
 
223
//
224
// Instantiation of DTLB Translate Registers
225
//
226
or1200_spram_64x24 dtlb_tr_ram(
227
        .clk(clk),
228
        .rst(rst),
229
        .ce(tlb_tr_en),
230
        .we(tlb_tr_we),
231
        .oe(1'b1),
232
        .addr(tlb_index),
233
        .di(tlb_tr_ram_in),
234
        .do(tlb_tr_ram_out)
235
);
236
 
237
endmodule

powered by: WebSVN 2.1.0

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