amomin.w
Atomic MIN word
This instruction is defined by:
Synopsis
Atomically:
-
Load the word at address rs1
-
Write the sign-extended value into rd
-
Signed compare the least-significant word of register rs2 to the loaded value, and select the minimum value
-
Write the result to the address in rs1
Decode Variables
Bits<1> aq = $encoding[26];
Bits<1> rl = $encoding[25];
Bits<5> rs2 = $encoding[24:20];
Bits<5> rs1 = $encoding[19:15];
Bits<5> rd = $encoding[11:7];
Execution
-
Pruned, XLEN == 64
-
Original
if ((%%LINK%csr_field;misa.A;CSR[misa].A%% == 1'b0)) {
%%LINK%func;raise;raise%%(ExceptionCode::IllegalInstruction, %%LINK%func;mode;mode%%(), $encoding);
}
XReg virtual_address = X[rs1];
X[rd] = %%LINK%func;amo;amo%%<32>(virtual_address, X[rs2][31:0], AmoOperation::Min, aq, rl, $encoding);
if (%%LINK%func;implemented?;implemented?%%(ExtensionName::A) && (%%LINK%csr_field;misa.A;CSR[misa].A%% == 1'b0)) {
%%LINK%func;raise;raise%%(ExceptionCode::IllegalInstruction, %%LINK%func;mode;mode%%(), $encoding);
}
XReg virtual_address = X[rs1];
X[rd] = %%LINK%func;amo;amo%%<32>(virtual_address, X[rs2][31:0], AmoOperation::Min, aq, rl, $encoding);