Introduction to DLD

XOR Logic Gate

XOR (Exclusive OR) logic gate is a digital logic gate that gives the output 1 (HIGH) only when the two inputs are different. If the inputs are the same, the output is 0 (LOW).

XOR Gate Symbol using 2-Inputs

Important: A XOR B = AB̅ + A̅B = AB′+A′B

XOR Gate Boolean Expression

The Boolean expression of XOR logic Gate is given below

 

XOR Logic Gate - Boolean Expression

where

A, B are the inputs, X is the output, and ⊕ is the operator for XOR Gate

XOR Gate Symbols

Here are standard diagrams that show the symbol of XOR logic gate. The number of inputs to a XOR logic gate can be different according to the requirement

XOR Gate Symbol for 2 Inputs

In the following XOR gate diagram, A and B are the inputs, and A⊕B is the output

XOR Gate Symbol using 2-Inputs

XOR Gate Symbol for 3 Inputs – Using 3 XOR

In the following XOR gate diagram, A, B, and C are the inputs, and A⊕B⊕C is the output

XOR Gate Symbol using 3-Inputs

XOR Gate Symbol for 4 Inputs – Using 3 XOR

In the following XOR gate diagram, A, B, C, and D are the inputs, and A⊕B⊕C⊕D is the output

XOR Gate Symbol using 4-Inputs

XOR Gate Symbol for 5 Inputs – Using 3 XOR

In the following XOR gate diagram, A, B, C, D, and E are the inputs, and A⊕B⊕C⊕D⊕E is the output.

XOR Gate Symbol using 5-Inputs

XOR Gate Symbol for 6 Inputs – Using 3 XOR

In the following XOR gate diagram, A, B, C, D, E, and F are the inputs, and A⊕B⊕C⊕D⊕E⊕F is the output

XOR Gate Symbol using 6-Inputs

XOR Gate Symbol for 7 Inputs – Using 5 XOR

In the following XOR gate diagram, A, B, C, D, E, F, and G are the inputs, and A⊕B⊕C⊕D⊕E⊕F⊕G is the output

XOR Gate Symbol using 7-Inputs

XOR Gate Symbol for 7 Inputs – Using 1 XOR

In the following XOR gate diagram, A, B, C, D, E, F, and G are the inputs, and A⊕B⊕C⊕D⊕E⊕F⊕G is the output. In this proces we can use several XOR gates, but it can done through single XOR gate as shown in the following diagram.

XOR Gate Symbol for 7-Inputs - 1 XOR

 

XOR Gate Equivalent Circuit

XOR Logic Gate can also be represented using an electrical circuit. In this circuit, two switches and a lamp are used

XOR Logic Gate Circuit using switches

In this circuit, switches A and B act as the two inputs, while the lamp represents the output. The lamp glows only when the two switches are in different states.

  • When A = 0 and B = 0, or A = 1 and B = 1, the lamp remains off. Therefore, the output is 0.
  • When A = 0 and B = 1, or A = 1 and B = 0, a complete path is available for current to pass through the lamp. The lamp turns on, giving an output of 1.

XOR Logic Gate Truth Table

The truth table shows all possible input combinations and their corresponding outputs for a logic gate. XOR Logic Gate truth tables for different numbers of inputs are given below

The number of possible input combinations in a truth table is calculated using 2ⁿ, where n represents the number of inputs.

For Example:

  • For 2 inputs, 22 = 4 combinations
  • For 3 inputs, 23 = 8 combinations

XOR Logic Gate Truth Table for 2 inputs

A 2-input XOR gate gives an output of 1 when the two inputs are different (01 or 10). If the inputs are the same (00 or 11), the output is 0. XOR Logic Gate Truth Table for two inputs (A, B) is given below

XOR Logic Gate Truth Table (2-Inputs)

XOR Logic Gate Truth Table for 3 inputs

A 3-input XOR gate outputs 1 when an odd number of inputs are 1 (either 1 or 3). If the number of 1s is even (0 or 2), the output is 0. XOR Logic Gate Truth Table for three inputs (A, B, C) is given below

XOR Logic Gate Truth Table (3-Inputs)

XOR Logic Gate Truth Table for 4 inputs

