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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user