XOR Gate in Digital Electronics



In digital electronics, the XOR gate is a derived logic gate used to determine the dissimilarity between two signals.

In chapter, we will study the theory and operation of XOR gate. Let’s get started with the basic definition of XOR gate.

What is an XOR Gate?

The XOR gate is a type of logic gate in digital electronics which has two inputs and one output. The output of the XOR gate is high or logic 1, only when both the inputs are different. For the same inputs, the output of the XOR gate is low or logic 0.

XOR gate is also called Exclusive OR gate or Ex-OR gate. This logic gate is widely used in digital arithmetic circuits like adders and subtractors.

Since the output of the XOR gate is high only when both of the inputs are dissimilar, it is also known as the inequality detector.

It is very important to note that there is no such thing like three or more input XOR gate. Hence, when we need XOR gate for more than two input variables, we use two or more two-input XOR gates.

Logic Symbol of XOR Gate

The logic symbol of an XOR gate is shown in the following figure.

Logic Symbol of XOR Gate

It has only two inputs designated as A and B and one output denoted by Y.

Truth Table of XOR Gate

The truth table of XOR gate is a table that represents the relationship between its inputs and output.

The truth table of an XOR gate is given below −

Inputs Output
A B Y
0 0 0
0 1 1
1 0 1
1 1 0

From this truth table, we can observe that the output of the XOR gate is high or logic 1 only when the both inputs are different. In the case, when both inputs are similar the output is low or logic 0.

Boolean Expression of XOR Gate

The Boolean expression is a logical function that represents the relationship between inputs and output of an XOR gate mathematically.

The following equation is known as the Boolean expression of the XOR gate.

$$\mathrm{Y \: = \: A \oplus B}$$

This equation can also be expressed as below −

$$\mathrm{Y \: = \: AB' \: + \: A'B \: = \: A \bar{B} \: + \: \bar{A}B}$$

Here, the symbol "$\mathrm{\oplus}$" denotes the XOR operation.

Working of XOR Gate

The detailed working of XOR gate for different input combinations is explained below −

  • If A = 0 and B = 0, the output of the XOR gate is Y = 0.
  • If A = 0 and B = 1, the output of the XOR gate is Y = 1.
  • If A = 1 and B = 0, the output of the XOR gate is Y = 1.
  • If A = 1 and B = 1, the output of the XOR gate is Y = 0.

From this explanation, we can see the output of XOR gate is high or logic 1 only when inputs are dissimilar.

XOR Gate as an Inverter

The XOR gate can also be used as an inverter. There is a property of XOR operation that is,

$$\mathrm{A \: \oplus \: 1 \: = \: \bar{A}}$$

Hence, by utilizing this property, we can state that if one of the input lines of the XOR gate is connected to logic 1 and the input signal is applied to another input line. Then, the XOR gate produces the inverted version of the applied signal as the output.

The following figure shows the operation of XOR gate as an inverter.

XOR Gate as an Inverter

XOR Gate as a Buffer

A buffer gate is a logic gate that produces the same output as the input. It is used to provide some delay in the input and output.

There is a property of XOR logic that is,

$$\mathrm{A \: \oplus \: 0 \: = \: A}$$

Hence, if one of the two input lines of the XOR gate is connected to a logic 0 and the input signal is applied to another input line. The XOR gate then produces the output same as the input.

The operation of the XOR gate as a buffer logic is illustrated in the following figure.

XOR Gate as a Buffer

XOR Gate using Switches

We can also implement the XOR gate logic using a battery, two simple switches, and a lamp.

The following figure depicts the circuit diagram of the XOR gate using switches.

XOR Gate using Switches

In this switching circuit, if the switches A and B are on the same level (either 0 or 1), the lamp will not glow. This state represents the low or logic 0 output.

If the switches A and B are at different levels, i.e., A is at 0 and B is at 1 or A is at 1 and B is at 0. Then, we can see there is a closed path for current to flow through the lamp, making the lamp turn on. This represents the high or logic 1 output.

Hence, the above shown electrical circuit implements the XOR logic function.

Applications of XOR Gate

The following are some key applications of the XOR gate −

  • XOR gate is used in computational and arithmetic circuits like adders, subtractors, etc.
  • XOR gate is used to detect errors, similarities and dissimilarities between two logic levels or signals.
  • XOR gate is used as a controlled inverter or buffer logic.

Conclusion

In conclusion, the XOR gate is a two input and one output logic gate that produces a high or logic 1 output when the inputs applied to it are dissimilar.

The XOR gate logic is widely used in staircase electric wiring and many other automation circuits, where a single device like lamp has to be controlled from two different locations.

Advertisements