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

Subversion Repositories or1k

[/] [or1k/] [tags/] [first/] [mp3/] [rtl/] [verilog/] [or1200.xcv/] [dmmu.v] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 266 lampret
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  OR1200's Data MMU top level                                 ////
4
////                                                              ////
5
////  This file is part of the OpenRISC 1200 project              ////
6
////  http://www.opencores.org/cores/or1k/                        ////
7
////                                                              ////
8
////  Description                                                 ////
9
////  Instantiation of all DMMU blocks.                           ////
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
// Revision 1.1.1.1  2001/10/06 10:18:36  igorm
48
// no message
49
//
50
// Revision 1.1  2001/08/17 08:03:35  lampret
51
// *** empty log message ***
52
//
53
// Revision 1.2  2001/07/22 03:31:53  lampret
54
// Fixed RAM's oen bug. Cache bypass under development.
55
//
56
// Revision 1.1  2001/07/20 00:46:03  lampret
57
// Development version of RTL. Libraries are missing.
58
//
59
//
60
 
61
// synopsys translate_off
62
`include "timescale.v"
63
// synopsys translate_on
64
`include "defines.v"
65
 
66
//
67
// Data MMU
68
//
69
 
70
module dmmu(
71
        // Rst and clk
72
        clk, rst,
73
 
74
        // LSU i/f
75
        dmmu_en, supv, dmmulsu_vaddr, dmmulsu_lsuop, dmmulsu_stall,
76
 
77
        // Except I/F
78
        dmmuexcept_miss, dmmuexcept_fault,
79
 
80
        // SPR access
81
        spr_cs, spr_write, spr_addr, spr_dat_i, spr_dat_o,
82
 
83
        // DC i/f
84
        dcdmmu_paddr
85
);
86
 
87
parameter dw = `OPERAND_WIDTH;
88
parameter aw = `OPERAND_WIDTH;
89
 
90
//
91
// I/O
92
//
93
 
94
//
95
// Clock and reset
96
//
97
input                           clk;
98
input                           rst;
99
 
100
//
101
// LSU I/F
102
//
103
input                           dmmu_en;
104
input                           supv;
105
input   [aw-1:0]         dmmulsu_vaddr;
106
input   [`LSUOP_WIDTH-1:0]       dmmulsu_lsuop;
107
output                          dmmulsu_stall;
108
 
109
//
110
// Exception I/F
111
//
112
output                          dmmuexcept_miss;
113
output                          dmmuexcept_fault;
114
 
115
//
116
// SPR access
117
//
118
input                           spr_cs;
119
input                           spr_write;
120
input   [aw-1:0]         spr_addr;
121
input   [31:0]                   spr_dat_i;
122
output  [31:0]                   spr_dat_o;
123
 
124
//
125
// DC I/F
126
//
127
output  [aw-1:0]         dcdmmu_paddr;
128
 
129
//
130
// Internal wires and regs
131
//
132
wire                            dtlb_spr_access;
133
wire    [31:13]                 dtlb_ppn;
134
wire                            dtlb_hit;
135
wire                            dtlb_uwe;
136
wire                            dtlb_ure;
137
wire                            dtlb_swe;
138
wire                            dtlb_sre;
139
wire    [31:0]                   dtlb_dat_o;
140
 
141
//
142
// Implemented bits inside match and translate registers
143
//
144
// dtlbwYmrX: vpn 31-10  v 0
145
// dtlbwYtrX: ppn 31-10  uwe 9  ure 8  swe 7  sre 6
146
//
147
// dtlb memory width:
148
// 19 bits for ppn
149
// 13 bits for vpn
150
// 1 bit for valid
151
// 4 bits for protection
152
 
153
`ifdef OR1200_NO_DMMU
154
 
155
//
156
// Put all outputs in inactive state
157
//
158
assign dmmulsu_stall = 1'b0;
159
assign dmmuexcept_miss = 1'b0;
160
assign dmmuexcept_fault = 1'b0;
161
assign spr_dat_o = 32'h00000000;
162
assign dcdmmu_paddr = dmmulsu_vaddr;
163
 
164
`else
165
 
166
//
167
// DTLB SPR access
168
//
169
// 0C00 - 0E00  dtlbmr w0-3
170
// 0C00 - 0C80  dtlbmr w0
171
// 0C00 - 0C40  dtlbmr w0 [63:0]
172
//
173
// 0E00 - 1000  dtlbtr w0-3
174
// 0E00 - 0E80  dtlbtr w0
175
// 0E00 - 0E40  dtlbtr w0 [63:0]
176
//
177
assign dtlb_spr_access = spr_cs & spr_addr[10];
178
 
179
//
180
// Physical address is either translated virtual address or
181
// simply equal when DMMU is disabled
182
//
183
assign dcdmmu_paddr = dmmu_en ? {dtlb_ppn, dmmulsu_vaddr[12:0]} : dmmulsu_vaddr;
184
 
185
//
186
// Output to SPRS unit
187
//
188
assign spr_dat_o = dtlb_spr_access ? dtlb_dat_o : 32'h00000000;
189
 
190
//
191
// DMMU stall
192
//
193
assign dmmulsu_stall = 1'b0;
194
 
195
//
196
// Page fault exception logic
197
//
198
assign dmmuexcept_fault = (|dmmulsu_lsuop) && dmmu_en &&
199
                        (  (!dmmulsu_lsuop[3] & !supv & !dtlb_ure) // Load in user mode not enabled
200
                        || (!dmmulsu_lsuop[3] & supv & !dtlb_sre) // Load in supv mode not enabled
201
                        || (dmmulsu_lsuop[3] & !supv & !dtlb_uwe) // Store in user mode not enabled
202
                        || (dmmulsu_lsuop[3] & supv & !dtlb_swe) ); // Store in supv mode not enabled
203
 
204
//
205
// TLB Miss exception logic
206
//
207
assign dmmuexcept_miss = (|dmmulsu_lsuop) && dmmu_en && !dtlb_hit;
208
 
209
//
210
// Instantiation of DTLB
211
//
212
dtlb dtlb(
213
        // Rst and clk
214
        .clk(clk),
215
        .rst(rst),
216
 
217
        // I/F for translation
218
        .tlb_en(dmmu_en),
219
        .vaddr(dmmulsu_vaddr),
220
        .hit(dtlb_hit),
221
        .ppn(dtlb_ppn),
222
        .uwe(dtlb_uwe),
223
        .ure(dtlb_ure),
224
        .swe(dtlb_swe),
225
        .sre(dtlb_sre),
226
 
227
        // SPR access
228
        .spr_cs(dtlb_spr_access),
229
        .spr_write(spr_write),
230
        .spr_addr(spr_addr),
231
        .spr_dat_i(spr_dat_i),
232
        .spr_dat_o(dtlb_dat_o)
233
);
234
 
235
`endif
236
 
237
endmodule

powered by: WebSVN 2.1.0

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