← Home

vsepc

Virtual Supervisor Exception Program Counter

Address: 0x241 (577) · Privilege: VS · Length: VSXLEN · Writable · Defined by: H · Virtual address: 321

Written with the PC of an instruction on an exception or interrupt taken in VS-mode.

Also controls where the hart jumps on an exception return from VS-mode.

Fields

RV32

31:2423:1615:87:0
PC

RV64

63:5655:4847:4039:3231:2423:1615:87:0
PC
BitsFieldAliasDescriptionTypeReset
RV32 [31:0]
RV64 [63:0]
PCWhen a trap is taken into VS-mode, `vsepc.PC` is written with the virtual address of the instruction that was interrupted or that encountered the exception. Otherwise, `vsepc.PC` is never written by the implementation, though it may be explicitly written by software. On an exception return from VS-mode (from the SRET instruction), control transfers to the virtual address read out of `vsepc.PC`. Because PCs are always halfwordword-aligned, bit 0bits 1:0 of `vsepc.PC` are always read-only 0. When `misa.C` is clear, bit 1 is masked to zero. Writes to bit 1 are still captured, and may be visible on the next read with `misa.C` is set. Holds bits [VSXLEN-1:] of the virtual address associated with an exception.RW-RHUNDEFINED_LEGAL

Software read

if (implemented?(ExtensionName::C) && CSR[misa].C == 1'b1) {
  return CSR[vsepc].PC & ~64'b1;
} else {
  return CSR[vsepc].PC;
}

Version af3eaf9+cheriot.f635218

Data from the RISC-V Unified Database, copyright RISC-V International and contributors.

CHERIoT extensions from the CHERIoT specification and Sail model, copyright Microsoft and the CHERIoT Platform contributors.

This site is provided as a community resource and is NOT affiliated with nor endorsed by RISC-V International.