bug fixes
This commit is contained in:
parent
adc30178ab
commit
3f7ecfa9df
|
@ -169,7 +169,7 @@ bool CPU::process_base_instruction(Instruction &inst) {
|
||||||
exec->LB(inst);
|
exec->LB(inst);
|
||||||
break;
|
break;
|
||||||
case OP_LH:
|
case OP_LH:
|
||||||
exec->LB(inst);
|
exec->LH(inst);
|
||||||
break;
|
break;
|
||||||
case OP_LW:
|
case OP_LW:
|
||||||
exec->LW(inst);
|
exec->LW(inst);
|
||||||
|
|
|
@ -103,7 +103,6 @@ void Execute::BEQ(Instruction &inst) {
|
||||||
if (regs->getValue(rs1) == regs->getValue(rs2)) {
|
if (regs->getValue(rs1) == regs->getValue(rs2)) {
|
||||||
new_pc = regs->getPC() + inst.get_imm_B();
|
new_pc = regs->getPC() + inst.get_imm_B();
|
||||||
regs->setPC(new_pc);
|
regs->setPC(new_pc);
|
||||||
std::cout << "HERE new_pc" << new_pc << std::endl;
|
|
||||||
} else {
|
} else {
|
||||||
regs->incPC();
|
regs->incPC();
|
||||||
new_pc = regs->getPC();
|
new_pc = regs->getPC();
|
||||||
|
@ -187,7 +186,7 @@ void Execute::BLTU(Instruction &inst) {
|
||||||
rs1 = inst.get_rs1();
|
rs1 = inst.get_rs1();
|
||||||
rs2 = inst.get_rs2();
|
rs2 = inst.get_rs2();
|
||||||
|
|
||||||
if (regs->getValue(rs1) < regs->getValue(rs2)) {
|
if ((uint32_t) regs->getValue(rs1) < (uint32_t) regs->getValue(rs2)) {
|
||||||
new_pc = regs->getPC() + inst.get_imm_B();
|
new_pc = regs->getPC() + inst.get_imm_B();
|
||||||
regs->setPC(new_pc);
|
regs->setPC(new_pc);
|
||||||
} else {
|
} else {
|
||||||
|
@ -208,7 +207,7 @@ void Execute::BGEU(Instruction &inst) {
|
||||||
rs1 = inst.get_rs1();
|
rs1 = inst.get_rs1();
|
||||||
rs2 = inst.get_rs2();
|
rs2 = inst.get_rs2();
|
||||||
|
|
||||||
if (regs->getValue(rs1) >= regs->getValue(rs2)) {
|
if ((uint32_t) regs->getValue(rs1) >= (uint32_t) regs->getValue(rs2)) {
|
||||||
new_pc = regs->getPC() + inst.get_imm_B();
|
new_pc = regs->getPC() + inst.get_imm_B();
|
||||||
regs->setPC(new_pc);
|
regs->setPC(new_pc);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue