What is the difference between XOR and XORI?
XOR reads two registers, rs1 and rs2. XORI reads rs1 and uses a sign-extended 12-bit immediate.
Bitwise XOR of rs1 and rs2, result in rd
XOR uses the R-type format. It XORs rs1 and rs2 bit by bit and writes the result to rd. Its encoding is opcode=0110011, funct3=100, funct7=0000000. If both source fields name the same register, every result bit is zero.
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.
XOR is an RV32I/RV64I base integer R-type logical instruction: it reads two XLEN-wide register values from rs1 and rs2, applies bitwise XOR, and writes rd. Each result bit is 1 when the two input bits differ and 0 when they match.
Understand this scenario with real code like «xor x5, x6, x7 # x5 = x6 ^ x7».
Understand this scenario with real code like «xor x5, x6, x7 # x5 = x6 ^ x7».
XOR reads two registers, rs1 and rs2. XORI reads rs1 and uses a sign-extended 12-bit immediate.
Each bit XORed with itself is 0, so selecting the same register for both sources produces an all-zero XLEN-wide result written to rd.