XOR (Exclusive OR) Gate
The XOR gate (sometimes EOR gate) is a digital logic gate that implements exclusive disjunction – it behaves according to the truth table to the right. A HIGH output (1) results if one, and only one, of the inputs to the gate is HIGH (1). If both inputs are LOW (0) or both are HIGH (1), a LOW output (0) results.
This function is 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.
An Exclusive-OR gate is sometimes called a parity checker. Parity checkers count the number of ones being input to a circuit and output logic 1 or 0 based on whether the number of ones is odd or even. The Exclusive-OR (XOR) gate counts the number of ones at its input and outputs logic 1 for an odd count and logic 0 for an even count.
A common application for XOR gates is in error checking circuits. If two digital signals are compared bit-by-bit, an error free condition means that logic 0 will be compared to logic 0 and logic 1 will be compared with logic 1. In both of these cases, there is an even number of logic 1’s being input to the XOR gate.
Therefore, as long as the XOR gate outputs logic 0, there is no error. If, however, an error has occurred, then one signal will be logic 1 and the other will be logic 0. This odd number of logic 1’s will cause the XOR gate to output logic 1 indicating an error condition. Just as with the AND and OR gates, the XOR gate may have two or more inputs. Image below shows all four states for a two-input XOR.
These representations of logic gates can be an awkward way to describe the operation of a complex circuit. The next section will introduce an easier method for representing the operation of any digital circuit incorporating the NOT, AND, OR, and XOR gates.