Why must a C.SWSP offset be a multiple of four?
Its compressed offset is word-scaled, forming a zero-extended byte offset multiplied by four.
Store 32-bit word to sp+offset. CSS format.
C.SWSP uses CSS format to store the low 32 bits of rs2 to the address formed by sp (x2) plus a zero-extended, 4-byte-scaled offset. It expands to sw rs2, offset(x2), and rs2 can be any integer register. The offset range is 0 through 252 bytes.
Assumes readable/writable ordinary memory without additional permission faults. The EEI option applies only to addresses not naturally 4-byte aligned; byte order, general permissions, device effects, and post-trap state are not modeled.
Not committed; registers, memory and PC retain their initial state.
Teaching stages show ISA-visible effects, not a CPU pipeline, cache, or timing model.
C.SWSP fixes x2/sp as its base, uses a 4-byte-multiple offset from 0 through 252, and stores the low 32 bits of rs2.
Understand this scenario with real code like «c.swsp x10, 16(sp) # sp=0x2000, x10=0x12345678 -> word at 0x2010=0x12345678».
Its compressed offset is word-scaled, forming a zero-extended byte offset multiplied by four.