Courses
Courses for Kids
Free study material
Offline Centres
More
Store Icon
Store

Exclusive XOR Gate

ffImage
hightlight icon
highlight icon
highlight icon
share icon
copy icon
SearchIcon

What is XOR Gate?

XOR gate (sometimes called EOR, EXOR, and pronounced as Exclusive OR) is a digital logic gate that results in true (either 1 or HIGH) output when the number of true inputs is an odd count. An XOR gate implements an exclusive OR, i.e., a true output result if one, and only one, of the gate inputs, is true. If both the inputs are false (either 0 or LOW) or if both are true, there results in a false output. The XOR represents the inequality function, that is, the output is true if the inputs are not identical, and then the output is false. An easy way to remember XOR is "must have one or the other, but not both".


XOR can also be viewed as an additional modulo 2. Resultantly, XOR gates are used to implement binary addition in computers. A half adder has an XOR gate and an AND gate. Other uses include comparators, subtractors, and controlled inverters. XOR gate is a hybrid logic gate that has 2 inputs that perform the Exclusive Disjunction operation.


The XOR gate operation is similar to the OR gate’s; few inputs vary. The output of the XOR gate is also called 'an odd function' because it gives '1' when an odd number of ones are present at the inputs. Also, an XOR gate is a combinational logic circuit that generates the parity bit in the transmitter. The XOR gate is different from the inclusive OR gate because, in inclusive OR, it allows both the possibilities (if A or B are true, or if both are true, the output value would be 'true'). Still, in XOR, it only allows one possibility (if any one of A or B is true, only then, the output will be 'true').


XOR gate comes in the category of arithmetic gates. Arithmetic gates are sets of gates that perform arithmetic and bitwise operations on binary numbers. Therefore, XOR also contributes to the functioning of ALU.


Symbol of XOR Gate

There exist three schematic symbols for XOR gates. They can be given the traditional ANSI, DIN, and IEC symbols. In a few cases, the DIN symbol is used with '⊕' instead of '#.'


(Image will be uploaded soon)


The logic symbols (⊕, Jpq, and v) can be used to represent an XOR operation in algebraic expressions.


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


XOR Truth Tables

There are two kinds of truth XOR Table, which are with 2 inputs and 3 inputs. Let us have a look at both.


Truth Table of 2 input XOR Gate

The Boolean expression representing the 2

input XOR gate is written as, Y = (A⊕B) = A.B + A. B


XOR Gate with inputs A and B

A

B

Y

0

0

0

0

1

1

1

0

1

1

1

0



Here, we can observe that the XOR gate gives output as true only if only one of the inputs is 'true.’ Otherwise, the output delivered will be 'false' or '0'.


(The above algebraic expression represents the XOR gate with inputs A and B.)


The XOR Gate Truth Table for 3 Input XOR Gate

If an XOR gate were to accept three or more inputs and form and if those inputs were true, then it would, in effect, be a one-hot detector (indeed, this case is only for two inputs). However, it is rarely implemented this way in practice.


The Boolean expression for the three-input XOR logic gate is represented by,

Y = A⊕B⊕C = ABC + ABC + ĀBC + ABC


(The above algebraic expression represents the XOR gate with inputs A, B, and C.)


XOR Gate with Inputs A, B, and C

A

B

C

Y

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



Note:


  1. A⊕A = 0

  2. А ⊕ A'  = 1

  3. A ⊕ 0 = A

  4. A⊕1 = A


here, A' is read as 'not A'


XOR Gate Equivalent Circuit

We can produce XOR gates using other logic gates like OR, AND, NOT, NOR, NAND gates. These can be done by connecting the following gates in suitable forms. Also, an XOR gate can be made by combining 2 NOT gates, 2 AND gates, and 1 OR gate.


(Image will be uploaded soon)


The figure represented above used three different logic gates to form an XOR, which is one of the significant disadvantages. Besides, one of the easier ways to form the XOR gate is only to use the combination of the NOR gate and the NAND gate.


