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

mtvec

T1 riscv register register
Machine Trap Vector Control
SourceRISC-V Official Unified Database (riscv-unified-db) (riscv_unified_db)
Reliability TierT1 — Official Specification
ISA / Silicon ScopeRISC-V Privileged (Sm)
RV32 / RV64 (Ratified & Standard Extensions)
License & VersionApache-2.0 / CC-BY-4.0
main
Upstreamhttps://github.com/riscv/riscv-unified-db
PrivilegeM
ExtensionsSm

Summary

Controls where traps jump.

Syntax / Encoding

CSR 0x305 (M-mode, RW)

Bitfields (2)

BitsFieldDescription
63:2BASEBits [MXLEN-1:2] of the exception vector physical address for any trap taken in M-mode. The implementation physical memory map may resitrict which values are legal in this field. The address must be aligned to MTVEC_BASE_ALIGNMENT_DIRECT bytes when mtvec.MODE is Direct, and to MTVEC_BASE_ALIGNMENT_VECTORED bytes when
1:0MODEVectoring mode for asynchronous interrupts. 0 - Direct, 1 - Vectored When Direct, all synchronous exceptions and asynchronous interrupts jump to (mtvec.BASE << 2). When Vectored, asynchronous interrupts jump to (mtvec.BASE << 2 + mcause.CODE*4) while synchronous exceptions continue to jump to (mtvec.BASE << 2).