amocas.b.aq

Atomic compare-and-swap byte (acquire)

This instruction is defined by:

Encoding

svg

Synopsis

Atomically with acquire ordering:

  • Load the byte at address xs1

  • Write the sign-extended value into xd

  • Compare the loaded value with the least-significant byte of register xs2

  • If equal, write the least-significant byte of register xs2+1 to the address in xs1

Access

M HS U VS VU

Always

Always

Always

Always

Always

Decode Variables

Bits<5> xs2 = $encoding[24:20];
Bits<5> xs1 = $encoding[19:15];
Bits<5> xd = $encoding[11:7];

Execution

  • Pruned, XLEN == 64

  • Original

raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
if (!implemented?(ExtensionName::Zabha)) {
  raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
}
memory_model_acquire();
XReg virtual_address = X[xs1];

Exceptions

This instruction may result in the following synchronous exceptions:

  • IllegalInstruction