Is the immediate zero-extended?
XORI immediate forms use a 12-bit signed immediate that is sign-extended to XLEN.
Bitwise XOR of rs1 with sign-extended 12-bit immediate, result in rd
XORI performs bitwise XOR of rs1 with the sign-extended 12-bit immediate, writing to rd. XORI rd,rs1,-1 inverts all bits of rs1 (pseudo NOT). Common for bit flipping, data encryption/checksum, register clearing, and complement generation.
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.
XORI is an RV32I/RV64I OP-IMM logical-immediate instruction: imm[11:0] is sign-extended to XLEN, XORed bit by bit with rs1, and written to rd. imm=-1 flips every XLEN bit of rs1.
Understand this scenario with real code like «xori x5, x6, -1 # x5 = ~x6 (bitwise NOT)».
Understand this scenario with real code like «xori x5, x6, -1 # x5 = ~x6 (bitwise NOT)».
Understand this scenario with real code like «xori x5, x6, -1 # x5 = ~x6 (bitwise NOT)».
XORI immediate forms use a 12-bit signed immediate that is sign-extended to XLEN.
-1 is encoded as twelve ones and sign-extends to all ones at XLEN width; XOR with 1 flips each bit.