auipc && ltu bug fix
This commit is contained in:
parent
39c008567d
commit
0125e50b02
2 changed files with 2 additions and 2 deletions
|
@ -32,7 +32,7 @@ object Ops {
|
||||||
case object GE extends Comparison { def run(rs1Val: Int, rs2Val: Int): Boolean = rs1Val >= rs2Val }
|
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 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 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
|
case class Branch(rs1: Reg, rs2: Reg, dst: Label, comp: Comparison) extends Op with SType
|
||||||
object Branch{
|
object Branch{
|
||||||
|
|
|
@ -89,7 +89,7 @@ case class VM(
|
||||||
|
|
||||||
|
|
||||||
private def executeAUIPC(op: AUIPC) = {
|
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)
|
val nextVM = this.copy(regs = nextRegs)
|
||||||
Right(step(nextVM, regUpdate.toList:_*))
|
Right(step(nextVM, regUpdate.toList:_*))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue