diff --git a/chisel/playground/src/pipeline/execute/fu/Bru.scala b/chisel/playground/src/pipeline/execute/fu/Bru.scala index 664dedf..4a23302 100644 --- a/chisel/playground/src/pipeline/execute/fu/Bru.scala +++ b/chisel/playground/src/pipeline/execute/fu/Bru.scala @@ -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)) + }