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

Subversion Repositories thor

[/] [thor/] [trunk/] [rtl/] [verilog/] [Thor_itagmem.v] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 robfinch
// ============================================================================
2
//        __
3
//   \\__/ o\    (C) 2013  Robert Finch, Stratford
4
//    \  __ /    All rights reserved.
5
//     \/_//     robfinch<remove>@finitron.ca
6
//       ||
7
//
8
// This source file is free software: you can redistribute it and/or modify 
9
// it under the terms of the GNU Lesser General Public License as published 
10
// by the Free Software Foundation, either version 3 of the License, or     
11
// (at your option) any later version.                                      
12
//                                                                          
13
// This source file is distributed in the hope that it will be useful,      
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of           
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            
16
// GNU General Public License for more details.                             
17
//                                                                          
18
// You should have received a copy of the GNU General Public License        
19
// along with this program.  If not, see <http://www.gnu.org/licenses/>.    
20
//
21
//
22
// Thor SuperScalar
23
// Instruction cache tag memory
24
//
25
// ============================================================================
26
//
27
module Thor_itagmem(wclk, wce, wr, wa, err_i, invalidate, invalidate_line, invalidate_lineno,
28
    rclk, rce, pc, hit0, hit1, err_o);
29
parameter AMSB=63;
30
input wclk;
31
input wce;
32
input wr;
33
input [AMSB:0] wa;
34
input err_i;
35
input invalidate;
36
input invalidate_line;
37
input [AMSB:0] invalidate_lineno;
38
input rclk;
39
input rce;
40
input [AMSB:0] pc;
41
output hit0;
42
output hit1;
43
output err_o;
44
 
45
reg [AMSB:15] mem [0:1023];
46
reg [0:1023] tvalid;
47
reg [0:1023] errmem;
48
reg [AMSB:0] rpc,rpcp16;
49
wire [AMSB-13:0] tag0,tag1;
50
 
51
integer n;
52
initial begin
53
        for (n = 0; n < 1024; n = n + 1)
54
                mem[n] <= 0;
55
end
56
 
57
always @(posedge wclk)
58
        if (wce & wr) mem[wa[14:5]] <= wa[AMSB:15];
59
always @(posedge wclk)
60
        if (invalidate) begin tvalid <= 1024'd0; errmem <= 1024'd0; end
61
        else if (invalidate_line) tvalid[invalidate_lineno[14:5]] <= 1'b0;
62
        else if (wce & wr) begin tvalid[wa[14:5]] <= 1'b1; errmem[wa[14:5]] <= err_i; end
63
always @(posedge rclk)
64
        if (rce) rpc <= pc;
65
always @(posedge rclk)
66
        if (rce) rpcp16 <= pc + 64'd16;
67
assign tag0 = {mem[rpc[14:5]],tvalid[rpc[14:5]]};
68
assign tag1 = {mem[rpcp16[14:5]],tvalid[rpcp16[14:5]]};
69
 
70
assign hit0 = tag0 == {rpc[AMSB:15],1'b1};
71
assign hit1 = tag1 == {rpcp16[AMSB:15],1'b1};
72
assign err_o = errmem[rpc[14:5]]|errmem[rpcp16[14:5]];
73
 
74
endmodule

powered by: WebSVN 2.1.0

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