C.XOR

RISC-V C.XOR Instruction Details

Instruction ManualC-type

Bitwise XOR of rd' and rs2', write to rd'. CA format.

Instruction Syntax

c.xor rd', rs2'
Operand Breakdown
RV32/RV64 C or Zca; 16-bit CA format, with no immediate.
Three-bit rd'/rs1' and rs2' both select x8-x15; rd' is read and written.
XOR the two XLEN-bit sources and write rd'.
Identical fields read the same old value, producing zero.
CCompressed Instruction

Extension condition: RV32/RV64; requires C or Zca.

Instruction Behavior

C.XOR (CA format, x8-x15 only) computes bitwise XOR of rd' and rs2', writes to rd'. Expands to xor rd',rd',rs2'.

C.XOR Decode & Execute Animation

Shows only official 16-bit fields, conditions, and architectural state; it does not model a pipeline, cache, or timing.

c.xor,
Execution context

RV32/RV64; requires C or Zca; overlapping operands read the same old value.

x10 <- 0x0000FFFF
16-bit encoding fields
15..10
funct6
100011
9..7
rd'/rs1'
010
6..5
funct2
01
4..2
rs2'
011
1..0
op
01
Execution data path
CA fields restore rd'/rs1' to x10 and rs2' to x11; both three-bit fields map to x8-x15.
0x0000FF0F XOR 0x000000F0 = 0x0000FFFF
x10 <- 0x0000FFFF
Architectural state has not been committed.

Quick Understanding & Search Notes

C.XOR XORs rd' with rs2' bit by bit and writes rd'. Both CA compact-register fields select only x8-x15.

The CA rd'/rs1' and rs2' fields are three bits each and map to x8-x15.
C.XOR is an XLEN-bit bitwise XOR with no immediate operand.

Common Usage Scenarios

Bitwise XOR

RV32/RV64 C/Zca, x8=0xff0f and x9=0xf0: c.xor x8, x9 yields x8=0xffff.

Pre-Use Checklist

Syntax Check
  • RV32/RV64 C or Zca; 16-bit CA format, with no immediate.
  • Three-bit rd'/rs1' and rs2' both select x8-x15; rd' is read and written.
Semantic Check
  • XOR the two XLEN-bit sources and write rd'.
  • Identical fields read the same old value, producing zero.

Pitfalls / Common Confusions

Only x8-x15 registers (CA format, 3-bit register fields)
There is no immediate operand; rd' is both the read left operand and the writeback destination

FAQ

What is the 32-bit operation?

It expands to xor rd', rd', rs2', writing back to rd'.

Can both operands select one register?

Yes. They read the same old value, producing zero; both fields select only x8-x15.