From ad18b18ac07db57954dc102383993fba0b6b2af4 Mon Sep 17 00:00:00 2001 From: Joshua Wise Date: Sat, 17 Jan 2009 06:09:41 -0500 Subject: [PATCH] DCache/ICache: Invalidate while filling, so if the fill is aborted, then at least we do not return bad data later. 8 hour debug session; 1 line fix. --- DCache.v | 3 ++- ICache.v | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DCache.v b/DCache.v index ab68448..356debc 100644 --- a/DCache.v +++ b/DCache.v @@ -86,7 +86,8 @@ module DCache( if (cache_fill_pos == 15) begin /* Done? */ cache_tags[idx] <= tag; cache_valid[idx] <= 1; - end + end else + cache_valid[idx] <= 0; end end else if (wr_req && cache_hit) cache_data[idx][addr[5:2]] = wr_data; diff --git a/ICache.v b/ICache.v index b9e4eff..e90f430 100644 --- a/ICache.v +++ b/ICache.v @@ -77,7 +77,9 @@ module ICache( if (cache_fill_pos == 15) begin /* Done? */ cache_tags[rd_idx] <= rd_tag; cache_valid[rd_idx] <= 1; - end + $display("ICACHE: Fill complete for line %x, tag %x", rd_idx, rd_tag); + end else + cache_valid[rd_idx] <= 0; end end end -- 2.39.2