stwat

Store Word Atomic

stwat RS,RA,FC

Stores a word atomically to memory.

Details

The stwat instruction stores a word atomically to memory. The effective address (EA) is determined by the contents of register RA. If RA is zero, EA is set to zero; otherwise, EA is set to the value in RA. The function code FC specifies how the storage at EA is updated.

Pseudocode Operation

if RA=0 then
    EA ←0
else
    EA ←(RA)
mem(EA,8)←stat(mem(EA,8), RS32:63, FC)

Programming Note

The stwat instruction atomically updates a word in memory at the address specified by register RA. Ensure that RA is properly aligned to avoid exceptions. The function code FC determines the specific update operation; consult the ISA documentation for valid operations. This instruction operates at user privilege level and does not generate any exceptions under normal conditions.

Example

stwat r3, r4, fc

Encoding

Binary Layout
0
0
RS
6
RA
11
FC
16
 
Format X-form
Opcode 0x7C00058C
Extension Base

Operands

  • RS
    Source General Purpose Register
  • RA
    Address General Purpose Register
  • FC
    Function Code