Only compare leader against followers >= leader idx
This commit is contained in:
@@ -274,11 +274,9 @@ class MonoCoalescer(coalLogSize: Int, windowT: CoalShiftQueue[ReqQueueEntry],
|
|||||||
leadersValid(i), head.source, head.address)
|
leadersValid(i), head.source, head.address)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// debug assertions and prints
|
|
||||||
when (leadersValid.reduce(_ || _)) {
|
when (leadersValid.reduce(_ || _)) {
|
||||||
assert(testNoQueueDrift, "unexpected drift between lane request queues")
|
assert(testNoQueueDrift, "unexpected drift between lane request queues")
|
||||||
printQueueHeads
|
// printQueueHeads
|
||||||
}
|
}
|
||||||
|
|
||||||
val size = coalLogSize
|
val size = coalLogSize
|
||||||
@@ -291,15 +289,19 @@ class MonoCoalescer(coalLogSize: Int, windowT: CoalShiftQueue[ReqQueueEntry],
|
|||||||
|
|
||||||
// Gives a 2-D table of Bools representing match at every queue entry,
|
// Gives a 2-D table of Bools representing match at every queue entry,
|
||||||
// for each lane (so 3-D in total).
|
// for each lane (so 3-D in total).
|
||||||
val matchTablePerLane = (leaders zip leadersValid).map { case (leader, leaderValid) =>
|
val matchTablePerLane = (leaders zip leadersValid).zipWithIndex
|
||||||
// TODO: match leader to only lanes >= leader idx
|
.map { case ((leader, leaderValid), leaderIndex) =>
|
||||||
io.window.map { followerLane =>
|
io.window.zipWithIndex.map { case (followerQueue, followerIndex) =>
|
||||||
// compare leader's head against follower's every queue entry
|
// compare leader's head against follower's every queue entry
|
||||||
(followerLane.elts zip followerLane.mask.asBools).map { case (follower, followerValid) =>
|
(followerQueue.elts zip followerQueue.mask.asBools)
|
||||||
canMatch(follower, followerValid, leader, leaderValid)
|
.map { case (follower, followerValid) =>
|
||||||
|
// match leader to only followers at lanes >= leader idx
|
||||||
|
// this halves the number of comparators
|
||||||
|
if (followerIndex < leaderIndex) false.B
|
||||||
|
else canMatch(follower, followerValid, leader, leaderValid)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: potentially expensive: popcount & adder
|
// TODO: potentially expensive: popcount & adder
|
||||||
val matchCounts = matchTablePerLane.map(table =>
|
val matchCounts = matchTablePerLane.map(table =>
|
||||||
@@ -336,9 +338,9 @@ class MonoCoalescer(coalLogSize: Int, windowT: CoalShiftQueue[ReqQueueEntry],
|
|||||||
|
|
||||||
// debug prints
|
// debug prints
|
||||||
when (leadersValid.reduce(_ || _)) {
|
when (leadersValid.reduce(_ || _)) {
|
||||||
// matchCounts.zipWithIndex.foreach { case (count, i) =>
|
matchCounts.zipWithIndex.foreach { case (count, i) =>
|
||||||
// printf(s"lane[${i}] matchCount = %d\n", count);
|
printf(s"lane[${i}] matchCount = %d\n", count);
|
||||||
// }
|
}
|
||||||
printf("chosenLeader = lane %d\n", chosenLeaderIdx)
|
printf("chosenLeader = lane %d\n", chosenLeaderIdx)
|
||||||
printf("chosenLeader matches = [ ")
|
printf("chosenLeader matches = [ ")
|
||||||
chosenMatches.foreach { m =>
|
chosenMatches.foreach { m =>
|
||||||
|
|||||||
Reference in New Issue
Block a user