fixed bgeu, bltu and bge in RV32I

float_support
Anton Lydike 4 years ago
parent 07f097202d
commit 7f3fb9b141

@ -226,26 +226,26 @@ class RV32I(InstructionSet):
def instruction_bge(self, ins: 'LoadedInstruction'):
ASSERT_LEN(ins.args, 3)
reg1 = ins.get_reg(0)
reg2 = ins.get_reg(1)
dest = ins.get_imm(2)
if self.regs.get(reg1) >= self.regs.get(reg2):
reg1 = self.get_reg(ins, 0)
reg2 = self.get_reg(ins, 1)
dest = self.get_reg(ins, 2)
if reg1 >= reg2:
self.pc = dest
def instruction_bltu(self, ins: 'LoadedInstruction'):
ASSERT_LEN(ins.args, 3)
reg1 = to_unsigned(ins.get_reg(0))
reg2 = to_unsigned(ins.get_reg(1))
reg1 = self.get_reg(ins, 0)
reg2 = self.get_reg(ins, 1)
dest = ins.get_imm(2)
if self.regs.get(reg1) < self.regs.get(reg2):
if to_unsigned(reg1) < to_unsigned(reg2):
self.pc = dest
def instruction_bgeu(self, ins: 'LoadedInstruction'):
ASSERT_LEN(ins.args, 3)
reg1 = to_unsigned(ins.get_reg(0))
reg2 = to_unsigned(ins.get_reg(1))
reg1 = to_unsigned(self.get_reg(ins, 0))
reg2 = to_unsigned(self.get_reg(ins, 1))
dest = ins.get_imm(2)
if self.regs.get(reg1) >= self.regs.get(reg2):
if reg1 >= reg2:
self.pc = dest
# technically deprecated
@ -292,3 +292,6 @@ class RV32I(InstructionSet):
def instruction_nop(self, ins: 'LoadedInstruction'):
pass
def get_reg(self, ins: 'LoadedInstruction', ind: int):
return self.regs.get(ins.get_reg(ind))

Loading…
Cancel
Save