Construction of XOR Gate Using NAND Gate

By connecting 4 NAND gates, we can make an XOR gate.


(Image will be uploaded soon)


Construction of XOR Gate Using NOR Gate

We can make an XOR gate by connecting a minimum of 5 NOR gates. The desired output after connecting NOR gates in the following way would be Y = (AB' + A'B)


(Image will be uploaded soon)


Applications of XOR Gate

There are numerous counts of various applications of the XOR gate. Let us have a look at a few of them.


Uses in Addition

This is one of the applications of the XOR gate, and it can be used as a one-bit adder that adds any of the two bits together to produce one bit as output. For instance, if we add 1 plus 1 in binary, we can expect a two-bit answer, as 10 (it means 2 in decimal). Exclusive OR gate also has wide use in sequential and combinational circuits. 


Because the trailing sum bit in this output has been achieved with the XOR gate, the preceding carry bit is calculated using an AND gate. This is the primary principle in Half Adders. A slightly larger Full Adder circuit can be chained together to add longer binary numbers.


The example of a half adder circuit diagram is shown below.


Pseudo-Random Number Generator

The PRN (Pseudo-Random Number)


Generators, specifically called Linear feedback shift registers, are described as exclusive-or operation. Thus, a suitable setup of XOR gates can model a linear feedback shift register to generate random numbers.


Correlation and Sequence Detection

The XOR gates form a 0 output when both inputs are matched. When searching for a PRN sequence or a specific bit pattern in a very long data sequence, an XOR gates series can be used to compare a string of bits from the available data sequence against the target sequence in parallel.


Then, the number of 0 outputs can be counted to determine how the data sequence matches the target sequence well. Correlators are used in various communications devices such as the CDMA receivers and decoders for channel codes and error correction. In a CDMA receiver, the correlators are used to extract a particular PRN sequence from a combined collection of the PRN sequences.


An example of a full adder circuit diagram can be represented as below.


(Image will be uploaded soon)


Binary to Gray / Gray to Binary Conversion

As gray code is unweighted and difficult to use in arithmetic operations. So, XOR is used in binary to gray code / gray to binary code conversion.


In Dealing with a Basic Logic Comparator

As an XOR gate can generate a logic '1' output (when its 2 input bites are unequal). In this case, it can be used in dealing with a basic logic comparator.


Combinational Logic Circuit Minimization

XOR gates can be used to process the given two or more inputs such as to generate at least one output signal based on the logic function of each logic gate.


Some More Applications of XOR Gate are

When its two input bits are unequal, an XOR gate is typically found in applications dealing with a basic logic comparator that generates a logic "1" output (that represents 'high' or 'true')


  • XOR logic acts as a simple system for encrypting and decrypting data, i.e., performing an XOR of a digitized message with a binary key produces encrypted ciphertext. Hence, XOR gates are a fundamental building block of cryptographic circuits.

  • XOR gate is mainly used in the operation of half and full adders.

  • The concept of XOR gate is also used in the implementation of microprocessors and circuits for digital signal processing.

FAQs on Exclusive XOR Gate

1. Why is an Exclusive OR Gate Called a Controlled Inverter?

The XOR gate is called a controlled inverted because it behaves like a NOT gate.


 Also, the XOR gate has a 'true' output when the inputs are different. But, the output is the inversion of the other when one input is true, and the result is the non-inversion if one input is false.


The output of the XOR gate is given by


Y=AB=A'B + AB'


From the XOR Gate Truth Table below: 


A

B

Y

0

0

0

0

1

1

1

0

1

1

1

0


If one of the XOR gate inputs is used as a control signal, suppose, consider as B, it will produce its output either as Y=A or as Y=A' depending on control B. Let us see how it is.


If B = 0, Y = A'B +A B' == A' 0 + A1 = A


