Does rs1=ra overwrite the target first?
No. The target uses old ra before the link write. With old ra=0x2001 and PC=0x1000, the result is PC=0x2000 and ra=0x1002.
RV32/RV64: target is old x[rs1] with bit 0 cleared; x1=PC+2. The rs1=x0 encoding is C.EBREAK.
C.JALR is a 16-bit CR instruction in C 2.0 / Zca. Its full five-bit rs1 field selects a valid jump source x1–x31; rs2 is fixed zero. It clears bit 0 of old x[rs1] for the target PC and separately writes old PC+2 to x1/ra, using the old source even when rs1=x1. Comparison with jalr x1, 0(rs1) must preserve the difference: 32-bit JALR links PC+4, while C.JALR links PC+2. rs1=x0 selects C.EBREAK and performs neither this jump nor link.
Connect 16-bit fields to compressed constraints, base-instruction semantics, and visible architectural state.
PC = 0x0000000000001000, x1 = 0x0000000000002001PC = 0x0000000000002000; x1 = 0x0000000000001002RV32C/RV64C / Zca; IALIGN=16; this example has no external debug override of C.EBREAK.
16-bit encoding and field roles
Visible calculation
The target clears bit 0 and the link uses the compressed 2-byte length.
Control-flow path
1001 00001 00000 10x[rs1] & ~1 -> 0x0000000000002000jalr x1, 0(x1)pc <- 0x0000000000002000; x1/ra <- 0x0000000000001002RV32/RV64: target is old x[rs1] with bit 0 cleared; x1=PC+2. The rs1=x0 encoding is C.EBREAK.
RV32/RV64, old ra=0x2001 and PC=0x1000: c.jalr ra gives PC=0x2000 and ra=0x1002; the target uses old ra.
No. The target uses old ra before the link write. With old ra=0x2001 and PC=0x1000, the result is PC=0x2000 and ra=0x1002.
No. That code point is C.EBREAK. Unless an external debug environment overrides its behavior, it raises a breakpoint exception and performs no C.JALR jump or link.