修复jalr指令跳转目标问题
This commit is contained in:
parent
4f32948d0b
commit
be93752841
|
@ -32,13 +32,13 @@ class Bru extends Module {
|
|||
BRUOpType.getBranchType(BRUOpType.blt) -> slt,
|
||||
BRUOpType.getBranchType(BRUOpType.bltu) -> sltu
|
||||
)
|
||||
io.out.branch := valid &
|
||||
(LookupTree(BRUOpType.getBranchType(op), table) ^ BRUOpType.isBranchInvert(op) |
|
||||
BRUOpType.isJump(op))
|
||||
io.out.target := Mux1H(
|
||||
Seq(
|
||||
(io.out.branch) -> (io.in.pc + io.in.info.imm),
|
||||
(op === BRUOpType.jalr) -> ((src1 + src2) & ~1.U(XLEN.W))
|
||||
)
|
||||
)
|
||||
|
||||
val is_jump = BRUOpType.isJump(op)
|
||||
val is_branch = (LookupTree(BRUOpType.getBranchType(op), table) ^ BRUOpType.isBranchInvert(op))
|
||||
|
||||
val is_jalr = op === BRUOpType.jalr
|
||||
|
||||
io.out.branch := valid & (is_jump | is_branch)
|
||||
io.out.target := Mux(is_jalr, ((src1 + src2) & ~1.U(XLEN.W)), (io.in.pc + io.in.info.imm))
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue