1
0

fix minor coherence bugs

This commit is contained in:
Andrew Waterman 2012-03-13 19:10:54 -07:00
parent 1788c34113
commit ab6c9350db
2 changed files with 10 additions and 9 deletions

View File

@ -207,12 +207,12 @@ trait FourStateCoherence extends CoherencePolicy {
def newProbeReply (incoming: ProbeRequest, state: UFix): ProbeReply = { def newProbeReply (incoming: ProbeRequest, state: UFix): ProbeReply = {
val reply = Wire() { new ProbeReply() } val reply = Wire() { new ProbeReply() }
val with_data = MuxLookup(incoming.p_type, state, Array( val with_data = MuxLookup(incoming.p_type, P_REP_INVALIDATE_DATA, Array(
probeInvalidate -> P_REP_INVALIDATE_DATA, probeInvalidate -> P_REP_INVALIDATE_DATA,
probeDowngrade -> P_REP_DOWNGRADE_DATA, probeDowngrade -> P_REP_DOWNGRADE_DATA,
probeCopy -> P_REP_COPY_DATA probeCopy -> P_REP_COPY_DATA
)) ))
val without_data = MuxLookup(incoming.p_type, state, Array( val without_data = MuxLookup(incoming.p_type, P_REP_INVALIDATE_ACK, Array(
probeInvalidate -> P_REP_INVALIDATE_ACK, probeInvalidate -> P_REP_INVALIDATE_ACK,
probeDowngrade -> P_REP_DOWNGRADE_ACK, probeDowngrade -> P_REP_DOWNGRADE_ACK,
probeCopy -> P_REP_COPY_ACK probeCopy -> P_REP_COPY_ACK
@ -369,12 +369,13 @@ class XactTracker(ntiles: Int, id: Int) extends Component with FourStateCoherenc
x_init_data_needs_write := transactionInitHasData(io.alloc_req.bits.xact_init) x_init_data_needs_write := transactionInitHasData(io.alloc_req.bits.xact_init)
x_needs_read := needsMemRead(io.alloc_req.bits.xact_init.t_type, UFix(0)) x_needs_read := needsMemRead(io.alloc_req.bits.xact_init.t_type, UFix(0))
if(ntiles > 1) p_rep_count := UFix(ntiles-1) if(ntiles > 1) p_rep_count := UFix(ntiles-1)
p_req_flags := ~( UFix(1) << io.alloc_req.bits.tile_id ) //TODO: Broadcast only val p_req_initial_flags = ~( UFix(1) << io.alloc_req.bits.tile_id ) //TODO: Broadcast only
p_req_flags := p_req_initial_flags
mem_cnt := UFix(0) mem_cnt := UFix(0)
p_w_mem_cmd_sent := Bool(false) p_w_mem_cmd_sent := Bool(false)
x_w_mem_cmd_sent := Bool(false) x_w_mem_cmd_sent := Bool(false)
io.pop_x_init := UFix(1) << io.alloc_req.bits.tile_id io.pop_x_init := UFix(1) << io.alloc_req.bits.tile_id
state := Mux(p_req_flags.orR, s_probe, s_mem) state := Mux(p_req_initial_flags.orR, s_probe, s_mem)
} }
} }
is(s_probe) { is(s_probe) {
@ -389,7 +390,7 @@ class XactTracker(ntiles: Int, id: Int) extends Component with FourStateCoherenc
val p_rep_count_next = p_rep_count - PopCount(io.p_rep_cnt_dec) val p_rep_count_next = p_rep_count - PopCount(io.p_rep_cnt_dec)
io.pop_p_rep := io.p_rep_cnt_dec io.pop_p_rep := io.p_rep_cnt_dec
if(ntiles > 1) p_rep_count := p_rep_count_next if(ntiles > 1) p_rep_count := p_rep_count_next
when(p_rep_count === UFix(0)) { when(p_rep_count === UFix(1)) {
io.pop_p_rep := Bool(true) io.pop_p_rep := Bool(true)
state := s_mem state := s_mem
} }
@ -529,8 +530,8 @@ class CoherenceHubBroadcast(ntiles: Int) extends CoherenceHub(ntiles) with FourS
} }
} }
val p_rep_data_dep_list = List.fill(ntiles)((new queue(NGLOBAL_XACTS, true)){new TrackerDependency}) // depth must >= NPRIMARY val p_rep_data_dep_list = List.fill(ntiles)((new queue(NGLOBAL_XACTS)){new TrackerDependency}) // depth must >= NPRIMARY
val x_init_data_dep_list = List.fill(ntiles)((new queue(NGLOBAL_XACTS, true)){new TrackerDependency}) // depth should >= NPRIMARY val x_init_data_dep_list = List.fill(ntiles)((new queue(NGLOBAL_XACTS)){new TrackerDependency}) // depth should >= NPRIMARY
// Free finished transactions // Free finished transactions
for( j <- 0 until ntiles ) { for( j <- 0 until ntiles ) {
@ -589,7 +590,7 @@ class CoherenceHubBroadcast(ntiles: Int) extends CoherenceHub(ntiles) with FourS
val idx = p_rep.bits.global_xact_id val idx = p_rep.bits.global_xact_id
val pop_p_reps = trackerList.map(_.io.pop_p_rep(j).toBool) val pop_p_reps = trackerList.map(_.io.pop_p_rep(j).toBool)
val do_pop = foldR(pop_p_reps)(_ || _) val do_pop = foldR(pop_p_reps)(_ || _)
p_rep.ready := do_pop p_rep.ready := Bool(true)
p_rep_data_dep_list(j).io.enq.valid := do_pop p_rep_data_dep_list(j).io.enq.valid := do_pop
p_rep_data_dep_list(j).io.enq.bits.global_xact_id := OHToUFix(pop_p_reps) p_rep_data_dep_list(j).io.enq.bits.global_xact_id := OHToUFix(pop_p_reps)
p_rep_data.ready := foldR(trackerList.map(_.io.pop_p_rep_data(j)))(_ || _) p_rep_data.ready := foldR(trackerList.map(_.io.pop_p_rep_data(j)))(_ || _)

View File

@ -160,7 +160,7 @@ class rocketHTIF(w: Int, ncores: Int) extends Component with FourStateCoherence
io.mem.xact_finish.valid := (state === state_mem_finish) && mem_needs_ack io.mem.xact_finish.valid := (state === state_mem_finish) && mem_needs_ack
io.mem.xact_finish.bits.global_xact_id := mem_gxid io.mem.xact_finish.bits.global_xact_id := mem_gxid
val probe_q = (new queue(1, pipe=true)) { new TransactionReply } val probe_q = (new queue(1)) { new ProbeReply }
probe_q.io.enq.valid := io.mem.probe_req.valid probe_q.io.enq.valid := io.mem.probe_req.valid
io.mem.probe_req.ready := probe_q.io.enq.ready io.mem.probe_req.ready := probe_q.io.enq.ready
probe_q.io.enq.bits := newProbeReply(io.mem.probe_req.bits, newStateOnFlush()) probe_q.io.enq.bits := newProbeReply(io.mem.probe_req.bits, newStateOnFlush())