cm.jalt

Jump Via Table with Optional Link

Read an address from the Jump Vector Table and jump to it, linking to ra.

Assembly format

cm.jalt index

Decode Variables

Bits<8> index = $encoding[9:2];

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

Encoding

svg

Defining extension

Access

M

Always

Containing profiles

  • Mandatory: RVA20S64, RVA20U64, RVA22S64, RVA22U64, RVA23S64, RVA23U64, RVB23S64, RVB23U64

  • Optional: RVA20S64, RVA20U64, RVA22S64, RVA22U64, RVA23S64, RVA23U64, RVB23S64, RVB23U64, RVI20U32, RVI20U64