Skip to content

Commit

Permalink
update PSEMU/CPU.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Cherrytree56567 committed Oct 17, 2023
1 parent 1f8eeec commit 84736de
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions PSEMU/CPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ void CPU::decode_execute(Instruction instruction) {
std::cout << "[CPU] INFO: SRA (R-Type)\n";
break;

case (0b011010):
op_div(instruction);
std::cout << "[CPU] INFO: DIV (R-Type)\n";
break;

default:
std::cout << "[CPU] ERROR: Unhandled Function Instruction \n";
exit(0);
Expand Down Expand Up @@ -684,8 +689,8 @@ void CPU::op_div(Instruction instruction) {
uint32_t s = instruction.rs();
uint32_t t = instruction.rt();

uint32_t n = reg[s];
uint32_t d = reg[t];
uint32_t n = regs[s];
uint32_t d = regs[t];

if (d == 0) {
// Division by zero, results are bogus
Expand Down

0 comments on commit 84736de

Please sign in to comment.