c.j
Jump
- Extension
- C
- XLEN
- RV32 and RV64
- Assembly (riscv-unified-db)
c.j imm- Length
- 16-bit (compressed)
Encoding
| 1513 | 122 | 10 | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 101 | imm[11|4|9:8|10|6|7|3:1|5] | 01 | |||||||||||||
Match 0xa001, mask 0xe003. Source: c.j c_imm12 1..0=1 15..13=5 in riscv-opcodes/extensions/rv_c.
| Field | Bits | riscv-opcodes name |
|---|---|---|
| imm[11|4|9:8|10|6|7|3:1|5] | 12:2 | c_imm12 |
Description
C.J performs an unconditional control transfer. The offset is sign-extended and added to the pc to form the jump target address. C.J can therefore target a ±2 KiB range.
It expands to jal x0, offset.
Description from riscv-unified-db, reformatted.
Operation
if (implemented?(ExtensionName::C) && MISA_CSR_IMPLEMENTED && (CSR[misa].C == 1'b0)) {
reserved_instruction($encoding);
}
jump($pc + $signed(imm));Pseudocode in riscv-unified-db’s IDL, quoted unchanged.