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 (R-type) performs bitwise XOR of rs1 and rs2, writing to rd. funct7=0000000, funct3=100. When rs1 and rs2 name the same register, the result is zero; this is a clearing idiom derived from XOR semantics. XOR's self-inverse property (A XOR B XOR B = A) is useful for bit masks and simple reversible transforms.
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.
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».
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.