A 4-input XOR gate outputs 1 when an odd number of inputs are 1 (either 1 or 3). If the number of 1s is even (0, 2, or 4), the output is 0. XOR Logic Gate Truth Table for four inputs (A, B, C, D) is given below

XOR Logic Gate Truth Table (4-Inputs)

Properties of XOR Gate

The following diagram shows the main properties of XOR logic gate

XOR Logic Gate Properties

XOR Gate as Buffer

When a 2-input XOR logic gate is used, where one input is fixed to 0 and other is “A”. The value of “A” can be either 0 or 1 in binary. It is called a buffer. Notation, Truth table and Symbol of XOR logic gate as buffer is given below

XOR Logic Gate As a Buffer Truth Table

XOR Gate as Inverter

When a 2-input XOR logic gate is used, where one input is fixed to 1 and the other is “A”. The value of “A” can be either 0 or 1 in binary. It is called a Inverter. Notation, Truth table and Symbol of XOR logic gate as buffer is given below

XOR Logic Gate As a inverter Truth Table

 

When the input value for A = 0, then the output is 1 and viceversa.

XOR Gate Using NAND Gate

The following diagram shows how using NAND Logic gates produces the exact output that is produced by a 2-input XOR Gate. It is done through a NAND Gate

Implementation of XOR Gate using NAND gate

XOR Gate Using NOR Gate

The following diagram shows how using NOR Logic gates produces the exact output that is produced by a 2-input XOR Gate. It is done through a NOR Gate.

Implementation of XOR Gate from NOR gate

XOR Gate Circuit Diagram Using Transistors

An XOR Logic Gate can be constructed using transistors; an NPN transistor is mainly used in simple circuit construction.  Let’s discuss XOR Logic Gate circuit using NPN transistors, where two inputs (A, B)

XOR Gate Circuit Diagram Using Transistors

In the above diagram

  • A and B are the two inputs.
  • Q1 and Q2 are controlled by A and B. They work together to detect when both A and B are HIGH (1).
  • Q3 acts as an inverter and helps produce the A AND B signal.
  • Q4 and Q5 are controlled by A and B and combine this signal with the previous stage.
  • R1, R2, R3, and R4 control and limit the current in the circuit.
  • D1 is used to control the current path in the output section.
  • The circuit operates from a +5 V supply.

For an XOR gate, the output should be 1 only when A and B are different:

XOR Logic Gate with NOT Gate

When we use NOT gate with XOR Gate, it revert the output of XOR Gate. This Combination is known as XNOR Gate. First XOR  operation is performed and then NOT gate reverse the output of XOR Gate.

The following diagram shows the very basic OR with Not logic circuit

NOT Gate Using XOR Gate

XOR Logic Gate with AND Gate

XOR Logic Gate can be combined with AND logic gate to create complex logic functions. The output of one logic gate can be connected with input of anohter logic gate to create require logic.

The following diagram shows the very basic XOR with AND logic circuit

AND Gate with XOR Gate

XOR Logic Gate with OR Gate

XOR Logic Gate can be combined with OR logic gate to create complex logic functions. The output of one logic gate can be connected with input of anohter logic gate to create require logic.

The following diagram shows the very basic XOR with OR logic circuit

OR Gate with XOR Gate

Applications of XOR Gate

Here are some common applications of the XOR Logic Gate:

  • Adder circuits: Used in half adders and full adders to perform binary addition.
  • Parity checking: Used to check whether the number of 1s in binary data is even or odd.
  • Error detection: Helps detect errors in digital data during transmission.
  • Digital comparators: Used to identify whether two binary inputs are different.
  • Controlled switching: Used in circuits where the output needs to change when inputs change.

Advantages of XOR Gate

Here are some advantages of the XOR Logic Gate:

  • Simple and easy to use in digital circuits.
  • Useful for binary addition and arithmetic operations.
  • Helps detect errors in digital data.
  • Can be combined with other gates to create useful circuits.
  • Can be used to build an XNOR gate by adding a NOT gate.

Disadvantages of XOR Gate

Here are some disadvantages of the XOR Logic Gate:

  • Its circuit design is more complex than basic gates such as AND and OR.
  • It may require more transistors or gates to implement.
  • It can consume more power than simpler logic gates in some implementations.
  • It is not suitable when the output should be 1 only when all inputs are 1.