FIXED BUGS

This commit is contained in:
felsabbagh3
2019-11-07 13:54:46 -05:00
parent 58a9140f08
commit 5d5ad9c4ec
7 changed files with 257 additions and 209 deletions

View File

@@ -130,7 +130,8 @@ module VX_Cache_Bank
assign data_evicted = data_use;
assign eviction_wb = miss && (dirty_use != 1'b0) && valid_use;
// assign eviction_wb = miss && (dirty_use != 1'b0) && valid_use;
assign eviction_wb = (dirty_use != 1'b0);
assign eviction_tag = tag_use;
assign access = (state == CACHE_IDLE) && valid_in;
assign write_from_mem = (state == RECIV_MEM_RSP) && valid_in; // TODO
@@ -230,6 +231,7 @@ module VX_Cache_Bank
.clk (clk),
.rst (rst),
.valid_in (valid_in),
.state (state),
// Inputs
.addr (actual_index),
.we (we),

View File

@@ -17,6 +17,7 @@ module VX_cache_data_per_index
input wire clk, // Clock
input wire rst,
input wire valid_in,
input wire [3:0] state,
// Addr
input wire[IND_SIZE_END:IND_SIZE_START] addr,
// WE
@@ -55,6 +56,10 @@ module VX_cache_data_per_index
wire [CACHE_WAY_INDEX-1:0] invalid_index;
localparam CACHE_IDLE = 0; // Idle
localparam SEND_MEM_REQ = 1; // Write back this block into memory
localparam RECIV_MEM_RSP = 2;
if(CACHE_WAYS != 1) begin
VX_generic_priority_encoder #(.N(CACHE_WAYS)) valid_index
(
@@ -127,7 +132,7 @@ module VX_cache_data_per_index
if (rst) begin
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((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
eviction_way_index[addr] <= 0;
end else begin

View File

@@ -357,7 +357,7 @@ module VX_d_cache
assign o_m_evict_addr = evict_addr & MEM_ADDR_REQ_MASK;
assign o_m_read_addr = miss_addr & MEM_ADDR_REQ_MASK;
assign o_m_valid = (state == SEND_MEM_REQ);
assign o_m_read_or_write = (state == SEND_MEM_REQ) && (|eviction_wb_old);
assign o_m_read_or_write = (state == SEND_MEM_REQ) && (|eviction_wb);
//end
endmodule