From a154207d3f3e27de249ce4e90f1f54d2ecba118b Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Fri, 15 May 2020 19:51:43 +0100 Subject: [PATCH] CreditCounter.bsv: Actually rate-limit If DRAM latency is too high and the cache is performing frequent writes, it would be possible to overflow this counter, which means we don't rate limit, the cache could erroneously believe it's safe to do I/O accesses/cache refills/page table walks, and the cache would block due to the guard on decr when it finally gets enough write responses back. We should block the incr method to automatically stall the cache until it receives a new write response. --- src_Core/BSV_Additional_Libs/CreditCounter.bsv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src_Core/BSV_Additional_Libs/CreditCounter.bsv b/src_Core/BSV_Additional_Libs/CreditCounter.bsv index 4d2ecf6..f071b72 100644 --- a/src_Core/BSV_Additional_Libs/CreditCounter.bsv +++ b/src_Core/BSV_Additional_Libs/CreditCounter.bsv @@ -37,7 +37,7 @@ module mkCreditCounter (CreditCounter_IFC #(w)); method UInt #(w) value = crg [1]; - method Action incr; + method Action incr if (crg [0] != maxBound); if (crg [0] == maxBound) begin $display ("%0d: ERROR: CreditCounter: overflow", cur_cycle); $finish (1); // Assertion failure