Added CSRRWI support

master
vhaudiquet 1 year ago
parent 7fbfae1081
commit 9742c89270
  1. 5
      src/cpu/rv32cpu.c

@ -559,7 +559,10 @@ static void cpu_execute(rv32_cpu_t* cpu, instruction_t* instruction)
fprintf(stderr, "CSRRC\n"); fprintf(stderr, "CSRRC\n");
break; break;
case FUNC3_CSRRWI: case FUNC3_CSRRWI:
fprintf(stderr, "CSRRWI\n"); // CSR atomic Read/Write Immediate (immediate in rs1)
uint32_t csrrwi_old_value = cpu->csr[instruction->immediate];
cpu->csr[instruction->immediate] = instruction->rs1;
cpu->regs.x[instruction->rd] = csrrwi_old_value;
break; break;
case FUNC3_CSRRSI: case FUNC3_CSRRSI:
fprintf(stderr, "CSRRSI\n"); fprintf(stderr, "CSRRSI\n");

Loading…
Cancel
Save