提交 43c072e7 编写于 作者: Z zhanglinjuan

fix target in btb entry

上级 78142b60
......@@ -59,6 +59,7 @@ class MicroOp extends CfCtrl {
class Redirect extends XSBundle {
val pc = UInt(VAddrBits.W) // wrongly predicted pc
val target = UInt(VAddrBits.W)
val brTarget = UInt(VAddrBits.W)
val brTag = UInt(BrTagWidth.W)
val _type = UInt(2.W)
val taken = Bool()
......
......@@ -103,6 +103,7 @@ class Alu extends Exu(alu.litValue(), hasRedirect = true) {
io.out.bits.redirectValid := io.out.valid && isBru//isBranch
io.out.bits.redirect.pc := uop.cf.pc
io.out.bits.redirect.target := Mux(!taken && isBranch, pcLatchSlot, target)
io.out.bits.redirect.brTarget := target
io.out.bits.redirect.brTag := uop.brTag
io.out.bits.redirect._type := LookupTree(func, RV32I_BRUInstr.bruFuncTobtbTypeTable)
io.out.bits.redirect.taken := taken
......
......@@ -168,7 +168,7 @@ class BPU extends XSModule {
btbWrite.valid := true.B
btbWrite.tag := btbAddr.getTag(redirectLatch.pc)
btbWrite._type := redirectLatch._type
btbWrite.target := redirectLatch.target
btbWrite.target := redirectLatch.brTarget
val oldPred = PriorityMux(btbWriteWay.asTypeOf(Vec(BtbWays, Bool())), btbUpdateRead.map{ e => e.pred })
val newPred = Mux(redirectLatch.taken, Mux(oldPred === "b11".U, "b11".U, oldPred + 1.U),
Mux(oldPred === "b00".U, "b00".U, oldPred - 1.U))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册