Skip to content
๐Ÿ”€ XOR Gate

๐Ÿ”€ XOR Gate

ABA โŠ• B
000
011
101
110
  • XOR outputs 1 only when inputs differ between 2-inputs
  • Acts as a bitwise difference detector

Conditional Inverter

  • A โŠ• 0 โ†’ preserves A
  • A โŠ• 1 โ†’ inverts A

This makes XOR ideal for circuits where inversion is controlled by a single flag, like Add/Sub.

Parity Checker

  • XOR of all bits in a word โ†’ 1 if odd number of 1s
  • Used in error detection and parity generation

Bit Masking

  • Toggle specific bits using XOR with a mask
  • Example: value โŠ• 0xFF โ†’ bitwise inversion

๐Ÿ”ง Application: Add/Subtract Circuit

ComponentRole in AdditionRole in Subtraction
XOR gatesPass-through YInvert Y
Carry-in01 (adds the +1)
Full addersAdd X and Y'Add X and $ \overline{Y} + 1 $
  • XOR gates conditionally invert Y based on Add/Sub
  • Carry-in completes the twoโ€™s complement transformation

๐Ÿง  Motivation Summary

  • XOR is not just a logic gateโ€”itโ€™s a semantic switch
  • Enables minimal, elegant control logic without branching
  • Perfect for arithmetic, masking, toggling, and parity
Last updated on