amomin.w

Atomic MIN word

This instruction is defined by:

Encoding

svg

Synopsis

Atomically:

  • Load the word at address xs1

  • Write the sign-extended value into xd

  • Signed compare the least-significant word of register xs2 to the loaded value, and select the minimum value

  • Write the result to the address in xs1

Access

M HS U VS VU

Always

Always

Always

Always

Always

Decode Variables

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

Execution

  • Pruned, XLEN == 64

  • Original

if (implemented?(ExtensionName::A) && (misa.A == 1'b0)) {
  raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
}
XReg virtual_address = X[xs1];
X[xd] = amo<32>(virtual_address, X[xs2][31:0], AmoOperation::Min, aq, rl, $encoding);
if (implemented?(ExtensionName::A) && (misa.A == 1'b0)) {
  raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
}
XReg virtual_address = X[xs1];
X[xd] = amo<32>(virtual_address, X[xs2][31:0], AmoOperation::Min, aq, rl, $encoding);

Exceptions

This instruction may result in the following synchronous exceptions:

  • IllegalInstruction

  • LoadAccessFault

  • StoreAmoAccessFault

  • StoreAmoAddressMisaligned

  • StoreAmoPageFault