Skip to content

Commit

Permalink
Merge pull request #2 from cyyself/Zk-chisel
Browse files Browse the repository at this point in the history
fix ALU.FN when using ABLU
  • Loading branch information
ZenithalHourlyRate authored May 16, 2022
2 parents f2cab56 + 84574f8 commit 076d041
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/scala/rocket/RocketCore.scala
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ class Rocket(tile: RocketTile)(implicit p: Parameters) extends CoreModule()(p)
val gated_clock =
if (!rocketParams.clockGate) clock
else ClockGate(clock, clock_en, "rocket_clock_gate")
val ALUClass = if (usingABLU) ABLU else ALU

@chiselName class RocketImpl extends NoChiselNamePrefix { // entering gated-clock domain

Expand All @@ -142,8 +143,8 @@ class Rocket(tile: RocketTile)(implicit p: Parameters) extends CoreModule()(p)
("jal", () => id_ctrl.jal),
("jalr", () => id_ctrl.jalr))
++ (if (!usingMulDiv) Seq() else Seq(
("mul", () => if (pipelinedMul) id_ctrl.mul else id_ctrl.div && (id_ctrl.alu_fn & ALU.FN_DIV) =/= ALU.FN_DIV),
("div", () => if (pipelinedMul) id_ctrl.div else id_ctrl.div && (id_ctrl.alu_fn & ALU.FN_DIV) === ALU.FN_DIV)))
("mul", () => if (pipelinedMul) id_ctrl.mul else id_ctrl.div && (id_ctrl.alu_fn & ALUClass.FN_DIV) =/= ALUClass.FN_DIV),
("div", () => if (pipelinedMul) id_ctrl.div else id_ctrl.div && (id_ctrl.alu_fn & ALUClass.FN_DIV) === ALUClass.FN_DIV)))
++ (if (!usingFPU) Seq() else Seq(
("fp load", () => id_ctrl.fp && io.fpu.dec.ldst && io.fpu.dec.wen),
("fp store", () => id_ctrl.fp && io.fpu.dec.ldst && !io.fpu.dec.wen),
Expand Down Expand Up @@ -496,7 +497,7 @@ class Rocket(tile: RocketTile)(implicit p: Parameters) extends CoreModule()(p)
when (id_ctrl.fence && id_fence_succ === 0) { id_reg_pause := true }
when (id_fence_next) { id_reg_fence := true }
when (id_xcpt) { // pass PC down ALU writeback pipeline for badaddr
ex_ctrl.alu_fn := ALU.FN_ADD
ex_ctrl.alu_fn := ALUClass.FN_ADD
ex_ctrl.alu_dw := DW_XPR
ex_ctrl.sel_alu1 := A1_RS1 // badaddr := instruction
ex_ctrl.sel_alu2 := A2_ZERO
Expand Down

0 comments on commit 076d041

Please sign in to comment.