Added CSRRWI support

This commit is contained in:
vhaudiquet 2023-10-11 21:58:44 +02:00
parent 7fbfae1081
commit 9742c89270

View File

@ -559,7 +559,10 @@ static void cpu_execute(rv32_cpu_t* cpu, instruction_t* instruction)
fprintf(stderr, "CSRRC\n");
break;
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;
case FUNC3_CSRRSI:
fprintf(stderr, "CSRRSI\n");