SourceGen: Handle gen and claim at the same cycle

This is possible for 0-latency response on the D channel.
This commit is contained in:
Hansung Kim
2024-04-08 18:23:39 -07:00
parent 48c3a5692e
commit 47c7eacafd

View File

@@ -344,13 +344,18 @@ class SourceGenerator[T <: Data](
io.id.valid := (if (ignoreInUse) true.B else !lowestFreeRow.valid)
io.id.bits := lowestFree
when(io.gen && io.id.valid /* fire */ ) {
occupancyTable(io.id.bits).valid := true.B // mark in use
if (metadata.isDefined) {
occupancyTable(io.id.bits).meta := io.meta
// handle reclaim at the same cycle, e.g. for 0-latency D channel response
when (!io.reclaim.valid || io.reclaim.bits =/= io.id.bits) {
occupancyTable(io.id.bits).valid := true.B // mark in use
if (metadata.isDefined) {
occupancyTable(io.id.bits).meta := io.meta
}
}
}
when(io.reclaim.valid) {
// @perf: would this require multiple write ports?
// NOTE: this does not seem sufficient to handle same-cycle gen-reclaimon
// its own
occupancyTable(io.reclaim.bits).valid := false.B // mark freed
}
io.peek := {