CSR: SSTATUS=MSTATUS

master
vhaudiquet 1 year ago
parent 2d33e50074
commit 6330104873
  1. 11
      src/cpu/csr.c

@ -7,7 +7,8 @@ uint32_t csr_read(struct RV32_CPU* cpu, uint32_t csr)
{ {
case CSR_CYCLE: case CSR_CYCLE:
return cpu->sim_ticks_done; return cpu->sim_ticks_done;
break; case CSR_SSTATUS:
return csr_read(cpu, CSR_MSTATUS);
default: default:
break; break;
} }
@ -17,5 +18,13 @@ uint32_t csr_read(struct RV32_CPU* cpu, uint32_t csr)
void csr_write(struct RV32_CPU* cpu, uint32_t csr, uint32_t value) void csr_write(struct RV32_CPU* cpu, uint32_t csr, uint32_t value)
{ {
switch(csr)
{
case CSR_SSTATUS:
csr_write(cpu, CSR_MSTATUS, value);
return;
default:
break;
}
cpu->csr[csr] = value; cpu->csr[csr] = value;
} }

Loading…
Cancel
Save