Skip to content

rv csrs

Maximillian Sonderegger edited this page Jan 4, 2024 · 1 revision

Unprivileged Floating-Point CSRs

Number Privilege Name Description
0x001 URW fflags Floating-Point Accrued Exceptions.
0x002 URW frm Floating-Point Dynamic Rounding Mode.
0x003 URW fcsr Floating-Point Control and Status Register (frm + fflags).

Unprivileged Counter/Timers

Number Privilege Name Description
0xC00 URO cycle Cycle counter for RDCYCLE instruction.
0xC01 URO time Timer for RDTIME instruction.
0xC02 URO instret Instructions-retired counter for RDINSTRET instruction.
0xC03 URO hpmcounter3 Performance-monitoring counter.
0xC04 URO hpmcounter4 Performance-monitoring counter.
... ... ... ...
0xC1F URO hpmcounter31 Performance-monitoring counter.
0xC80 URO cycleh Upper 32 bits of cycle, RV32 only.
0xC81 URO timeh Upper 32 bits of time, RV32 only.
0xC82 URO instreth Upper 32 bits of instret, RV32 only.
0xC83 URO hpmcounter3h Upper 32 bits of hpmcounter3, RV32 only.
0xC84 URO hpmcounter4h Upper 32 bits of hpmcounter4, RV32 only.
... ... ... ...
0xC9F URO hpmcounter31h Upper 32 bits of hpmcounter31, RV32 only.

Supervisor Trap Setup

Number Privilege Name Description
0x100 SRW sstatus Supervisor status register.
0x104 SRW sie Supervisor interrupt-enable register.
0x105 SRW stvec Supervisor trap handler base address.
0x106 SRW scounteren Supervisor counter enable.

Supervisor Configuration

Number Privilege Name Description
0x10A SRW senvcfg Supervisor environment configuration register.

Supervisor Trap Handling

Number Privilege Name Description
0x140 SRW sscratch Scratch register for supervisor trap handlers.
0x141 SRW sepc Supervisor exception program counter.
0x142 SRW scause Supervisor trap cause.
0x143 SRW stval Supervisor bad address or instruction.
0x144 SRW sip Supervisor interrupt pending.

Supervisor Protection and Translation

Number Privilege Name Description
0x180 SRW satp Supervisor address translation and protection.

Debug/Trace Registers

Number Privilege Name Description
0x5A8 SRW scontext Supervisor-mode context register.

Hypervisor Trap Setup

Number Privilege Name Description
0x600 HRW hstatus Hypervisor status register.
0x602 HRW hedeleg Hypervisor exception delegation register.
0x603 HRW hideleg Hypervisor interrupt delegation register.
0x604 HRW hie Hypervisor interrupt-enable register.
0x606 HRW hcounteren Hypervisor counter enable.
0x607 HRW hgeie Hypervisor guest external interrupt-enable register.

Hypervisor Trap Handling

Number Privilege Name Description
0x643 HRW htval Hypervisor bad guest physical address.
0x644 HRW hip Hypervisor interrupt pending.
0x645 HRW hvip Hypervisor virtual interrupt pending.
0x64A HRW htinst Hypervisor trap instruction (transformed).
0xE12 HRO hgeip Hypervisor guest external interrupt pending.

Hypervisor Configuration

Number Privilege Name Description
0x60A HRW henvcfg Hypervisor environment configuration register.
0x61A HRW henvcfgh Additional hypervisor env. conf. register, RV32 only.

Hypervisor Protection and Translation

Number Privilege Name Description
0x680 HRW hgatp Hypervisor guest address translation and protection.

Debug/Trace Registers

Number Privilege Name Description
0x6A8 HRW hcontext Hypervisor-mode context register.

Hypervisor Counter/Timer Virtualization Registers

Number Privilege Name Description
0x605 HRW htimedelta Delta for VS/VU-mode timer.
0x615 HRW htimedeltah Upper 32 bits of htimedelta, HSXLEN=32 only.

Virtual Supervisor Registers

Number Privilege Name Description
0x200 HRW vsstatus Virtual supervisor status register.
0x204 HRW vsie Virtual supervisor interrupt-enable register.
0x205 HRW vstvec Virtual supervisor trap handler base address.
0x240 HRW vsscratch Virtual supervisor scratch register.
0x241 HRW vsepc Virtual supervisor exception program counter.
0x242 HRW vscause Virtual supervisor trap cause.
0x243 HRW vstval Virtual supervisor bad address or instruction.
0x244 HRW vsip Virtual supervisor interrupt pending.
0x280 HRW vsatp Virtual supervisor address translation and protection.

