Added prefix DCACHE_
This commit is contained in:
54
rtl/cache/VX_cache_data_per_index.v
vendored
54
rtl/cache/VX_cache_data_per_index.v
vendored
@@ -15,52 +15,52 @@ module VX_cache_data_per_index
|
||||
input wire rst,
|
||||
input wire valid_in,
|
||||
// Addr
|
||||
input wire[`CACHE_IND_SIZE_RNG] addr,
|
||||
input wire[`DCACHE_IND_SIZE_RNG] addr,
|
||||
// WE
|
||||
input wire[`NUM_WORDS_PER_BLOCK-1:0][3:0] we,
|
||||
input wire[`DCACHE_NUM_WORDS_PER_BLOCK-1:0][3:0] we,
|
||||
input wire evict,
|
||||
input wire[`CACHE_WAY_INDEX-1:0] way_to_update,
|
||||
input wire[`DCACHE_WAY_INDEX-1:0] way_to_update,
|
||||
// Data
|
||||
input wire[`NUM_WORDS_PER_BLOCK-1:0][31:0] data_write, // Update Data
|
||||
input wire[`CACHE_TAG_SIZE_RNG] tag_write,
|
||||
input wire[`DCACHE_NUM_WORDS_PER_BLOCK-1:0][31:0] data_write, // Update Data
|
||||
input wire[`DCACHE_TAG_SIZE_RNG] tag_write,
|
||||
|
||||
|
||||
output wire[`CACHE_TAG_SIZE_RNG] tag_use,
|
||||
output wire[`NUM_WORDS_PER_BLOCK-1:0][31:0] data_use,
|
||||
output wire[`DCACHE_TAG_SIZE_RNG] tag_use,
|
||||
output wire[`DCACHE_NUM_WORDS_PER_BLOCK-1:0][31:0] data_use,
|
||||
output wire valid_use,
|
||||
output wire dirty_use,
|
||||
output wire[`CACHE_WAY_INDEX-1:0] way
|
||||
output wire[`DCACHE_WAY_INDEX-1:0] way
|
||||
|
||||
);
|
||||
//localparam NUMBER_BANKS = CACHE_BANKS;
|
||||
//localparam CACHE_BLOCK_PER_BANK = (CACHE_BLOCK / CACHE_BANKS);
|
||||
// localparam NUM_WORDS_PER_BLOCK = CACHE_BLOCK / (CACHE_BANKS*4);
|
||||
//localparam NUMBER_INDEXES = `NUM_IND;
|
||||
//localparam NUMBER_INDEXES = `DCACHE_NUM_IND;
|
||||
|
||||
wire [`CACHE_WAYS-1:0][`CACHE_TAG_SIZE_RNG] tag_use_per_way;
|
||||
wire [`CACHE_WAYS-1:0][`NUM_WORDS_PER_BLOCK-1:0][31:0] data_use_per_way;
|
||||
wire [`CACHE_WAYS-1:0] valid_use_per_way;
|
||||
wire [`CACHE_WAYS-1:0] dirty_use_per_way;
|
||||
wire [`CACHE_WAYS-1:0] hit_per_way;
|
||||
reg [`NUM_IND-1:0][`CACHE_WAY_INDEX-1:0] eviction_way_index;
|
||||
wire [`CACHE_WAYS-1:0][`NUM_WORDS_PER_BLOCK-1:0][3:0] we_per_way;
|
||||
wire [`CACHE_WAYS-1:0][`NUM_WORDS_PER_BLOCK-1:0][31:0] data_write_per_way;
|
||||
wire [`CACHE_WAYS-1:0] write_from_mem_per_way;
|
||||
wire [`DCACHE_WAYS-1:0][`DCACHE_TAG_SIZE_RNG] tag_use_per_way;
|
||||
wire [`DCACHE_WAYS-1:0][`DCACHE_NUM_WORDS_PER_BLOCK-1:0][31:0] data_use_per_way;
|
||||
wire [`DCACHE_WAYS-1:0] valid_use_per_way;
|
||||
wire [`DCACHE_WAYS-1:0] dirty_use_per_way;
|
||||
wire [`DCACHE_WAYS-1:0] hit_per_way;
|
||||
reg [`DCACHE_NUM_IND-1:0][`DCACHE_WAY_INDEX-1:0] eviction_way_index;
|
||||
wire [`DCACHE_WAYS-1:0][`DCACHE_NUM_WORDS_PER_BLOCK-1:0][3:0] we_per_way;
|
||||
wire [`DCACHE_WAYS-1:0][`DCACHE_NUM_WORDS_PER_BLOCK-1:0][31:0] data_write_per_way;
|
||||
wire [`DCACHE_WAYS-1:0] write_from_mem_per_way;
|
||||
wire invalid_found;
|
||||
|
||||
wire [`CACHE_WAY_INDEX-1:0] way_index;
|
||||
wire [`CACHE_WAY_INDEX-1:0] invalid_index;
|
||||
wire [`DCACHE_WAY_INDEX-1:0] way_index;
|
||||
wire [`DCACHE_WAY_INDEX-1:0] invalid_index;
|
||||
|
||||
|
||||
if(`CACHE_WAYS != 1) begin
|
||||
VX_generic_priority_encoder #(.N(`CACHE_WAYS)) valid_index
|
||||
if(`DCACHE_WAYS != 1) begin
|
||||
VX_generic_priority_encoder #(.N(`DCACHE_WAYS)) valid_index
|
||||
(
|
||||
.valids(~valid_use_per_way),
|
||||
.index (invalid_index),
|
||||
.found (invalid_found)
|
||||
);
|
||||
|
||||
VX_generic_priority_encoder #(.N(`CACHE_WAYS)) way_indexing
|
||||
VX_generic_priority_encoder #(.N(`DCACHE_WAYS)) way_indexing
|
||||
(
|
||||
.valids(hit_per_way),
|
||||
.index (way_index),
|
||||
@@ -90,7 +90,7 @@ module VX_cache_data_per_index
|
||||
|
||||
|
||||
genvar ways;
|
||||
for(ways=0; ways < `CACHE_WAYS; ways = ways + 1) begin
|
||||
for(ways=0; ways < `DCACHE_WAYS; ways = ways + 1) begin
|
||||
|
||||
assign hit_per_way[ways] = ((valid_use_per_way[ways] == 1'b1) && (tag_use_per_way[ways] == tag_write)) ? 1'b1 : 0;
|
||||
assign we_per_way[ways] = (evict == 1'b1) || (update == 1'b1) ? ((ways == way_to_update) ? (we) : 0) : 0;
|
||||
@@ -99,7 +99,7 @@ module VX_cache_data_per_index
|
||||
|
||||
/*VX_cache_data #(
|
||||
.CACHE_SIZE(`CACHE_SIZE),
|
||||
.CACHE_WAYS(`CACHE_WAYS),
|
||||
.CACHE_WAYS(`DCACHE_WAYS),
|
||||
.CACHE_BLOCK(`CACHE_BLOCK),
|
||||
.CACHE_BANKS(`CACHE_BANKS)) data_structures(*/
|
||||
VX_cache_data data_structures(
|
||||
@@ -124,7 +124,7 @@ module VX_cache_data_per_index
|
||||
eviction_way_index <= 0;
|
||||
end else begin
|
||||
if(miss && dirty_use && valid_use && !evict && valid_in) begin // can be either evict or invalid cache entries
|
||||
if((eviction_way_index[addr]+1) == `CACHE_WAYS) begin
|
||||
if((eviction_way_index[addr]+1) == `DCACHE_WAYS) begin
|
||||
eviction_way_index[addr] <= 0;
|
||||
end else begin
|
||||
eviction_way_index[addr] <= (eviction_way_index[addr] + 1);
|
||||
@@ -133,4 +133,4 @@ module VX_cache_data_per_index
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
endmodule
|
||||
|
||||
Reference in New Issue
Block a user