Does SH store the whole register?
SH stores only the low 16 bits of rs2, not necessarily the full XLEN-wide register.
Store the low 16 bits of rs2 to memory
SH (S-type, opcode=0100011, funct3=001) stores the low 16 bits of rs2 to the effective address (rs1 + sign-extended 12-bit offset). Naturally aligned halfword addresses are multiples of 2.
Uses the same rhythm as the ADDI page: machine-code fields, fixed-field identification, operand reads, instruction-specific execution, and ISA-visible state update.
The machine code is split by the current instruction format; the animation starts from encoding/decode.
This animation shows ISA-visible decode and state changes, not any specific CPU pipeline, cache, prediction, or timing implementation.
SH forms the effective address as rs1 plus a signed 12-bit offset and stores the low 16 bits of rs2 to memory.
Understand this scenario with real code like «sh x6, 2(x10) # mem[x10+2][15:0] = x6[15:0]».
Understand this scenario with real code like «sh x6, 2(x10) # mem[x10+2][15:0] = x6[15:0]».
SH stores only the low 16 bits of rs2, not necessarily the full XLEN-wide register.
The effective address is the base register rs1 plus a sign-extended 12-bit byte offset.