ISARef Multi-ISA & Silicon Reference
45,419 ISA items · 105,907 timings · 1,823 microarchs · 16,083 chips · 105 sources
Arch:
Tier:

sepc

T1 riscv register register
Supervisor Exception Program Counter
SourceRISC-V Official Unified Database (riscv-unified-db) (riscv_unified_db)
Reliability TierT1 — Official Specification
ISA / Silicon ScopeRISC-V Privileged (S)
RV32 / RV64 (Ratified & Standard Extensions)
License & VersionApache-2.0 / CC-BY-4.0
main
Upstreamhttps://github.com/riscv/riscv-unified-db
PrivilegeS
ExtensionsS

Summary

Written with the PC of an instruction on an exception or interrupt taken in (H)S-mode.

Syntax / Encoding

CSR 0x141 (S-mode, RW)

Bitfields (1)

BitsFieldDescription
63:0PCWhen a trap is taken into S-mode, sepc.PC is written with the virtual address of the instruction that was interrupted or that encountered the exception. Otherwise, sepc.PC is never written by the implementation, though it may be explicitly written by software. On an exception return from S-mode (from the SRET instruct