Is the immediate zero-extended?
ANDI immediate forms use a 12-bit signed immediate that is sign-extended to XLEN.
Bitwise AND of rs1 with sign-extended 12-bit immediate, result in rd
ANDI uses the I-type format. It ANDs rs1 with a 12-bit immediate sign-extended to XLEN and writes rd. It can retain or clear bits, or extract fields, with an encodable mask; mask use must account for sign extension.
Starts with machine-code field decoding, then shows operand reads, instruction-specific execution, and ISA-visible state update.
The machine code is split by the current instruction format; the animation starts from encoding/decode.
This animation shows ISA-visible decode and state changes, not any specific CPU pipeline, cache, prediction, or timing implementation.
ANDI is an RV32I/RV64I OP-IMM logical-immediate instruction: imm[11:0] is sign-extended to XLEN, ANDed bit by bit with rs1, and written to rd. It is useful for masks that fit the signed 12-bit immediate.
Understand this scenario with real code like «andi x5, x6, 0xFF # x5 = x6 & 0xFF (extract low byte)».
Understand this scenario with real code like «andi x5, x6, 0xFF # x5 = x6 & 0xFF (extract low byte)».
Understand this scenario with real code like «andi x5, x6, 0xFF # x5 = x6 & 0xFF (extract low byte)».
ANDI immediate forms use a 12-bit signed immediate that is sign-extended to XLEN.
No. ANDI has only a signed 12-bit immediate field; larger masks usually need to be built in a register and then used with AND.