support for multiple tilelink paramerterizations in same design
Conflicts: src/main/scala/cache.scala
This commit is contained in:
@ -15,22 +15,23 @@ abstract trait CoherenceAgentParameters extends UsesParameters {
|
||||
val nClients = params(NClients)
|
||||
}
|
||||
|
||||
abstract class CoherenceAgent extends Module
|
||||
abstract class CoherenceAgent(innerId: String, outerId: String) extends Module
|
||||
with CoherenceAgentParameters {
|
||||
val io = new Bundle {
|
||||
val inner = (new TileLinkIO).flip
|
||||
val outer = new UncachedTileLinkIO
|
||||
val inner = Bundle(new TileLinkIO, {case TLId => innerId}).flip
|
||||
val outer = Bundle(new UncachedTileLinkIO, {case TLId => outerId})
|
||||
val incoherent = Vec.fill(nClients){Bool()}.asInput
|
||||
}
|
||||
}
|
||||
|
||||
class L2CoherenceAgent(bankId: Int) extends CoherenceAgent {
|
||||
class L2CoherenceAgent(bankId: Int, innerId: String, outerId: String) extends
|
||||
CoherenceAgent(innerId, outerId) {
|
||||
|
||||
// Create SHRs for outstanding transactions
|
||||
val trackerList = (0 until nReleaseTransactors).map(id =>
|
||||
Module(new VoluntaryReleaseTracker(id, bankId))) ++
|
||||
Module(new VoluntaryReleaseTracker(id, bankId, innerId, outerId))) ++
|
||||
(nReleaseTransactors until nTransactors).map(id =>
|
||||
Module(new AcquireTracker(id, bankId)))
|
||||
Module(new AcquireTracker(id, bankId, innerId, outerId)))
|
||||
|
||||
// Propagate incoherence flags
|
||||
trackerList.map(_.io.tile_incoherent := io.incoherent.toBits)
|
||||
@ -82,17 +83,18 @@ class L2CoherenceAgent(bankId: Int) extends CoherenceAgent {
|
||||
ack.ready := Bool(true)
|
||||
|
||||
// Create an arbiter for the one memory port
|
||||
val outer_arb = Module(new UncachedTileLinkIOArbiterThatPassesId(trackerList.size))
|
||||
val outer_arb = Module(new UncachedTileLinkIOArbiterThatPassesId(trackerList.size),
|
||||
{case TLId => outerId})
|
||||
outer_arb.io.in zip trackerList map { case(arb, t) => arb <> t.io.outer }
|
||||
io.outer <> outer_arb.io.out
|
||||
}
|
||||
|
||||
|
||||
abstract class XactTracker extends Module {
|
||||
abstract class XactTracker(innerId: String, outerId: String) extends Module {
|
||||
val (co, nClients) = (params(TLCoherence),params(NClients))
|
||||
val io = new Bundle {
|
||||
val inner = (new TileLinkIO).flip
|
||||
val outer = new UncachedTileLinkIO
|
||||
val inner = Bundle(new TileLinkIO, {case TLId => innerId}).flip
|
||||
val outer = Bundle(new UncachedTileLinkIO, {case TLId => outerId})
|
||||
val tile_incoherent = Bits(INPUT, params(NClients))
|
||||
val has_acquire_conflict = Bool(OUTPUT)
|
||||
val has_release_conflict = Bool(OUTPUT)
|
||||
@ -105,7 +107,7 @@ abstract class XactTracker extends Module {
|
||||
val m_gnt = io.outer.grant.bits
|
||||
}
|
||||
|
||||
class VoluntaryReleaseTracker(trackerId: Int, bankId: Int) extends XactTracker {
|
||||
class VoluntaryReleaseTracker(trackerId: Int, bankId: Int, innerId: String, outerId: String) extends XactTracker(innerId, outerId) {
|
||||
val s_idle :: s_mem :: s_ack :: s_busy :: Nil = Enum(UInt(), 4)
|
||||
val state = Reg(init=s_idle)
|
||||
val xact = Reg{ new Release }
|
||||
@ -120,10 +122,11 @@ class VoluntaryReleaseTracker(trackerId: Int, bankId: Int) extends XactTracker {
|
||||
io.outer.acquire.valid := Bool(false)
|
||||
io.outer.acquire.bits.header.src := UInt(bankId)
|
||||
//io.outer.acquire.bits.header.dst TODO
|
||||
io.outer.acquire.bits.payload := Acquire(co.getUncachedWriteAcquireType,
|
||||
io.outer.acquire.bits.payload := Bundle(Acquire(co.getUncachedWriteAcquireType,
|
||||
xact.addr,
|
||||
UInt(trackerId),
|
||||
xact.data)
|
||||
xact.data),
|
||||
{ case TLId => outerId })
|
||||
io.inner.acquire.ready := Bool(false)
|
||||
io.inner.probe.valid := Bool(false)
|
||||
io.inner.release.ready := Bool(false)
|
||||
@ -154,7 +157,7 @@ class VoluntaryReleaseTracker(trackerId: Int, bankId: Int) extends XactTracker {
|
||||
}
|
||||
}
|
||||
|
||||
class AcquireTracker(trackerId: Int, bankId: Int) extends XactTracker {
|
||||
class AcquireTracker(trackerId: Int, bankId: Int, innerId: String, outerId: String) extends XactTracker(innerId, outerId) {
|
||||
val s_idle :: s_probe :: s_mem_read :: s_mem_write :: s_make_grant :: s_busy :: Nil = Enum(UInt(), 6)
|
||||
val state = Reg(init=s_idle)
|
||||
val xact = Reg{ new Acquire }
|
||||
@ -167,11 +170,14 @@ class AcquireTracker(trackerId: Int, bankId: Int) extends XactTracker {
|
||||
|
||||
val pending_outer_write = co.messageHasData(xact)
|
||||
val pending_outer_read = co.requiresOuterRead(xact.a_type)
|
||||
val outer_write_acq = Acquire(co.getUncachedWriteAcquireType,
|
||||
xact.addr, UInt(trackerId), xact.data)
|
||||
val outer_write_rel = Acquire(co.getUncachedWriteAcquireType,
|
||||
xact.addr, UInt(trackerId), c_rel.payload.data)
|
||||
val outer_read = Acquire(co.getUncachedReadAcquireType, xact.addr, UInt(trackerId))
|
||||
val outer_write_acq = Bundle(Acquire(co.getUncachedWriteAcquireType,
|
||||
xact.addr, UInt(trackerId), xact.data),
|
||||
{ case TLId => outerId })
|
||||
val outer_write_rel = Bundle(Acquire(co.getUncachedWriteAcquireType,
|
||||
xact.addr, UInt(trackerId), c_rel.payload.data),
|
||||
{ case TLId => outerId })
|
||||
val outer_read = Bundle(Acquire(co.getUncachedReadAcquireType, xact.addr, UInt(trackerId)),
|
||||
{ case TLId => outerId })
|
||||
|
||||
val probe_initial_flags = Bits(width = nClients)
|
||||
probe_initial_flags := Bits(0)
|
||||
|
Reference in New Issue
Block a user