From: Joshua Wise Date: Sat, 17 Jan 2009 11:09:41 +0000 (-0500) Subject: DCache/ICache: Invalidate while filling, so if the fill is aborted, then at least... X-Git-Url: http://git.joshuawise.com/firearm.git/commitdiff_plain/ad18b18ac07db57954dc102383993fba0b6b2af4?ds=sidebyside 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. --- 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