auipc && ltu bug fix

This commit is contained in:
cbezaitis 2023-10-17 16:27:41 +02:00
parent 39c008567d
commit 0125e50b02
2 changed files with 2 additions and 2 deletions

View file

@ -32,7 +32,7 @@ object Ops {
case object GE extends Comparison { def run(rs1Val: Int, rs2Val: Int): Boolean = rs1Val >= rs2Val }
case object LT extends Comparison { def run(rs1Val: Int, rs2Val: Int): Boolean = rs1Val < rs2Val }
case object GEU extends Comparison { def run(rs1Val: Int, rs2Val: Int): Boolean = !(rs1Val `u>` rs2Val) }
case object LTU extends Comparison { def run(rs1Val: Int, rs2Val: Int): Boolean = rs1Val `u>` rs2Val }
case object LTU extends Comparison { def run(rs1Val: Int, rs2Val: Int): Boolean = rs2Val `u>` rs1Val }
case class Branch(rs1: Reg, rs2: Reg, dst: Label, comp: Comparison) extends Op with SType
object Branch{

View file

@ -89,7 +89,7 @@ case class VM(
private def executeAUIPC(op: AUIPC) = {
val (regUpdate, nextRegs) = regs + (op.rd -> (pc.value << 12))
val (regUpdate, nextRegs) = regs + (op.rd -> (pc.value + (op.imm.value << 12)))
val nextVM = this.copy(regs = nextRegs)
Right(step(nextVM, regUpdate.toList:_*))
}