An XOR gate is an exclusive-OR gate. This gate is a specialized gate used in various types of computing circuits. Apart from AND, OR, NOT, NAND, and NOR gates, there are two special gates, Ex-OR and Ex-NOR. These gates are not essential on their own and are constructed by combining them with other logic gates.
Their Boolean output function is important enough to be considered a complete logic gate. XOR and XNOR gates are hybrid gates. One element not apparent from the Boolean operations is exclusive-OR, often referred to as XOR.
XOR GATE
But while the OR function is equivalent to Boolean addition, the AND function to Boolean multiplication, and the NOT function (inverter) to Boolean complement, exclusive-OR has no direct Boolean equivalent.
Types of XOR Gate:
2-input XOR Gate:
This is a simple form of hybrid gate XOR. This type of XOR gate has only two input values and an output value. There are 22=4 combinations of inputs. The output level is high when the two inputs are set to a different logic level. The Boolean expression of a 2-input XOR gate is as follows:
Design of 2-input XOR gate
XOR Gate Truth Table
Input | Input | Output |
A | B | A XOR B |
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
3-input XOR Gate:
Unlike a 2-input XOR gate, a 3-input XOR gate has three inputs. There are 23=8 combinations of inputs. The Boolean expression of a logical Ex-OR gate is as follows:
The truth table of the 3-input XOR gate:
A | B | C | Output |
0 | 0 | 0 | 0 |
0 | 0 | 1 | 1 |
0 | 1 | 0 | 1 |
0 | 1 | 1 | 0 |
1 | 0 | 0 | 1 |
1 | 0 | 1 | 0 |
1 | 1 | 0 | 0 |
1 | 1 | 1 | 1 |
Design of 3-input XOR gate
Where is the XOR gate used?
XOR gates are the logic gates used in circuits that perform arithmetic operations and calculations, particularly in half-adders and adders. The ability of the XOR gate to compare two logic levels and give an output depending on the state of the input is beneficial in many computational circuits.
The discrete gate has wide applications in a digital circuit. A two-bit exclusive or gate logic gives one output when the two inputs differ. So one obvious application of an exclusive OR gate is to use it as a digital comparator.
The significant difference between XOR gate and OR gate:
The difference has to do with mutual exclusion. Xor is exclusive or inclusive. That is to say, xor is or, but with the single change, the answer is false if both parameters to the operation are true.
You may refer to this truth table:
Input | Input | Output (XOR) | Output (OR) |
A | B | A XOR B | A OR B |
0 | 0 | 0 | 0 |
0 | 1 | 1 | 1 |
1 | 0 | 1 | 1 |
1 | 1 | 0 | 1 |
Why is the XOR gate called exclusive?
Because it is true only if one (but not both) of the inputs is true: this excludes concurrent options.
It is (together) opposite, true if one input is true, and true if both are true. The key is in the last row.
A | B | OR | XOR |
False | False | False | False |
False | True | True | True |
True | False | True | True |
True | True | True | False |
How is XOR different from XNOR?
XOR: If their number is odd, the output is one. Otherwise, the output will be zero.
XNOR: This is the negative logic of XOR. So if their number is equal, the output will be one. Otherwise, the output will be zero.
The truth table of both:
X and Y are input, and Z is Output
XOR Gate Truth Table
X | Y | Z |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
XNOR Gate Truth Table
X | Y | Z |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
How does XOR gate operation work?
Gates are simply the operation doors. In our everyday language, “OR” means to satisfy one of the mentioned. If someone says I will buy a car or a bike, he means he will buy a car or a motorcycle. So, “OR” usually means that a condition must be satisfied.
If someone says, “I want a job or tons of money,” does the fulfillment of his desires mean that a job and tons of money will fulfill his desire? It certainly does.
Then, “OR” means fulfilling both conditions, right?
So, here’s the catch. “OR” means two things. “OR” means only one condition must be satisfied, and another “OR” means both conditions are also valid. In the first type, “OR” only one condition should be satisfied. Meeting both requirements is excluded. So, that “OR” is called exclusive OR or XOR.
A second type of “OR” is where the meeting of two conditions is also valid, and we call it inclusive or OR.
So, XOR(Exclusive OR) is an OR operation that excludes cases where both satisfied conditions are valid.
Join Examdays Telegram
For more details about the Telegram Group, Click the Join Telegram below button.
In case of any doubt regarding Telegram, you can mail us at [email protected].