pstw

Prefixed Store Word

pstw RS, D(RA), R

Stores word using 34-bit offset.

Details

The Prefixed Store Word instruction (pstw) stores a word from a source register to memory at an effective address calculated based on the base address in another register and an offset. The offset can be derived from either the instruction itself or the current instruction address, depending on the prefix field.

Pseudocode Operation

if 'stw' then
    EA ← (RA|0) + EXTS64(D)
if 'pstw' & R=0 then
    EA ← (RA|0) + EXTS64(d0||d1)
if 'pstw' & R=1 then
    EA ← CIA + EXTS64(d0||d1)
MEM(EA, 4) ← (RS)32:63

Programming Note

The pstw instruction is used to store a word from a source register into memory. It supports different addressing modes based on the prefix field and privilege level. Ensure that the base address in RA is properly aligned for optimal performance, and be cautious of potential exceptions if the EA calculation results in an invalid address.

Example

pstw r3, 0(r4), 0

Encoding

Binary Layout
1
0
2
6
R
8
0
9
D0
14
36
32
RS
38
RA
43
D1
48
 
Format MLS:D-form
Opcode 0x06000000
Extension Prefixed

Operands

  • RS
    Source
  • D
    Offset
  • RA
    Base
  • R
    PC-Rel