Compiles and elaborates, does not pass asm tests
This commit is contained in:
parent
86bdbd6535
commit
044b19dbc1
@ -130,8 +130,9 @@ class L2MetaReadReq extends MetaReadReq with HasL2Id {
|
||||
}
|
||||
|
||||
class L2MetaWriteReq extends MetaWriteReq[L2Metadata](new L2Metadata)
|
||||
with HasL2Id
|
||||
|
||||
with HasL2Id {
|
||||
override def clone = new L2MetaWriteReq().asInstanceOf[this.type]
|
||||
}
|
||||
class L2MetaResp extends L2HellaCacheBundle
|
||||
with HasL2Id
|
||||
with HasL2InternalRequestState
|
||||
@ -360,7 +361,7 @@ abstract class L2XactTracker(innerId: String, outerId: String) extends L2HellaCa
|
||||
}
|
||||
|
||||
class L2VoluntaryReleaseTracker(trackerId: Int, bankId: Int, innerId: String, outerId: String) extends L2XactTracker(innerId, outerId) {
|
||||
val s_idle :: s_meta_read :: s_meta_resp :: s_meta_write :: s_data_write :: s_grant :: s_busy :: Nil = Enum(UInt(), 6)
|
||||
val s_idle :: s_meta_read :: s_meta_resp :: s_meta_write :: s_data_write :: s_grant :: s_busy :: Nil = Enum(UInt(), 7)
|
||||
val state = Reg(init=s_idle)
|
||||
val xact = Reg{ new Release }
|
||||
val xact_internal = Reg{ new L2MetaResp }
|
||||
@ -399,7 +400,6 @@ class L2VoluntaryReleaseTracker(trackerId: Int, bankId: Int, innerId: String, ou
|
||||
io.meta_write.bits.idx := xact.addr(untagBits-1,blockOffBits)
|
||||
io.meta_write.bits.way_en := xact_internal.way_en
|
||||
io.meta_write.bits.data := xact_internal.meta
|
||||
io.meta_resp.valid := Bool(true)
|
||||
|
||||
switch (state) {
|
||||
is(s_idle) {
|
||||
@ -450,21 +450,22 @@ class L2AcquireTracker(trackerId: Int, bankId: Int, innerId: String, outerId: St
|
||||
val state = Reg(init=s_idle)
|
||||
val xact = Reg{ new Acquire }
|
||||
val xact_internal = Reg{ new L2MetaResp }
|
||||
val test = Reg{UInt()}
|
||||
val init_client_id = Reg(init=UInt(0, width = log2Up(nClients)))
|
||||
//TODO: Will need id reg for merged release xacts
|
||||
|
||||
|
||||
val release_count = Reg(init = UInt(0, width = log2Up(nClients)))
|
||||
val pending_probes = Reg(init = co.dir())
|
||||
val curr_p_id = pending_probes.next()
|
||||
val pending_probes = Reg(init = co.dir().flush)
|
||||
val curr_p_id = co.dir().next(pending_probes)
|
||||
|
||||
val is_uncached = co.messageIsUncached(xact)
|
||||
val tag_match = xact_internal.tag_match
|
||||
val needs_writeback = co.needsWriteback(xact_internal.meta.coh)
|
||||
val is_hit = co.isHit(xact, xact_internal.meta.coh)
|
||||
val needs_probes = co.requiresProbes(xact.a_type, xact_internal.meta.coh)
|
||||
val c_rel_had_data = Reg{Bool()}
|
||||
val c_rel_was_voluntary = Reg{Bool()}
|
||||
val c_rel_had_data = Reg(init = Bool(false))
|
||||
val c_rel_was_voluntary = Reg(init = Bool(false))
|
||||
val wb_buffer = Reg{xact.data.clone}
|
||||
|
||||
io.has_acquire_conflict := co.isCoherenceConflict(xact.addr, c_acq.payload.addr) &&
|
||||
@ -557,12 +558,14 @@ class L2AcquireTracker(trackerId: Int, bankId: Int, innerId: String, outerId: St
|
||||
val _is_hit = co.isHit(xact, coh)
|
||||
val _needs_probes = co.requiresProbes(xact.a_type, coh)
|
||||
xact_internal := io.meta_resp.bits
|
||||
test := UInt(0)
|
||||
when(!_needs_writeback) {
|
||||
xact_internal.meta.coh := co.masterMetadataOnFlush
|
||||
// xact_internal.meta.coh := co.masterMetadataOnFlush
|
||||
test := UInt(12)
|
||||
}
|
||||
when(_needs_probes) {
|
||||
pending_probes := coh.sharers
|
||||
release_count := coh.sharers.count()
|
||||
release_count := co.dir().count(coh.sharers)
|
||||
c_rel_had_data := Bool(false)
|
||||
c_rel_was_voluntary := Bool(false)
|
||||
}
|
||||
@ -579,19 +582,21 @@ class L2AcquireTracker(trackerId: Int, bankId: Int, innerId: String, outerId: St
|
||||
val skip = io.tile_incoherent(curr_p_id) ||
|
||||
((curr_p_id === init_client_id) &&
|
||||
!co.requiresSelfProbe(xact.a_type))
|
||||
io.inner.probe.valid := !(pending_probes.none() || skip)
|
||||
io.inner.probe.valid := !(co.dir().none(pending_probes) || skip)
|
||||
when(io.inner.probe.ready || skip) {
|
||||
pending_probes.pop(curr_p_id)
|
||||
co.dir().pop(pending_probes, curr_p_id)
|
||||
}
|
||||
when(skip) { release_count := release_count - UInt(1) }
|
||||
|
||||
// Handle releases, which may have data being written back
|
||||
io.inner.release.ready := Bool(true)
|
||||
when(io.inner.release.valid) {
|
||||
/*
|
||||
xact_internal.meta.coh := co.masterMetadataOnRelease(
|
||||
c_rel.payload,
|
||||
xact_internal.meta.coh,
|
||||
c_rel.header.src)
|
||||
*/
|
||||
when(co.messageHasData(c_rel.payload)) {
|
||||
c_rel_had_data := Bool(true)
|
||||
when(tag_match) {
|
||||
@ -623,7 +628,7 @@ class L2AcquireTracker(trackerId: Int, bankId: Int, innerId: String, outerId: St
|
||||
}
|
||||
is(s_data_resp_wb) {
|
||||
when(io.data_resp.valid) {
|
||||
wb_buffer := io.data_resp.bits
|
||||
wb_buffer := io.data_resp.bits.data
|
||||
state := s_outer_write_wb
|
||||
}
|
||||
}
|
||||
|
@ -28,10 +28,10 @@ object MasterMetadata {
|
||||
def apply(state: UInt)(implicit c: CoherencePolicy): MasterMetadata = {
|
||||
val m = new MasterMetadata
|
||||
m.state := state
|
||||
m.sharers.flush()
|
||||
m.sharers := c.dir().flush
|
||||
m
|
||||
}
|
||||
def apply(state: UInt, sharers: DirectoryRepresentation)(implicit c: CoherencePolicy): MasterMetadata = {
|
||||
def apply(state: UInt, sharers: UInt)(implicit c: CoherencePolicy): MasterMetadata = {
|
||||
val m = apply(state)
|
||||
m.sharers := sharers
|
||||
m
|
||||
@ -39,7 +39,7 @@ object MasterMetadata {
|
||||
}
|
||||
class MasterMetadata(implicit c: CoherencePolicy) extends CoherenceMetadata {
|
||||
val state = UInt(width = c.masterStateWidth)
|
||||
val sharers = c.dir()
|
||||
val sharers = UInt(width = c.dir().width)
|
||||
override def clone = new MasterMetadata()(c).asInstanceOf[this.type]
|
||||
}
|
||||
/*
|
||||
@ -50,37 +50,34 @@ class MixedMetadata(inner: CoherencePolicy, outer: CoherencePolicy) extends Cohe
|
||||
}
|
||||
*/
|
||||
|
||||
abstract class DirectoryRepresentation extends Bundle {
|
||||
def pop(id: UInt): DirectoryRepresentation
|
||||
def push(id: UInt): DirectoryRepresentation
|
||||
def flush(dummy: Int = 0): DirectoryRepresentation
|
||||
def none(dummy: Int = 0): Bool
|
||||
def one(dummy: Int = 0): Bool
|
||||
def count(dummy: Int = 0): UInt
|
||||
def next(dummy: Int = 0): UInt
|
||||
abstract class DirectoryRepresentation(val width: Int) {
|
||||
def pop(prev: UInt, id: UInt): UInt
|
||||
def push(prev: UInt, id: UInt): UInt
|
||||
def flush: UInt
|
||||
def none(s: UInt): Bool
|
||||
def one(s: UInt): Bool
|
||||
def count(s: UInt): UInt
|
||||
def next(s: UInt): UInt
|
||||
}
|
||||
|
||||
class NullRepresentation extends DirectoryRepresentation {
|
||||
val internal = UInt()
|
||||
def pop(id: UInt) = this
|
||||
def push(id: UInt) = this
|
||||
def flush(dummy: Int = 0) = { internal := UInt(0); this }
|
||||
def none(dummy: Int = 0) = Bool(false)
|
||||
def one(dummy: Int = 0) = Bool(false)
|
||||
def count(dummy: Int = 0) = UInt(0)
|
||||
def next(dummy: Int = 0) = UInt(0)
|
||||
class NullRepresentation extends DirectoryRepresentation(1) {
|
||||
def pop(prev: UInt, id: UInt) = UInt(0)
|
||||
def push(prev: UInt, id: UInt) = UInt(0)
|
||||
def flush = UInt(0)
|
||||
def none(s: UInt) = Bool(false)
|
||||
def one(s: UInt) = Bool(false)
|
||||
def count(s: UInt) = UInt(0)
|
||||
def next(s: UInt) = UInt(0)
|
||||
}
|
||||
|
||||
class FullRepresentation(nClients: Int) extends DirectoryRepresentation {
|
||||
val internal = UInt(width = nClients)
|
||||
def pop(id: UInt) = { internal := internal & ~UIntToOH(id); this } // make new FullRep to return?
|
||||
def push(id: UInt) = { internal := internal | UIntToOH(id); this }
|
||||
def flush(dummy: Int = 0) = { internal := UInt(0, width = nClients); this }
|
||||
def none(dummy: Int = 0) = internal === UInt(0)
|
||||
def one(dummy: Int = 0) = PopCount(internal) === UInt(1)
|
||||
def count(dummy: Int = 0) = PopCount(internal)
|
||||
def next(dummy: Int = 0) = PriorityEncoder(internal)
|
||||
override def clone = new FullRepresentation(nClients).asInstanceOf[this.type]
|
||||
class FullRepresentation(nClients: Int) extends DirectoryRepresentation(nClients) {
|
||||
def pop(prev: UInt, id: UInt) = prev & ~UIntToOH(id)
|
||||
def push(prev: UInt, id: UInt) = prev | UIntToOH(id)
|
||||
def flush = UInt(0, width = width)
|
||||
def none(s: UInt) = s === UInt(0)
|
||||
def one(s: UInt) = PopCount(s) === UInt(1)
|
||||
def count(s: UInt) = PopCount(s)
|
||||
def next(s: UInt) = PriorityEncoder(s)
|
||||
}
|
||||
|
||||
abstract class CoherencePolicy(val dir: () => DirectoryRepresentation) {
|
||||
@ -216,7 +213,7 @@ class MICoherence(dir: () => DirectoryRepresentation) extends CoherencePolicyWit
|
||||
)))(this)
|
||||
def masterMetadataOnFlush = MasterMetadata(masterInvalid)(this)
|
||||
def masterMetadataOnRelease(r: Release, m: MasterMetadata, src: UInt) = {
|
||||
val next = MasterMetadata(masterValid, m.sharers.pop(src))(this)
|
||||
val next = MasterMetadata(masterValid, dir().pop(m.sharers, src))(this)
|
||||
MuxBundle(m, Array(
|
||||
r.is(releaseVoluntaryInvalidateData) -> next,
|
||||
r.is(releaseInvalidateData) -> next,
|
||||
@ -224,7 +221,7 @@ class MICoherence(dir: () => DirectoryRepresentation) extends CoherencePolicyWit
|
||||
))
|
||||
}
|
||||
def masterMetadataOnGrant(g: Grant, m: MasterMetadata, dst: UInt) = {
|
||||
val cached = MasterMetadata(masterValid, m.sharers.push(dst))(this)
|
||||
val cached = MasterMetadata(masterValid, dir().push(m.sharers, dst))(this)
|
||||
val uncached = MasterMetadata(masterValid, m.sharers)(this)
|
||||
MuxBundle(uncached, Array(
|
||||
g.is(grantReadExclusive) -> cached
|
||||
@ -307,7 +304,7 @@ class MICoherence(dir: () => DirectoryRepresentation) extends CoherencePolicyWit
|
||||
def requiresAckForGrant(g_type: UInt) = g_type != grantVoluntaryAck
|
||||
def requiresAckForRelease(r_type: UInt) = Bool(false)
|
||||
def requiresSelfProbe(a_type: UInt) = a_type === acquireReadUncached
|
||||
def requiresProbes(a_type: UInt, m: MasterMetadata) = !m.sharers.none()
|
||||
def requiresProbes(a_type: UInt, m: MasterMetadata) = !dir().none(m.sharers)
|
||||
def pendingVoluntaryReleaseIsSufficient(r_type: UInt, p_type: UInt): Bool = (r_type === releaseVoluntaryInvalidateData)
|
||||
}
|
||||
|
||||
@ -380,7 +377,7 @@ class MEICoherence(dir: () => DirectoryRepresentation) extends CoherencePolicyWi
|
||||
)))(this)
|
||||
def masterMetadataOnFlush = MasterMetadata(masterInvalid)(this)
|
||||
def masterMetadataOnRelease(r: Release, m: MasterMetadata, src: UInt) = {
|
||||
val next = MasterMetadata(masterValid, m.sharers.pop(src))(this)
|
||||
val next = MasterMetadata(masterValid, dir().pop(m.sharers,src))(this)
|
||||
MuxBundle(m, Array(
|
||||
r.is(releaseVoluntaryInvalidateData) -> next,
|
||||
r.is(releaseInvalidateData) -> next,
|
||||
@ -388,7 +385,7 @@ class MEICoherence(dir: () => DirectoryRepresentation) extends CoherencePolicyWi
|
||||
))
|
||||
}
|
||||
def masterMetadataOnGrant(g: Grant, m: MasterMetadata, dst: UInt) = {
|
||||
val cached = MasterMetadata(masterValid, m.sharers.push(dst))(this)
|
||||
val cached = MasterMetadata(masterValid, dir().push(m.sharers, dst))(this)
|
||||
val uncached = MasterMetadata(masterValid, m.sharers)(this)
|
||||
MuxBundle(uncached, Array(
|
||||
g.is(grantReadExclusive) -> cached,
|
||||
@ -480,7 +477,7 @@ class MEICoherence(dir: () => DirectoryRepresentation) extends CoherencePolicyWi
|
||||
def requiresAckForGrant(g_type: UInt) = g_type != grantVoluntaryAck
|
||||
def requiresAckForRelease(r_type: UInt) = Bool(false)
|
||||
def requiresSelfProbe(a_type: UInt) = a_type === acquireReadUncached
|
||||
def requiresProbes(a_type: UInt, m: MasterMetadata) = !m.sharers.none()
|
||||
def requiresProbes(a_type: UInt, m: MasterMetadata) = !dir().none(m.sharers)
|
||||
|
||||
def pendingVoluntaryReleaseIsSufficient(r_type: UInt, p_type: UInt): Bool = (r_type === releaseVoluntaryInvalidateData)
|
||||
}
|
||||
@ -559,7 +556,7 @@ class MSICoherence(dir: () => DirectoryRepresentation) extends CoherencePolicyWi
|
||||
)))(this)
|
||||
def masterMetadataOnFlush = MasterMetadata(masterInvalid)(this)
|
||||
def masterMetadataOnRelease(r: Release, m: MasterMetadata, src: UInt) = {
|
||||
val next = MasterMetadata(masterValid, m.sharers.pop(src))(this)
|
||||
val next = MasterMetadata(masterValid, dir().pop(m.sharers,src))(this)
|
||||
MuxBundle(m, Array(
|
||||
r.is(releaseVoluntaryInvalidateData) -> next,
|
||||
r.is(releaseInvalidateData) -> next,
|
||||
@ -567,7 +564,7 @@ class MSICoherence(dir: () => DirectoryRepresentation) extends CoherencePolicyWi
|
||||
))
|
||||
}
|
||||
def masterMetadataOnGrant(g: Grant, m: MasterMetadata, dst: UInt) = {
|
||||
val cached = MasterMetadata(masterValid, m.sharers.push(dst))(this)
|
||||
val cached = MasterMetadata(masterValid, dir().push(m.sharers, dst))(this)
|
||||
val uncached = MasterMetadata(masterValid, m.sharers)(this)
|
||||
MuxBundle(uncached, Array(
|
||||
g.is(grantReadShared) -> cached,
|
||||
@ -622,7 +619,7 @@ class MSICoherence(dir: () => DirectoryRepresentation) extends CoherencePolicyWi
|
||||
|
||||
def getGrantType(a: Acquire, m: MasterMetadata): UInt = {
|
||||
MuxLookup(a.a_type, grantReadUncached, Array(
|
||||
acquireReadShared -> Mux(!m.sharers.none(), grantReadShared, grantReadExclusive),
|
||||
acquireReadShared -> Mux(!dir().none(m.sharers), grantReadShared, grantReadExclusive),
|
||||
acquireReadExclusive -> grantReadExclusive,
|
||||
acquireReadUncached -> grantReadUncached,
|
||||
acquireWriteUncached -> grantWriteUncached,
|
||||
@ -656,7 +653,7 @@ class MSICoherence(dir: () => DirectoryRepresentation) extends CoherencePolicyWi
|
||||
def requiresAckForGrant(g_type: UInt) = g_type != grantVoluntaryAck
|
||||
def requiresAckForRelease(r_type: UInt) = Bool(false)
|
||||
def requiresSelfProbe(a_type: UInt) = a_type === acquireReadUncached
|
||||
def requiresProbes(a_type: UInt, m: MasterMetadata) = !m.sharers.none()
|
||||
def requiresProbes(a_type: UInt, m: MasterMetadata) = !dir().none(m.sharers)
|
||||
|
||||
def pendingVoluntaryReleaseIsSufficient(r_type: UInt, p_type: UInt): Bool = (r_type === releaseVoluntaryInvalidateData)
|
||||
}
|
||||
@ -736,7 +733,7 @@ class MESICoherence(dir: () => DirectoryRepresentation) extends CoherencePolicyW
|
||||
)))(this)
|
||||
def masterMetadataOnFlush = MasterMetadata(masterInvalid)(this)
|
||||
def masterMetadataOnRelease(r: Release, m: MasterMetadata, src: UInt) = {
|
||||
val next = MasterMetadata(masterValid, m.sharers.pop(src))(this)
|
||||
val next = MasterMetadata(masterValid, dir().pop(m.sharers,src))(this)
|
||||
MuxBundle(m, Array(
|
||||
r.is(releaseVoluntaryInvalidateData) -> next,
|
||||
r.is(releaseInvalidateData) -> next,
|
||||
@ -744,7 +741,7 @@ class MESICoherence(dir: () => DirectoryRepresentation) extends CoherencePolicyW
|
||||
))
|
||||
}
|
||||
def masterMetadataOnGrant(g: Grant, m: MasterMetadata, dst: UInt) = {
|
||||
val cached = MasterMetadata(masterValid, m.sharers.push(dst))(this)
|
||||
val cached = MasterMetadata(masterValid, dir().push(m.sharers, dst))(this)
|
||||
val uncached = MasterMetadata(masterValid, m.sharers)(this)
|
||||
MuxBundle(uncached, Array(
|
||||
g.is(grantReadShared) -> cached,
|
||||
@ -799,7 +796,7 @@ class MESICoherence(dir: () => DirectoryRepresentation) extends CoherencePolicyW
|
||||
|
||||
def getGrantType(a: Acquire, m: MasterMetadata): UInt = {
|
||||
MuxLookup(a.a_type, grantReadUncached, Array(
|
||||
acquireReadShared -> Mux(!m.sharers.none(), grantReadShared, grantReadExclusive),
|
||||
acquireReadShared -> Mux(!dir().none(m.sharers), grantReadShared, grantReadExclusive),
|
||||
acquireReadExclusive -> grantReadExclusive,
|
||||
acquireReadUncached -> grantReadUncached,
|
||||
acquireWriteUncached -> grantWriteUncached,
|
||||
@ -838,7 +835,7 @@ class MESICoherence(dir: () => DirectoryRepresentation) extends CoherencePolicyW
|
||||
def requiresAckForGrant(g_type: UInt) = g_type != grantVoluntaryAck
|
||||
def requiresAckForRelease(r_type: UInt) = Bool(false)
|
||||
def requiresSelfProbe(a_type: UInt) = a_type === acquireReadUncached
|
||||
def requiresProbes(a_type: UInt, m: MasterMetadata) = !m.sharers.none()
|
||||
def requiresProbes(a_type: UInt, m: MasterMetadata) = !dir().none(m.sharers)
|
||||
|
||||
def pendingVoluntaryReleaseIsSufficient(r_type: UInt, p_type: UInt): Bool = (r_type === releaseVoluntaryInvalidateData)
|
||||
}
|
||||
@ -930,7 +927,7 @@ class MigratoryCoherence(dir: () => DirectoryRepresentation) extends CoherencePo
|
||||
)))(this)
|
||||
def masterMetadataOnFlush = MasterMetadata(masterInvalid)(this)
|
||||
def masterMetadataOnRelease(r: Release, m: MasterMetadata, src: UInt) = {
|
||||
val next = MasterMetadata(masterValid, m.sharers.pop(src))(this)
|
||||
val next = MasterMetadata(masterValid, dir().pop(m.sharers,src))(this)
|
||||
MuxBundle(m, Array(
|
||||
r.is(releaseVoluntaryInvalidateData) -> next,
|
||||
r.is(releaseInvalidateData) -> next,
|
||||
@ -940,7 +937,7 @@ class MigratoryCoherence(dir: () => DirectoryRepresentation) extends CoherencePo
|
||||
))
|
||||
}
|
||||
def masterMetadataOnGrant(g: Grant, m: MasterMetadata, dst: UInt) = {
|
||||
val cached = MasterMetadata(masterValid, m.sharers.push(dst))(this)
|
||||
val cached = MasterMetadata(masterValid, dir().push(m.sharers, dst))(this)
|
||||
val uncached = MasterMetadata(masterValid, m.sharers)(this)
|
||||
MuxBundle(uncached, Array(
|
||||
g.is(grantReadShared) -> cached,
|
||||
@ -997,7 +994,7 @@ class MigratoryCoherence(dir: () => DirectoryRepresentation) extends CoherencePo
|
||||
|
||||
def getGrantType(a: Acquire, m: MasterMetadata): UInt = {
|
||||
MuxLookup(a.a_type, grantReadUncached, Array(
|
||||
acquireReadShared -> Mux(!m.sharers.none(), grantReadShared, grantReadExclusive), //TODO: what is count? Depend on release.p_type???
|
||||
acquireReadShared -> Mux(!dir().none(m.sharers), grantReadShared, grantReadExclusive), //TODO: what is count? Depend on release.p_type???
|
||||
acquireReadExclusive -> grantReadExclusive,
|
||||
acquireReadUncached -> grantReadUncached,
|
||||
acquireWriteUncached -> grantWriteUncached,
|
||||
@ -1038,7 +1035,7 @@ class MigratoryCoherence(dir: () => DirectoryRepresentation) extends CoherencePo
|
||||
def requiresAckForGrant(g_type: UInt) = g_type != grantVoluntaryAck
|
||||
def requiresAckForRelease(r_type: UInt) = Bool(false)
|
||||
def requiresSelfProbe(a_type: UInt) = a_type === acquireReadUncached
|
||||
def requiresProbes(a_type: UInt, m: MasterMetadata) = !m.sharers.none()
|
||||
def requiresProbes(a_type: UInt, m: MasterMetadata) = !dir().none(m.sharers)
|
||||
|
||||
def pendingVoluntaryReleaseIsSufficient(r_type: UInt, p_type: UInt): Bool = (r_type === releaseVoluntaryInvalidateData)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user