Added CSRRC/CSRRCI
This commit is contained in:
parent
c404defb42
commit
6c5e3fcc32
@ -556,7 +556,9 @@ static void cpu_execute(rv32_cpu_t* cpu, instruction_t* instruction)
|
|||||||
cpu->csr[instruction->immediate] |= cpu->regs.x[instruction->rs1];
|
cpu->csr[instruction->immediate] |= cpu->regs.x[instruction->rs1];
|
||||||
break;
|
break;
|
||||||
case FUNC3_CSRRC:
|
case FUNC3_CSRRC:
|
||||||
fprintf(stderr, "CSRRC\n");
|
// CSR atomic Read and Clear bits
|
||||||
|
cpu->regs.x[instruction->rd] = cpu->csr[instruction->immediate];
|
||||||
|
cpu->csr[instruction->immediate] &= (~cpu->regs.x[instruction->rs1]);
|
||||||
break;
|
break;
|
||||||
case FUNC3_CSRRWI:
|
case FUNC3_CSRRWI:
|
||||||
// CSR atomic Read/Write Immediate (immediate in rs1)
|
// CSR atomic Read/Write Immediate (immediate in rs1)
|
||||||
@ -568,7 +570,9 @@ static void cpu_execute(rv32_cpu_t* cpu, instruction_t* instruction)
|
|||||||
fprintf(stderr, "CSRRSI\n");
|
fprintf(stderr, "CSRRSI\n");
|
||||||
break;
|
break;
|
||||||
case FUNC3_CSRRCI:
|
case FUNC3_CSRRCI:
|
||||||
fprintf(stderr, "CSRRCI\n");
|
// CSR atomic Read and Clear bits Immediate (immediate in rs1)
|
||||||
|
cpu->regs.x[instruction->rd] = cpu->csr[instruction->immediate];
|
||||||
|
cpu->csr[instruction->immediate] &= (~((uint32_t) instruction->rs1));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "FATAL: Unknown func3 0x%x for SYSTEM instruction while executing\n", instruction->func3);
|
fprintf(stderr, "FATAL: Unknown func3 0x%x for SYSTEM instruction while executing\n", instruction->func3);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user