sth

Store Halfword

sth RS, D(RA)

Stores the high half of a doubleword from a register to memory.

Details

Store the low 16 bits of RS to the halfword in memory at the effective address formed by adding the displacement D (sign-extended) to RA, or to the displacement alone if RA is 0. This is a Base category instruction with no status field updates.

Pseudocode Operation

EA ← EXTS(D, 16) + (RA | 0)
MEM(EA, 2) ← RS[48:63]

Programming Note

The sth instruction stores the high half of a register value into memory. Ensure that the destination address is properly aligned to avoid alignment faults. This instruction operates at user privilege level and will raise an exception if the EA is out of bounds or if there are insufficient permissions.

Example

sth r3, 0(r4)

// Store 16-bit halfword.

Encoding

Binary Layout
44
0
RS
6
RA
11
D
16
 
Format D-form
Opcode 0xB0000000
Extension Base

Operands

  • RS
    Source Register
  • D
    Displacement
  • RA
    Base Register