Browse Source

Implement SLL

master
Forest Belton 1 year ago
parent
commit
f1db6c18f2
1 changed files with 10 additions and 0 deletions
  1. +10
    -0
      src/insn.c

+ 10
- 0
src/insn.c View File

@ -89,6 +89,15 @@ void insn_sw(cpu_t *cpu, uint32_t insn) {
cpu_write32(cpu, cpu->regs[rt], imm + cpu->regs[rs]);
}
void insn_sll(cpu_t *cpu, uint32_t insn) {
const uint8_t rd = RD(insn);
const uint8_t rt = RT(insn);
const uint8_t imm5 = IMM5(insn);
debug("SLL %s, %s, %u", REG_NAMES[rd], REG_NAMES[rt], imm5);
cpu->regs[rd] = cpu->regs[rt] << imm5;
}
static cpu_insn_handler primary_insn_handler[TABLE_SIZE] = {
[LW] = insn_lw,
[ADDIU] = insn_addiu,
@ -96,6 +105,7 @@ static cpu_insn_handler primary_insn_handler[TABLE_SIZE] = {
};
static cpu_insn_handler secondary_insn_handler[TABLE_SIZE] = {
[SLL] = insn_sll,
[ADDU] = insn_addu,
[SRL] = insn_srl,
};

Loading…
Cancel
Save