Lably
Skip to content

XOR gate

Logic gate

  • 9 min read
  • 7 chapters

Related on Lably

Through Logic gate, Mathematical logic and Modular arithmetic

An XOR gate may serve as a "programmable inverter" in which one input determines whether to invert the other input, or to simply pass it along with no change. Hence it functions as a inverter (a NOT gate) which may be activated or deactivated by a switch.

XOR can also be viewed as addition modulo 2. As a result, XOR gates are used to implement binary addition in computers. A half adder consists of an XOR gate and an AND gate. The gate is also used in subtractors and comparators.

The algebraic expressions A⋅B¯+A¯⋅B or (A+B)⋅(A¯+B¯) or (A+B)⋅(A⋅B)¯ or A⊕B all represent the XOR gate with inputs A and B. The behavior of XOR is summarized in the truth table shown on the right.

Symbols

There are three schematic symbols for XOR gates: the traditional ANSI and DIN symbols and the IEC symbol. In some cases, the DIN symbol is used with ⊕ instead of ≢. For more information see Logic gate symbols.

The "=1" on the IEC symbol indicates that the output is activated by only one active input.

The logic symbols ⊕, Jpq, and ⊻ can be used to denote an XOR operation in algebraic expressions.

C-like languages use the caret symbol ^ to denote bitwise XOR. (Note that the caret does not denote logical conjunction (AND) in these languages, despite the similarity of symbol.)

Sign in to keep reading

6 more chapters are free with a Lably account.

More in Computing and communication