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

Subversion Repositories thor

[/] [thor/] [trunk/] [rtl/] [verilog/] [Thor_dtagmem.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_dtagmem(wclk, wce, wr, wa, err_i, invalidate, invalidate_line, invalidate_lineno,
28
    rclk, rce, ra, whit, rhit, 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] ra;
41
output whit;
42
output rhit;
43
output err_o;
44
 
45
reg [AMSB:13] mem [0:255];
46
reg [0:255] tvalid;
47
reg [0:255] errmem;
48
reg [AMSB:0] rwa,rra;
49
wire [AMSB-12:0] tag,wtag;
50
 
51
integer n;
52
initial begin
53
        for (n = 0; n < 256; n = n + 1)
54
                mem[n] <= 0;
55
end
56
 
57
always @(posedge wclk)
58
        if (wce & wr) begin
59
                $display("*******************");
60
                $display("*******************");
61
                $display("Writint %h to %h ",wa[AMSB:13],wa[12:5]);
62
                mem[wa[12:5]] <= wa[AMSB:13];
63
                $display("*******************");
64
                $display("*******************");
65
        end
66
always @(posedge wclk)
67
        if (invalidate) begin tvalid <= 256'd0; errmem <= 256'd0; end
68
        else if (invalidate_line) tvalid[invalidate_lineno[12:5]] <= 1'b0;
69
        else if (wce & wr) begin tvalid[wa[12:5]] <= 1'b1; errmem[wa[12:5]] <= err_i; end
70
always @(posedge rclk)
71
        if (rce) rwa <= wa;
72
always @(posedge rclk)
73
        if (rce) rra <= ra;
74
assign wtag = {mem[rwa[12:5]],tvalid[rwa[12:5]]};
75
assign tag = {mem[rra[12:5]],tvalid[rra[12:5]]};
76
 
77
assign whit = wtag == {rwa[AMSB:13],1'b1};
78
assign rhit = tag == {rra[AMSB:13],1'b1};
79
assign err_o = errmem[rra[12:5]];
80
 
81
endmodule

powered by: WebSVN 2.1.0

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