Home/Instructions/AMOMINU.B
AMOMINU.B

RISC-V AMOMINU.B Instruction Details

Instruction ManualAMO-type

Atomic byte unsigned min: rd = *rs1 (sign-ext), *rs1 = umin(*rs1, rs2[7:0])

Instruction Syntax

amominu.b rd, rs2, (rs1)

Syntax is rd, rs2, (rs1). The three fields select x0–x31 or ABI names, with no offset immediate or rs3.

funct5=11000, funct3=000, opcode=0101111; aq at bit26 and rl at bit25 are independent ordering bits.

RV32/RV64 Zabha (requires Zaamo): rd receives the sign-extended old 8-bit memory value; only the low 8 rs2 bits compute new memory.

The region must support this AMO width and operation. Every byte address is naturally aligned.

Sources use pre-execution values; rd=x0 discards register writeback while memory read-modify-write still occurs. aq/rl orders only the accessed memory/I/O domain.

ZabhaAtomic

Instruction Behavior

AMOMINU.B is a Zabha instruction, and Zabha depends on Zaamo. It atomically loads a byte from the address in rs1 into rd (sign-extended), compares it as an unsigned byte with rs2[7:0], and stores the smaller value back. The aq/rl bits provide optional release-consistency ordering.

AMOMINU.B Atomic Decode And Execute Animation

Shows Zabha (requires Zaamo) byte atomic field decode, aq/rl ordering bits, a memory read, and RMW state update.

rd
rs2
rs1
amominu.b
,
,(
)
Execution Context
31..27
26
25
24..20
19..15
14..12
11..7
6..0
11000
funct5
0
aq
0
rl
01011
rs2
01010
rs1
000
funct3
00101
rd
0101111
opcode
Atomic Data Path
instruction
0xC0B502AF
opcode
0101111 -> AMO
funct3
000 -> byte width
funct5
11000 -> AMOMINU.B
aq / rl
0/0 -> unordered
rd / rs2 / rs1
t0(x5) / a1(x11)[7:0]=0x01 / a0(x10)=0x00001000
memory read
mem[0x00001000] -> old byte 0xFF
RMW
Not computed
rd / memory
t0(x5) = unspecified initial value; mem[0x00001000] = 0xFF
Current Step

Concept Step: receive the 32-bit atomic instruction encoding

Zabha depends on Zaamo; Zabha-extension byte atomic instructions use a 32-bit encoding; the animation starts by splitting the fields.

encoding: 0xC0B502AF
syntax : amominu.b t0(x5), a1(x11), (a0(x10))
Pending result : Not computed
Current architectural state
t0(x5) = unspecified initial value; mem[0x00001000] = 0xFF

Assumes Zabha and Zaamo at the selected XLEN, successful fetch, a region supporting this width and operation, and a successful access. A misaligned halfword requires the stated PMA condition. Sources use pre-execution values; aq/rl orders only the accessed domain. Steps are a teaching sequence.

Quick Understanding & Search Notes

AMOMINU.B is a Zabha 8-bit unsigned min instruction. It atomically reads the old memory value, selects the memory writeback with an unsigned 8-bit comparison, and writes the sign-extended old value to rd.

Only the 8-bit subword is operated on; upper bits of rs2 are ignored.
rd receives the old memory value sign-extended to XLEN; unsigned affects the min/max comparison, not rd extension.
A byte operand has one-byte natural alignment; aq/rl bits can provide release-consistency ordering semantics.

Common Usage Scenarios

Atomic & Sync

RV32/RV64 Zabha+Zaamo, a1=0x1000, old 8-bit memory=0x80 and a2=1; assume a supporting region and normal completion: amominu.b a0, a2, (a1) returns a0=0xFFFFFF80 (RV32) or 0xFFFFFFFFFFFFFF80 (RV64) and writes 0x01 to memory. The data operation is 8-bit unsigned minimum.

Pre-Use Checklist

Syntax Check
  • Syntax is rd, rs2, (rs1). The three fields select x0–x31 or ABI names, with no offset immediate or rs3.
  • funct5=11000, funct3=000, opcode=0101111; aq at bit26 and rl at bit25 are independent ordering bits.
Semantic Check
  • RV32/RV64 Zabha (requires Zaamo): rd receives the sign-extended old 8-bit memory value; only the low 8 rs2 bits compute new memory.
  • The region must support this AMO width and operation. Every byte address is naturally aligned.
  • Sources use pre-execution values; rd=x0 discards register writeback while memory read-modify-write still occurs. aq/rl orders only the accessed memory/I/O domain.

Pitfalls / Common Confusions

rd returns the old memory value (sign-extended to XLEN), not the operation result
Comparison uses unsigned 8-bit values: 0x80 is 128 and 0xFF is 255; rd still sign-extends the old byte.
A byte operand has one-byte natural alignment; aq/rl provide memory-ordering semantics only.

FAQ

Does AMOMINU.B return the post-operation value?

No. Like A-extension AMOs, rd receives the old value loaded from memory.

Can AMOMINU.B affect neighboring bytes?

Architecturally it modifies only the byte operand; Zabha provides native byte-granule atomic read-modify-write operations.