1 /* 16 cache entries, 64-byte long cache lines */
6 /* ARM core interface */
10 output reg [31:0] rd_data,
15 output reg [31:0] bus_addr,
23 /* [31 tag 10] [9 cache index 6] [5 data index 0]
24 * so the data index is 6 bits long
25 * so the cache index is 4 bits long
26 * so the tag is 22 bits long. c.c
29 reg cache_valid [15:0];
30 reg [21:0] cache_tags [15:0];
31 reg [31:0] cache_data [15:0] [7:0];
34 for (i = 0; i < 16; i = i + 1)
37 wire [5:0] rd_didx = rd_addr[5:0];
38 wire [3:0] rd_didx_word = rd_didx[5:2];
39 wire [3:0] rd_idx = rd_addr[9:6];
40 wire [21:0] rd_tag = rd_addr[31:10];
42 wire cache_hit = cache_valid[rd_idx] && (cache_tags[rd_idx] == rd_tag);
44 always @(*) begin /* XXX does this work nowadays? */
46 rd_data = cache_data[rd_idx][rd_didx_word];
49 reg [3:0] cache_fill_pos = 0;
50 reg cache_filling = 0;
55 bus_addr = {rd_addr[31:6], cache_fill_pos[3:0], 2'b00 /* reads are 32-bits */};