If B = 1, Y = A' B + A B' = = A' 1 + A0 = A'


In turn, it means that, if the control input B=0 and output Y=A means, the output just follows the input. Whereas, when control input B=1 and output Y=A' means, the output inverts its input. Therefore, the XOR gate is known as a controlled inverter.

2. What is the Difference Between an 'OR' Gate and an 'Exclusive OR' Gate?

A few common uses of OR and XOR gates can be listed. 


OR gate can only be used for summation purposes, whereas the Xor gate can use in comparison circuits and staircase switches OR gate cannot be used in parity circuits, but the XOR gates can be used in parity generation/detection and Error detecting circuits as well.


The practical application of the OR gate can be used in the Adder, Subtractor, Mux, and the other summing circuits. In contrast, the XOR gate can be used only in LFSR (Linear Feedback Shift Register), comparator, CRC checks, and other parity logic circuits. In the communication system, the devices for transmission of bits, the gates to be used as an XOR gate instead of OR gate. 

3. Is XOR a universal logic gate? Give a reason to justify your answer.

A universal gate is a logic gate whose repeated use can produce other logic gates. NAND gate and NOR gate are examples of universal logic gates. And But, the XOR gate can not be used on its own or together to produce any other boolean function. Hence, XOR is not a universal logic gate.

4. Which gate is the complement of the XOR gate?

The XNOR gate (also called the exclusive NOR gate or ENOR gate) complements the XOR logic gate. The XNOR logic gate is used to perform 'logical equality'. It has two or more inputs and gives a single output. It is the complement of the XOR gate because its output level is high only when both of the inputs are the same, whereas the XOR gate gives high output only when both the inputs are different (i.e., 1-0 or 0-1).


The truth table describes the relationship between the XOR gate and XNOR gate :


A

B

A+B (OR)

A⊕B (XOR)

A⊕B(XNOR )

0

0

0

0

1

0

1

1

1

0

1

0

1

1

0

1

1

1

0

1

5. How can you make a three-input XOR gate with a two-input XOR gate?

For making a 3 input XOR gate using 2 input XOR gates, we have to cascade 2 2-input XOR gates. A 2 input XOR gate will be fed by any 2 of the 3 inputs. And then, the output of those 2 inputs from the first gate will be XORed with the 3rd input. This process will result in the final output where we would have a 3 input XOR gate. Understanding this with the help of gates, there are 2 inputs say 'A' and 'B' that is connected to a gate of input value = 2, this gate will give an output as 'Y', and then, the 'Y' output will be XORed with the 3rd output that is 'C'. At last, we'll get 'Z' after doing the XOR of 'Y' and 'C'; this gate would be a 3 input gate.

6. What are the conditions for XOR gate?

XOR gate operates under the condition that it produces a true output only when the number of true inputs is odd.

7. What is XOR gate made of?

An XOR gate is typically made of transistors and electronic components arranged in a specific configuration.

8. How many inputs can an XOR gate have?

An XOR gate can have two or more inputs, but it typically has two inputs.

9. Is XOR a universal gate?

XOR gate is not a universal gate because it cannot be used to implement all logic functions.

10. What is special about XOR?

XOR gate is special because it outputs true only when its inputs are different, making it useful for various applications like data encryption and error detection.

11. Which IC is used for XOR gate?

IC 7486 is commonly used for XOR gate in digital circuits.

12. What is the symbol for XOR logic?

The symbol for XOR logic is a circle with a plus sign inside, representing the exclusive OR operation.

13. What is XOR Truth Table?

The XOR truth table is a tabular representation that illustrates the output of an XOR gate for all possible combinations of input values. In the EX OR Gate Truth Table, the inputs and their corresponding output are arranged in rows, showing the logical operation performed by the XOR gate. For a two-input XOR gate, the truth table consists of four rows, each representing a combination of input values (0 or 1) and the resulting output value (0 or 1) based on the XOR operation.