Skip to content

Commit

Permalink
ifu: fix mmioFlushWb condition when backend redirect (#2704)
Browse files Browse the repository at this point in the history
  • Loading branch information
eastonman authored Feb 22, 2024
1 parent 13156de commit 8abe181
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main/scala/xiangshan/frontend/IFU.scala
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,8 @@ class NewIFU(implicit p: Parameters) extends XSModule
}
}

//exception or flush by older branch prediction
// Exception or flush by older branch prediction
// Condition is from RegNext(fromFtq.redirect), 1 cycle after backend rediect
when(f3_ftq_flush_self || f3_ftq_flush_by_older) {
mmio_state := m_idle
mmio_is_RVC := false.B
Expand Down Expand Up @@ -748,7 +749,11 @@ class NewIFU(implicit p: Parameters) extends XSModule
f3_mmio_missOffset.valid := f3_req_is_mmio
f3_mmio_missOffset.bits := 0.U

mmioFlushWb.valid := (f3_req_is_mmio && mmio_state === m_waitCommit && RegNext(fromUncache.fire) && f3_mmio_use_seq_pc)
// Send mmioFlushWb back to FTQ 1 cycle after uncache fetch return
// When backend redirect, mmio_state reset after 1 cycle.
// In this case, mask .valid to avoid overriding backend redirect
mmioFlushWb.valid := (f3_req_is_mmio && mmio_state === m_waitCommit && RegNext(fromUncache.fire) &&
f3_mmio_use_seq_pc && !f3_ftq_flush_self && !f3_ftq_flush_by_older)
mmioFlushWb.bits.pc := f3_pc
mmioFlushWb.bits.pd := f3_pd
mmioFlushWb.bits.pd.zipWithIndex.map{case(instr,i) => instr.valid := f3_mmio_range(i)}
Expand Down

0 comments on commit 8abe181

Please sign in to comment.