From 769a6aec834467e86757aa3fcfe969f65f563ff9 Mon Sep 17 00:00:00 2001 From: Louis Hobson Date: Mon, 10 Mar 2025 17:15:51 +0000 Subject: [PATCH] merge fix in L1Pipe --- src_Core/RISCY_OOO/coherence/src/L1Pipe.bsv | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src_Core/RISCY_OOO/coherence/src/L1Pipe.bsv b/src_Core/RISCY_OOO/coherence/src/L1Pipe.bsv index 596d71b..b49ff2c 100644 --- a/src_Core/RISCY_OOO/coherence/src/L1Pipe.bsv +++ b/src_Core/RISCY_OOO/coherence/src/L1Pipe.bsv @@ -278,7 +278,9 @@ module mkL1Pipe( // find hit way (nothing is being replaced) function Bool isMatch(Tuple3#(Msi, tagT, ownerT) csTagOwner); match {.cs, .t, .o} = csTagOwner; - return (cs > I || isValid(o)) && t == tag; + Bool cRqHit = (cs > I || isValid(o)) && t == tag; + Bool pRqHit = cs > I && t == tag; + return cmd matches tagged CRq .* ? cRqHit : pRqHit; endfunction Maybe#(wayT) hitWay = searchIndex(isMatch, zip3(csVec, tagVec, ownerVec)); if(hitWay matches tagged Valid .w) begin @@ -303,15 +305,10 @@ module mkL1Pipe( unlocked[i] = !isValid(ownerVec[i]); end Maybe#(wayT) repWay = randRep.getReplaceWay(unlocked, invalid); - // sanity check: repWay must be valid - // ^ Not true if there are more MSHRs than ways - // Just choose a locked way. This will create a dependency chain. - // TODO: Maybe would be nice to replace the way that becomes free the soonest. - if(!isValid(repWay)) begin - if(verbose) - $display("%t L1 %m tagMatch: set oversubscription", $time); - //$fwrite(stderr, "[L1Pipe] ERROR: ", fshow(cmd), " cannot find way to replace\n"); - //$finish; + // There may be no way to replace if all ways are locked. + // Just choose a locked way. This will cause the request to be queued. + if(verbose && !isValid(repWay)) begin + $display("%t L1 %m tagMatch: set oversubscription", $time); end return TagMatchResult { way: fromMaybe(?, repWay),