← Home

mtvec

Machine Trap Vector Control

Address: 0x305 (773) · Privilege: M · Length: MXLEN · Writable · Defined by: Sm

Controls where traps jump.

Fields

RV32

31:2423:1615:87:0
BASEMODE

RV64

63:5655:4847:4039:3231:2423:1615:87:0
BASEMODE
BitsFieldAliasDescriptionTypeReset
RV32 [31:2]
RV64 [63:2]
BASEBits [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 `mtvec.MODE` is Vectored. A write that does not meet the alignment for the new mode is illegal, and follows `MTVEC_ILLEGAL_WRITE_BEHAVIOR`.
return MTVEC_ACCESS == "ro" ? CsrFieldType::RO : CsrFieldType::RWR;
0
[1:0]MODEVectoring 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).
if (MTVEC_ACCESS == "ro") {
  return CsrFieldType::RO;
}

return ($array_size(MTVEC_MODES) == 1) ? CsrFieldType::RO : CsrFieldType::RWR;
return ($array_size(MTVEC_MODES) == 1) ? MTVEC_MODES[0] : UNDEFINED_LEGAL;

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.