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

Subversion Repositories or1k

[/] [or1k/] [branches/] [mp3_stable/] [or1200/] [rtl/] [verilog/] [immu.v] - Blame information for rev 205

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

Line No. Rev Author Line
1 203 lampret
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  OR1200's Insn 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 IMMU 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  2001/08/17 08:03:35  lampret
48
// *** empty log message ***
49
//
50
// Revision 1.2  2001/07/22 03:31:53  lampret
51
// Fixed RAM's oen bug. Cache bypass under development.
52
//
53
// Revision 1.1  2001/07/20 00:46:03  lampret
54
// Development version of RTL. Libraries are missing.
55
//
56
//
57
 
58
// synopsys translate_off
59
`include "timescale.v"
60
// synopsys translate_on
61
`include "defines.v"
62
 
63
//
64
// Insn MMU
65
//
66
 
67
module immu(
68
        // Rst and clk
69
        clk, rst,
70
 
71
        // Fetch i/f
72
        immu_en, supv, immufetch_vaddr, immufetch_op, immufetch_stall,
73
 
74
        // Except I/F
75
        immuexcept_miss, immuexcept_fault,
76
 
77
        // SPR access
78
        spr_cs, spr_write, spr_addr, spr_dat_i, spr_dat_o,
79
 
80
        // IC i/f
81
        icimmu_paddr
82
);
83
 
84
parameter dw = `OPERAND_WIDTH;
85
parameter aw = `OPERAND_WIDTH;
86
 
87
//
88
// I/O
89
//
90
 
91
//
92
// Clock and reset
93
//
94
input                           clk;
95
input                           rst;
96
 
97
//
98
// FETCH I/F
99
//
100
input                           immu_en;
101
input                           supv;
102
input   [aw-1:0]         immufetch_vaddr;
103
input                           immufetch_op;
104
output                          immufetch_stall;
105
 
106
//
107
// Exception I/F
108
//
109
output                          immuexcept_miss;
110
output                          immuexcept_fault;
111
 
112
//
113
// SPR access
114
//
115
input                           spr_cs;
116
input                           spr_write;
117
input   [aw-1:0]         spr_addr;
118
input   [31:0]                   spr_dat_i;
119
output  [31:0]                   spr_dat_o;
120
 
121
//
122
// IC I/F
123
//
124
output  [aw-1:0]         icimmu_paddr;
125
 
126
//
127
// Internal wires and regs
128
//
129
wire                            itlb_spr_access;
130
wire    [31:13]                 itlb_ppn;
131
wire                            itlb_hit;
132
wire                            itlb_uxe;
133
wire                            itlb_sxe;
134
wire    [31:0]                   itlb_dat_o;
135
 
136
//
137
// Implemented bits inside match and translate registers
138
//
139
// itlbwYmrX: vpn 31-10  v 0
140
// itlbwYtrX: ppn 31-10  uxe 7  sxe 6
141
//
142
// itlb memory width:
143
// 19 bits for ppn
144
// 13 bits for vpn
145
// 1 bit for valid
146
// 2 bits for protection
147
 
148
`ifdef OR1200_NO_IMMU
149
 
150
//
151
// Put all outputs in inactive state
152
//
153
assign immufetch_stall = 1'b0;
154
assign immuexcept_miss = 1'b0;
155
assign immuexcept_miss = 1'b1;
156
output spr_dat_o = 32'h00000000;
157
output icimmu_paddr = immfetch_vaddr;
158
 
159
`else
160
 
161
//
162
// ITLB SPR access
163
//
164
// 1400 - 1600  itlbmr w0-3
165
// 1400 - 1480  itlbmr w0
166
// 1400 - 1440  itlbmr w0 [63:0]
167
//
168
// 1600 - 1800  itlbtr w0-3
169
// 1600 - 1680  itlbtr w0
170
// 1600 - 1640  itlbtr w0 [63:0]
171
//
172
assign itlb_spr_access = spr_cs & spr_addr[10];
173
 
174
//
175
// Physical address is either translated virtual address or
176
// simply equal when IMMU is disabled
177
//
178
assign icimmu_paddr = immu_en ? {itlb_ppn, immufetch_vaddr[12:0]} : immufetch_vaddr;
179
 
180
//
181
// Output to SPRS unit
182
//
183
assign spr_dat_o = itlb_spr_access ? itlb_dat_o : 32'h00000000;
184
 
185
//
186
// IMMU stall
187
//
188
assign immufetch_stall = 1'b0;
189
 
190
//
191
// Page fault exception logic
192
//
193
assign immuexcept_fault = immu_en &&
194
                        (  (immufetch_op & !supv & !itlb_uxe) // Fetch in user mode not enabled
195
                        || (immufetch_op & supv & !itlb_sxe) ); // Fetch in supv mode not enabled
196
 
197
//
198
// TLB Miss exception logic
199
//
200
assign immuexcept_miss = immufetch_op && immu_en && !itlb_hit;
201
 
202
//
203
// Instantiation of ITLB
204
//
205
itlb itlb(
206
        // Rst and clk
207
        .clk(clk),
208
        .rst(rst),
209
 
210
        // I/F for translation
211
        .tlb_en(immu_en),
212
        .vaddr(immufetch_vaddr),
213
        .hit(itlb_hit),
214
        .ppn(itlb_ppn),
215
        .uxe(itlb_uxe),
216
        .sxe(itlb_sxe),
217
 
218
        // SPR access
219
        .spr_cs(itlb_spr_access),
220
        .spr_write(spr_write),
221
        .spr_addr(spr_addr),
222
        .spr_dat_i(spr_dat_i),
223
        .spr_dat_o(itlb_dat_o)
224
);
225
 
226
`endif
227
 
228
endmodule

powered by: WebSVN 2.1.0

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