Which source-register bits does C.SH store?
It writes the least-significant 16 bits of rs2' to memory; higher source-register bits do not contribute to the stored value.
16-bit encoding of sh, store lower 16 bits
Extension condition: RV32/RV64 Zcb, requiring Zca; no additional Zbb prerequisite.
C.SH uses the Zcb CSH format. It stores the low 16 bits of rs2' at rs1' plus zero-extended uimm. Both rs1' and rs2' map to x8-x15; uimm[1] comes from encoding bit 5 and uimm[0] is zero, so the offset is only 0 or 2.
Shows only official 16-bit fields, operands, conditions, and architectural state; it does not model a pipeline, cache, or timing.
RV32/RV64 Zcb + Zca
A naturally aligned access cannot raise an address-misaligned exception; any address can still raise an access-fault according to the EEI's access rules.
C.SH maps compact rs1′/rs2′ to x8–x15 and reconstructs a byte offset of 0 or 2; a completed access stores the low 16 source bits.
RV32/RV64 Zcb+Zca, x10=0x2000 and x9=0x1234abcd: c.sh x9, 2(x10) writes mem16[0x2002]=0xabcd on completion.
It writes the least-significant 16 bits of rs2' to memory; higher source-register bits do not contribute to the stored value.
uimm[1] comes from encoding bit 5 and uimm[0] is fixed to zero, so the zero-extended offset can only be 0 or 2 bytes.