cm.jalt
Jump Via Table with Optional Link
Read an address from the Jump Vector Table and jump to it, linking to ra.
Execution
check_zcmt_enabled($encoding);
if (CSR[jvt].MODE != 0) {
raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
}
XReg return_addr = $pc + 2;
X[1] = return_addr;
XReg jump_table_base = {CSR[jvt].BASE, 6'b000000};
XReg virtual_address = jump_table_base + index `* (xlen() / 8);
XReg addr;
TranslationResult result;
if (CSR[misa].S == 1) {
result = translate(virtual_address, MemoryOperation::Fetch, mode(), $encoding);
} else {
result.paddr = virtual_address;
}
access_check(result.paddr, xlen(), $pc, MemoryOperation::Fetch, ExceptionCode::InstructionAccessFault, mode());
if (xlen() == 32) {
addr = read_physical_memory(32, result.paddr);
} else {
addr = read_physical_memory(64, result.paddr);
}
addr = addr & $signed(2'b10);
jump(addr);
Exceptions
This instruction may result in the following synchronous exceptions:
-
IllegalInstruction
-
InstructionAccessFault
-
InstructionAddressMisaligned
-
InstructionPageFault
-
LoadAccessFault
-
VirtualInstruction