SH
Store Halfword
SH rs2, offset(rs1)
Stores the lowest 16 bits of a register to memory.
Details
SH stores the least-significant halfword (16 bits) of rs2 to memory at address rs1+sext(offset).
Pseudocode Operation
M[R[rs1] + sext(offset)][15:0] = R[rs2][15:0];
Example
SH x5, 4(x10)
Encoding
Binary Layout
imm[11:5]
31:25
rs2
24:20
rs1
19:15
001
14:12
imm[4:0]
11:7
0100011
6:0
Operands
-
rs2
Source -
rs1
Base Address -
offset
Offset