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

Subversion Repositories or1k

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

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

Line No. Rev Author Line
1 215 lampret
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  OR1200's Insn 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 ITLB.                                      ////
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
//
51
 
52
// synopsys translate_off
53
`include "timescale.v"
54
// synopsys translate_on
55
`include "defines.v"
56
 
57
//
58
// Insn TLB
59
//
60
 
61
module itlb(
62
        // Rst and clk
63
        clk, rst,
64
 
65
        // I/F for translation
66
        tlb_en, vaddr, hit, ppn, uxe, sxe,
67
 
68
        // SPR access
69
        spr_cs, spr_write, spr_addr, spr_dat_i, spr_dat_o
70
);
71
 
72
parameter dw = `OPERAND_WIDTH;
73
parameter aw = `OPERAND_WIDTH;
74
 
75
//
76
// I/O
77
//
78
 
79
//
80
// Clock and reset
81
//
82
input                           clk;
83
input                           rst;
84
 
85
//
86
// I/F for translation
87
//
88
input                           tlb_en;
89
input   [aw-1:0]         vaddr;
90
output                          hit;
91
output  [31:13]                 ppn;
92
output                          uxe;
93
output                          sxe;
94
 
95
//
96
// SPR access
97
//
98
input                           spr_cs;
99
input                           spr_write;
100
input   [31:0]                   spr_addr;
101
input   [31:0]                   spr_dat_i;
102
output  [31:0]                   spr_dat_o;
103
 
104
//
105
// Internal wires and regs
106
//
107
wire    [31:19]                 vpn;
108
wire                            v;
109
wire    [5:0]                    tlb_index;
110
wire                            tlb_mr_en;
111
wire                            tlb_mr_we;
112
wire    [13:0]                   tlb_mr_ram_in;
113
wire    [13:0]                   tlb_mr_ram_out;
114
wire                            tlb_tr_en;
115
wire                            tlb_tr_we;
116
wire    [20:0]                   tlb_tr_ram_in;
117
wire    [20:0]                   tlb_tr_ram_out;
118
 
119
//
120
// Implemented bits inside match and translate registers
121
//
122
// itlbwYmrX: vpn 31-19  v 0
123
// itlbwYtrX: ppn 31-13  uxe 7  sxe 6
124
//
125
// itlb memory width:
126
// 19 bits for ppn
127
// 13 bits for vpn
128
// 1 bit for valid
129
// 2 bits for protection
130
 
131
//
132
// Enable for Match registers
133
//
134
assign tlb_mr_en = tlb_en | (spr_cs & !spr_addr[9]);
135
 
136
//
137
// Write enable for Match registers
138
//
139
assign tlb_mr_we = spr_cs & spr_write & !spr_addr[9];
140
 
141
//
142
// Enable for Translate registers
143
//
144
assign tlb_tr_en = tlb_en | (spr_cs & spr_addr[9]);
145
 
146
//
147
// Write enable for Translate registers
148
//
149
assign tlb_tr_we = spr_cs & spr_write & spr_addr[9];
150
 
151
//
152
// Output to SPRS unit
153
//
154
assign spr_dat_o = (spr_cs & !spr_write & !spr_addr[9]) ?
155
                        {vpn, {18{1'b1}}, v} :
156
                (spr_cs & !spr_write & spr_addr[9]) ?
157
                        {ppn, 5'b00000, uxe, sxe, {6{1'b1}}} :
158
                        32'h00000000;
159
 
160
//
161
// Assign outputs from Match registers
162
//
163
assign {vpn, v} = tlb_mr_ram_out;
164
 
165
//
166
// Assign to Match registers inputs
167
//
168
assign tlb_mr_ram_in = {spr_dat_i[31:19], spr_dat_i[0]};
169
 
170
//
171
// Assign outputs from Translate registers
172
//
173
assign {ppn, uxe, sxe} = tlb_tr_ram_out;
174
 
175
//
176
// Assign to Translate registers inputs
177
//
178
assign tlb_tr_ram_in = {spr_dat_i[31:13], spr_dat_i[7:6]};
179
 
180
//
181
// Generate hit
182
//
183
assign hit = (vpn == vaddr[31:19]) & v;
184
 
185
//
186
// TLB index is normally vaddr[18:13]. If it is SPR access then index is
187
// spr_addr[5:0].
188
//
189
assign tlb_index = spr_cs ? spr_addr[5:0] : vaddr[18:13];
190
 
191
//
192
// Instantiation of ITLB Match Registers
193
//
194
generic_spram_64x14 itlb_mr_ram(
195
        .clk(clk),
196
        .rst(rst),
197
        .ce(tlb_mr_en),
198
        .we(tlb_mr_we),
199
        .oe(1'b1),
200
        .addr(tlb_index),
201
        .di(tlb_mr_ram_in),
202
        .do(tlb_mr_ram_out)
203
);
204
 
205
//
206
// Instantiation of ITLB Translate Registers
207
//
208
generic_spram_64x21 itlb_tr_ram(
209
        .clk(clk),
210
        .rst(rst),
211
        .ce(tlb_tr_en),
212
        .we(tlb_tr_we),
213
        .oe(1'b1),
214
        .addr(tlb_index),
215
        .di(tlb_tr_ram_in),
216
        .do(tlb_tr_ram_out)
217
);
218
 
219
endmodule

powered by: WebSVN 2.1.0

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