amomin.w
Atomic MIN word
- Extension
- A
- XLEN
- RV32 and RV64
- Assembly (riscv-unified-db)
amomin.w xd, xs2, (xs1)- Length
- 32-bit
Encoding
| 3129 | 2827 | 26 | 25 | 2420 | 1915 | 1412 | 117 | 62 | 10 | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 100 | 00 | aq | rl | rs2 | rs1 | 010 | rd | 01011 | 11 | ||||||||||||||||||||||
Match 0x8000202f, mask 0xf800707f. Source: amomin.w rd rs1 rs2 aq rl 31..29=4 28..27=0 14..12=2 6..2=0x0B 1..0=3 in riscv-opcodes/extensions/rv_a.
| Field | Bits | riscv-opcodes name |
|---|---|---|
| aq | 26 | aq |
| rl | 25 | rl |
| rs2 | 24:20 | rs2 |
| rs1 | 19:15 | rs1 |
| rd | 11:7 | rd |
Description
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 minimum to the address in xs1
Description from riscv-unified-db, reformatted.
Operation
XReg virtual_address = X[xs1]; X[xd] = sext(amo(32, virtual_address, X[xs2][31:0], AmoOperation::Min, 1'b0, 1'b0, $encoding), 32);
Pseudocode in riscv-unified-db’s IDL, quoted unchanged.