From be937528412884193676ed9590cd5d98dc96a784 Mon Sep 17 00:00:00 2001 From: Liphen Date: Wed, 8 May 2024 20:44:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Djalr=E6=8C=87=E4=BB=A4?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E7=9B=AE=E6=A0=87=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pipeline/execute/fu/Bru.scala | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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)) + }