1
0

clean up incoherent and probe flags

This commit is contained in:
Henry Cook 2015-03-12 16:22:14 -07:00
parent dcc84c4dd3
commit 8181262419
3 changed files with 32 additions and 29 deletions

View File

@ -219,16 +219,15 @@ class BroadcastAcquireTracker(trackerId: Int, bankId: Int) extends BroadcastXact
Vec(Acquire.getType, Acquire.putType, Acquire.putAtomicType).contains(xact.a_type)), Vec(Acquire.getType, Acquire.putType, Acquire.putAtomicType).contains(xact.a_type)),
"Broadcast Hub does not support PutAtomics or subblock Gets/Puts") // TODO "Broadcast Hub does not support PutAtomics or subblock Gets/Puts") // TODO
val release_count = Reg(init=UInt(0, width = log2Up(nClients))) val release_count = Reg(init=UInt(0, width = log2Up(nCoherentClients+1)))
val probe_flags = Reg(init=Bits(0, width = nClients)) val pending_probes = Reg(init=Bits(0, width = nCoherentClients))
val curr_p_id = PriorityEncoder(probe_flags) val curr_p_id = PriorityEncoder(pending_probes)
val probe_initial_flags = Bits(width = nClients) val full_sharers = coh.full()
probe_initial_flags := Bits(0)
// issue self-probes for uncached read xacts to facilitate I$ coherence
val probe_self = io.inner.acquire.bits.payload.requiresSelfProbe() val probe_self = io.inner.acquire.bits.payload.requiresSelfProbe()
val myflag = Mux(probe_self, Bits(0), val mask_self = Mux(probe_self,
UIntToOH(io.inner.acquire.bits.header.src(log2Up(nClients)-1,0))) full_sharers | UInt(UInt(1) << xact_src, width = nCoherentClients),
probe_initial_flags := ~(io.incoherent.toBits | myflag) full_sharers & ~UInt(UInt(1) << xact_src, width = nCoherentClients))
val mask_incoherent = mask_self & ~io.incoherent.toBits
val collect_iacq_data = Reg(init=Bool(false)) val collect_iacq_data = Reg(init=Bool(false))
val iacq_data_valid = Reg(init=Bits(0, width = innerDataBeats)) val iacq_data_valid = Reg(init=Bits(0, width = innerDataBeats))
@ -307,18 +306,21 @@ class BroadcastAcquireTracker(trackerId: Int, bankId: Int) extends BroadcastXact
data_buffer(UInt(0)) := io.iacq().data data_buffer(UInt(0)) := io.iacq().data
collect_iacq_data := io.iacq().hasMultibeatData() collect_iacq_data := io.iacq().hasMultibeatData()
iacq_data_valid := io.iacq().hasData() << io.iacq().addr_beat iacq_data_valid := io.iacq().hasData() << io.iacq().addr_beat
probe_flags := probe_initial_flags val needs_probes = mask_incoherent.orR
release_count := PopCount(probe_initial_flags) when(needs_probes) {
state := Mux(probe_initial_flags.orR, s_probe, pending_probes := mask_incoherent
release_count := PopCount(mask_incoherent)
}
state := Mux(needs_probes, s_probe,
Mux(pending_outer_write_, s_mem_write, Mux(pending_outer_write_, s_mem_write,
Mux(pending_outer_read_, s_mem_read, s_make_grant))) Mux(pending_outer_read_, s_mem_read, s_make_grant)))
} }
} }
is(s_probe) { is(s_probe) {
// Generate probes // Generate probes
io.inner.probe.valid := probe_flags.orR io.inner.probe.valid := pending_probes.orR
when(io.inner.probe.ready) { when(io.inner.probe.ready) {
probe_flags := probe_flags & ~(UIntToOH(curr_p_id)) pending_probes := pending_probes & ~UIntToOH(curr_p_id)
} }
// Handle releases, which may have data to be written back // Handle releases, which may have data to be written back

View File

@ -596,13 +596,14 @@ class L2AcquireTracker(trackerId: Int, bankId: Int) extends L2XactTracker {
dst = io.inner.grant.bits.header.dst), dst = io.inner.grant.bits.header.dst),
pending_coh.outer) pending_coh.outer)
val release_count = Reg(init = UInt(0, width = log2Up(nClients+1))) val release_count = Reg(init = UInt(0, width = log2Up(nCoherentClients+1)))
val pending_probes = Reg(init = Bits(0, width = nClients)) val pending_probes = Reg(init = Bits(0, width = nCoherentClients))
val curr_p_id = PriorityEncoder(pending_probes) val curr_p_id = PriorityEncoder(pending_probes)
val full_sharers = io.meta.resp.bits.meta.coh.inner.full() val full_sharers = io.meta.resp.bits.meta.coh.inner.full()
val mask_self = Mux(xact.requiresSelfProbe(), val probe_self = xact.requiresSelfProbe()
full_sharers | (UInt(1) << xact_src), val mask_self = Mux(probe_self,
full_sharers & ~UInt(UInt(1) << xact_src, width = nClients)) full_sharers | UInt(UInt(1) << xact_src, width = nCoherentClients),
full_sharers & ~UInt(UInt(1) << xact_src, width = nCoherentClients))
val mask_incoherent = mask_self & ~io.incoherent.toBits val mask_incoherent = mask_self & ~io.incoherent.toBits
val collect_iacq_data = Reg(init=Bool(false)) val collect_iacq_data = Reg(init=Bool(false))
@ -770,8 +771,8 @@ class L2AcquireTracker(trackerId: Int, bankId: Int) extends L2XactTracker {
val _needs_probes = _tag_match && _coh.inner.requiresProbes(xact) val _needs_probes = _tag_match && _coh.inner.requiresProbes(xact)
when(_is_hit) { pending_coh := pending_coh_on_hit } when(_is_hit) { pending_coh := pending_coh_on_hit }
when(_needs_probes) { when(_needs_probes) {
pending_probes := mask_incoherent(nCoherentClients-1,0) pending_probes := mask_incoherent
release_count := PopCount(mask_incoherent(nCoherentClients-1,0)) release_count := PopCount(mask_incoherent)
} }
state := Mux(_tag_match, state := Mux(_tag_match,
Mux(_needs_probes, s_probe, Mux(_is_hit, s_data_read, s_outer_acquire)), // Probe, hit or upgrade Mux(_needs_probes, s_probe, Mux(_is_hit, s_data_read, s_outer_acquire)), // Probe, hit or upgrade
@ -920,9 +921,11 @@ class L2WritebackUnit(trackerId: Int, bankId: Int) extends L2XactTracker {
val pending_finish = Reg{ io.outer.finish.bits.clone } val pending_finish = Reg{ io.outer.finish.bits.clone }
val irel_had_data = Reg(init = Bool(false)) val irel_had_data = Reg(init = Bool(false))
val release_count = Reg(init = UInt(0, width = log2Up(nClients+1))) val release_count = Reg(init = UInt(0, width = log2Up(nCoherentClients+1)))
val pending_probes = Reg(init = Bits(0, width = nClients)) val pending_probes = Reg(init = Bits(0, width = nCoherentClients))
val curr_p_id = PriorityEncoder(pending_probes) val curr_p_id = PriorityEncoder(pending_probes)
val full_sharers = io.wb.req.bits.coh.inner.full()
val mask_incoherent = full_sharers & ~io.incoherent.toBits
val irel_data_done = connectIncomingDataBeatCounter(io.inner.release) val irel_data_done = connectIncomingDataBeatCounter(io.inner.release)
val (orel_data_cnt, orel_data_done) = connectOutgoingDataBeatCounter(io.outer.release) val (orel_data_cnt, orel_data_done) = connectOutgoingDataBeatCounter(io.outer.release)
@ -985,12 +988,10 @@ class L2WritebackUnit(trackerId: Int, bankId: Int) extends L2XactTracker {
xact_way_en := io.wb.req.bits.way_en xact_way_en := io.wb.req.bits.way_en
xact_id := io.wb.req.bits.id xact_id := io.wb.req.bits.id
irel_had_data := Bool(false) irel_had_data := Bool(false)
val coh = io.wb.req.bits.coh val needs_probes = io.wb.req.bits.coh.inner.requiresProbesOnVoluntaryWriteback()
val needs_probes = coh.inner.requiresProbesOnVoluntaryWriteback()
when(needs_probes) { when(needs_probes) {
val mask_incoherent = coh.inner.full() & ~io.incoherent.toBits pending_probes := mask_incoherent
pending_probes := mask_incoherent(nCoherentClients-1,0) release_count := PopCount(mask_incoherent)
release_count := PopCount(mask_incoherent(nCoherentClients-1,0))
} }
state := Mux(needs_probes, s_probe, s_data_read) state := Mux(needs_probes, s_probe, s_data_read)
} }

View File

@ -73,7 +73,7 @@ trait HasCoherenceAgentWiringHelpers {
trait HasInnerTLIO extends CoherenceAgentBundle { trait HasInnerTLIO extends CoherenceAgentBundle {
val inner = Bundle(new TileLinkIO)(innerTLParams).flip val inner = Bundle(new TileLinkIO)(innerTLParams).flip
val incoherent = Vec.fill(nClients){Bool()}.asInput val incoherent = Vec.fill(nCoherentClients){Bool()}.asInput
def iacq(dummy: Int = 0) = inner.acquire.bits.payload def iacq(dummy: Int = 0) = inner.acquire.bits.payload
def iprb(dummy: Int = 0) = inner.probe.bits.payload def iprb(dummy: Int = 0) = inner.probe.bits.payload
def irel(dummy: Int = 0) = inner.release.bits.payload def irel(dummy: Int = 0) = inner.release.bits.payload