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 uses the R-type format. It performs bitwise AND of rs1 and rs2 and writes the result to rd. funct7=0000000 and funct3=111.
Starts with machine-code field decoding, then shows operand reads, instruction-specific execution, and ISA-visible state update.
This example uses fixed initial register values and PC=0x2000; instruction fetch succeeds, with no asynchronous interrupt or extra extension checks. Exception branches stop ordinary commit; post-trap PC and handler state are EEI-dependent.
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.
RV32I/RV64I, x6=20 and x7=7: and x5, x6, x7 gives x5=4; each bit is set only when both input bits are 1.
RV32I/RV64I, x6=20 and x7=7: and x5, x6, x7 gives x5=4; each bit is set only when both input bits are 1.
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.