mkXBar: Simplify as fallback case handles priority case correctly

The first element in the vector will be srcRR[dst], so the special case
is unnecessary.
This commit is contained in:
Jessica Clarke
2021-05-28 02:57:12 +01:00
parent afd636a0f5
commit 46b1519cb0

View File

@@ -101,16 +101,9 @@ module mkXBar#(
return False;
end
endfunction
Maybe#(srcIdxT) whichSrc = Invalid; // the src to select
if(isFromSrc(srcRR[dst])) begin
// first check the src with priority
whichSrc = Valid (srcRR[dst]);
end
else begin
// otherwise just get one valid src
Vector#(srcNum, srcIdxT) srcIdxVec = rotateBy(genWith(fromInteger), unpack(srcRR[dst]));
whichSrc = searchIndex(isFromSrc, srcIdxVec);
end
// find the first valid source starting at srcRR[dst]
Vector#(srcNum, srcIdxT) srcIdxVec = rotateBy(genWith(fromInteger), unpack(srcRR[dst]));
Maybe#(srcIdxT) whichSrc = searchIndex(isFromSrc, srcIdxVec); // the src to select
if(whichSrc matches tagged Valid .src) begin
// can do enq & deq
deqSrcByDst[dst] = whichSrc;