Machine Information Registers

Number Privilege Name Description
0xF11 MRO mvendorid Vendor ID.
0xF12 MRO marchid Architecture ID.
0xF13 MRO mimpid Implementation ID.
0xF14 MRO mhartid Hardware thread ID.
0xF15 MRO mconfigptr Pointer to configuration data structure.

Machine Trap Setup

Number Privilege Name Description
0x300 MRW mstatus Machine status register.
0x301 MRW misa ISA and extensions.
0x302 MRW medeleg Machine exception delegation register.
0x303 MRW mideleg Machine interrupt delegation register.
0x304 MRW mie Machine interrupt-enable register.
0x305 MRW mtvec Machine trap-handler base address.
0x306 MRW mcounteren Machine counter enable.
0x310 MRW mstatush Additional machine status register, RV32 only.

Machine Trap Handling

Number Privilege Name Description
0x340 MRW mscratch Scratch register for machine trap handlers.
0x341 MRW mepc Machine exception program counter.
0x342 MRW mcause Machine trap cause.
0x343 MRW mtval Machine bad address or instruction.
0x34A MRW mip Machine interrupt pending.
0x344 MRW mtinst Machine trap instruction (transformed).
0x34B MRW mtval2 Machine bad guest physical address.

Machine Configuration

Number Privilege Name Description
0x30A MRW menvcfg Machine environment configuration register.
0x31A MRW menvcfgh Additional machine env. conf. register, RV32 only.
0x747 MRW mseccfg Machine security configuration register.
0x757 MRW mseccfgh Additional machine security conf. register, RV32 only.

Machine Memory Protection

Number Privilege Name Description
0x3A0 MRW pmpcfg0 Physical memory protection configuration.
0x3A1 MRW pmpcfg1 Physical memory protection configuration, RV32 only.
0x3A2 MRW pmpcfg2 Physical memory protection configuration.
0x3A3 MRW pmpcfg3 Physical memory protection configuration, RV32 only.
... ... ... ...
0x3AE MRW pmpcfg14 Physical memory protection configuration.
0x3AF MRW pmpcfg15 Physical memory protection configuration, RV32 only.
0x3B0 MRW pmpaddr0 Physical memory protection address register.
0x3B1 MRW pmpaddr1 Physical memory protection address register.
... ... ... ...
0x3EF MRW pmpaddr63 Physical memory protection address register.

Machine Counter/Timers

Number Privilege Name Description
0xB00 MRW mcycle Machine cycle counter.
0xB02 MRW minstret Machine instructions-retired counter.
0xB03 MRW mhpmcounter3 Machine performance-monitoring counter.
0xB04 MRW mhpmcounter4 Machine performance-monitoring counter.
... ... ... ...
0xB1F MRW mhpmcounter31 Machine performance-monitoring counter.
0xB80 MRW mcycleh Upper 32 bits of mcycle, RV32 only.
0xB82 MRW minstreth Upper 32 bits of minstret, RV32 only.
0xB83 MRW mhpmcounter3h Upper 32 bits of mhpmcounter3, RV32 only.
0xB84 MRW mhpmcounter4h Upper 32 bits of mhpmcounter4, RV32 only.
... ... ... ...
0xB9F MRW mhpmcounter31h Upper 32 bits of mhpmcounter31, RV32 only.

Machine Counter Setup

Number Privilege Name Description
0x320 MRW mcountinhibit Machine counter-inhibit register.
0x323 MRW mhpmevent3 Machine performance-monitoring event selector.
0x324 MRW mhpmevent4 Machine performance-monitoring event selector.
... ... ... ...
0x33F MRW mhpmevent31 Machine performance-monitoring event selector.

Debug/Trace Registers (shared with Debug Mode)

Number Privilege Name Description
0x7A0 MRW tselect Debug/Trace trigger register select.
0x7A1 MRW tdata1 First Debug/Trace trigger data register.
0x7A2 MRW tdata2 Second Debug/Trace trigger data register.
0x7A3 MRW tdata3 Third Debug/Trace trigger data register.
0x7A8 MRW mcontext Machine-mode context register.

Debug Mode Registers

Number Privilege Name Description
0x7B0 DRW dcsr Debug control and status register.
0x7B1 DRW dpc Debug PC.
0x7B2 DRW dscratch0 Debug scratch register 0.
0x7B3 DRW dscratch1 Debug scratch register 1.