tilelink2 SourceShrinker: handle degenerate cases for free
This commit is contained in:
parent
1e7d597fd3
commit
1d3cad3671
@ -9,6 +9,8 @@ import scala.math.{min,max}
|
||||
|
||||
class TLSourceShrinker(maxInFlight: Int) extends LazyModule
|
||||
{
|
||||
require (maxInFlight > 0)
|
||||
|
||||
private val client = TLClientParameters(sourceId = IdRange(0, maxInFlight))
|
||||
val node = TLAdapterNode(
|
||||
// We erase all client information since we crush the source Ids
|
||||
@ -37,6 +39,10 @@ class TLSourceShrinker(maxInFlight: Int) extends LazyModule
|
||||
in.c.ready := Bool(true)
|
||||
in.e.ready := Bool(true)
|
||||
|
||||
if (maxInFlight >= edgeIn.client.endSourceId) {
|
||||
out.a <> in.a
|
||||
in.d <> out.d
|
||||
} else {
|
||||
// State tracking
|
||||
val sourceIdMap = Mem(maxInFlight, in.a.bits.source)
|
||||
val allocated = RegInit(UInt(0, width = maxInFlight))
|
||||
@ -66,6 +72,7 @@ class TLSourceShrinker(maxInFlight: Int) extends LazyModule
|
||||
val free_id = Mux(free, UIntToOH(out.d.bits.source), UInt(0))
|
||||
allocated := (allocated | alloc_id) & ~free_id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object TLSourceShrinker
|
||||
|
Loading…
Reference in New Issue
Block a user