From 849d5c57f8f0b56c00a8ee207f3722bdd51a2c9c Mon Sep 17 00:00:00 2001 From: jon <> Date: Wed, 7 Jul 2021 11:30:06 +0100 Subject: [PATCH] Fix condition where Queue can remain "empty" when there were outstanding indices due to the head-1 element happening to match new requests. This leads to "remove" when empty, leading to being "almostFull" when there are no outstanding users that will remove anything. --- src_Core/RISCY_OOO/procs/lib/IndexedMultiset.bsv | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src_Core/RISCY_OOO/procs/lib/IndexedMultiset.bsv b/src_Core/RISCY_OOO/procs/lib/IndexedMultiset.bsv index cb16715..a148637 100644 --- a/src_Core/RISCY_OOO/procs/lib/IndexedMultiset.bsv +++ b/src_Core/RISCY_OOO/procs/lib/IndexedMultiset.bsv @@ -146,7 +146,7 @@ module mkIndexedMultisetQueue(IndexedMultiset#(Bit#(idxTSz), datT, remWidth)) Reg#(Bit#(TAdd#(idxTSz,1))) ltail <- mkReg(0); idxT head = truncate(lhead); Bit#(TAdd#(idxTSz,1)) level = lhead - ltail; - //Bool empty = (level==0); + Bool empty = (level==0); Bool full = (level==fromInteger(valueOf(TExp#(idxTSz)))); Bool almostFull = (level>=fromInteger(valueOf(TExp#(idxTSz)))-1); @@ -201,7 +201,7 @@ module mkIndexedMultisetQueue(IndexedMultiset#(Bit#(idxTSz), datT, remWidth)) method ActionValue#(IndexedMultisetIndices#(idxT)) insertAndReserve(datT ins, datT res) if (!almostFull); idxT insIdx = head - 1; // Default, assuming a match. idxT resIdx = head - 1; // Default, assuming a match. - if (recsRead[head - 1]!=ins) begin + if (recsRead[head - 1]!=ins || empty) begin insIdx = head; insertW.wset(ins); // Increment head. if (res!=ins) begin