bug fixes

This commit is contained in:
mariusmonton 2018-11-14 23:50:01 +01:00
parent adc30178ab
commit 3f7ecfa9df
2 changed files with 3 additions and 4 deletions

View File

@ -169,7 +169,7 @@ bool CPU::process_base_instruction(Instruction &inst) {
exec->LB(inst);
break;
case OP_LH:
exec->LB(inst);
exec->LH(inst);
break;
case OP_LW:
exec->LW(inst);

View File

@ -103,7 +103,6 @@ void Execute::BEQ(Instruction &inst) {
if (regs->getValue(rs1) == regs->getValue(rs2)) {
new_pc = regs->getPC() + inst.get_imm_B();
regs->setPC(new_pc);
std::cout << "HERE new_pc" << new_pc << std::endl;
} else {
regs->incPC();
new_pc = regs->getPC();
@ -187,7 +186,7 @@ void Execute::BLTU(Instruction &inst) {
rs1 = inst.get_rs1();
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();
regs->setPC(new_pc);
} else {
@ -208,7 +207,7 @@ void Execute::BGEU(Instruction &inst) {
rs1 = inst.get_rs1();
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();
regs->setPC(new_pc);
} else {