What is the difference between AND and ANDI?
AND reads two registers, rs1 and rs2. ANDI reads rs1 and uses a sign-extended 12-bit immediate.
Bitwise AND of rs1 and rs2, result in rd
AND (R-type) performs bitwise AND of rs1 and rs2, writing to rd. funct7=0000000, funct3=111. Used to clear bits (with zero mask), extract bit fields, achieve address alignment (AND with alignment mask), etc.
Uses the same rhythm as the ADDI page: machine-code fields, fixed-field identification, 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.
AND is an RV32I/RV64I base integer R-type logical instruction: it reads two XLEN-wide register values from rs1 and rs2, applies bitwise AND, and writes rd. It is commonly used to keep bits selected by 1s in a mask and clear bits selected by 0s.
Understand this scenario with real code like «and x5, x6, x7 # x5 = x6 & x7».
Understand this scenario with real code like «and x5, x6, x7 # x5 = x6 & x7».
Understand this scenario with real code like «and x5, x6, x7 # x5 = x6 & x7».
AND reads two registers, rs1 and rs2. ANDI reads rs1 and uses a sign-extended 12-bit immediate.
No. The RISC-V base integer ISA has no condition-code flags; AND only writes rd, and a write to x0 is discarded.