Does it modify sp?
No. Fixed x2/sp is the source and only rd' is written; with sp=0x1000 and offset 16, x8=0x1010.
RV32/RV64: add a nonzero byte offset (4–1020, multiples of four) to sp and write x8–x15; sp is unchanged.
C.ADDI4SPN is a 16-bit CIW instruction in C 2.0 / Zca. It reads fixed x2/sp, adds the zero-extended byte offset nzuimm, and writes rd' (x8–x15). The assembly offset is already in bytes, so do not multiply it by four again; the eight encoded bits represent nzuimm[9:2], with two zero low bits. Keep the low XLEN bits, as in addi rd', x2, nzuimm. nzuimm=0 is reserved; sp is unchanged.
Connect 16-bit fields to compressed constraints, base-instruction semantics, and visible architectural state.
sp = 0x0000000000001000, offset = 16x8 = 0x0000000000001010RV32C/RV64C / Zca; IALIGN=16
16-bit encoding and field roles
Visible calculation
Fixed x2 is the input base; rd' is the sole writeback target.
Field reconstruction and address generation
rd' -> x8 (x8-x15)nzuimm[9:2] = 00000100; low bits = 00addi x8, x2, 16x8 <- 0x0000000000001010RV32/RV64: add a nonzero byte offset (4–1020, multiples of four) to sp and write x8–x15; sp is unchanged.
RV32/RV64, sp=0x1000: c.addi4spn x8, 16 gives x8=0x1010, leaving sp unchanged; 16 is already the byte offset.
RV32/RV64, sp=0x1000: c.addi4spn x8, 16 gives x8=0x1010, leaving sp unchanged; 16 is already the byte offset.
No. Fixed x2/sp is the source and only rd' is written; with sp=0x1000 and offset 16, x8=0x1010.
No. 16 is already the byte offset; the encoding stores bits [9:2] and restores two zero low bits. Zero offset is reserved.