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 a4f9c8a commit bae0dbb
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions PSEMU/CPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ void CPU::decode_execute(Instruction instruction) {
std::cout << "[CPU] INFO: LBU (I-Type)\n";
break;

case (0b001010):
op_slti(instruction);
std::cout << "[CPU] INFO: SLTI (I-Type)\n";
break;

default:
std::cout << "[CPU] ERROR: Unhandled Instruction \n";
exit(0);
Expand Down Expand Up @@ -633,4 +638,14 @@ void CPU::op_bxx(Instruction instruction) {
if (test != 0) {
branch(i);
}
}

fn op_slti(&mut self, instruction: Instruction) {
uint32_t i = instruction.imm_s();
uint32_t s = instruction.rs();
uint32_t t = instruction.rt();

uint32_t v = (regs[s]) < i;

set_reg(t, v);
}

0 comments on commit bae0dbb

Please sign in to comment.