- Digital Electronics Tutorial
- Digital Electronics - Home
- Digital Electronics Basics
- Types of Digital Systems
- Types of Signals
- Logic Levels And Pulse Waveforms
- Digital System Components
- Digital Logic Operations
- Digital Systems Advantages
- Number Systems
- Number Systems
- Base Conversions
- Binary Numbers Representation
- Binary Arithmetic
- Signed Binary Arithmetic
- Octal Arithmetic
- Hexadecimal Arithmetic
- Complement Arithmetic
- Binary Codes
- Binary Codes
- 8421 BCD Code
- Excess-3 Code
- Gray Code
- ASCII Codes
- EBCDIC Code
- Code Conversion
- Error Detection & Correction Codes
- Logic Gates
- Logic Gates
- AND Gate
- OR Gate
- NOT Gate
- Universal Gates
- XOR Gate
- XNOR Gate
- CMOS Logic Gate
- Two Level Logic Realization
- Threshold Logic
- Boolean Algebra
- Boolean Algebra
- Laws of Boolean Algebra
- Boolean Functions
- DeMorgan's Theorem
- SOP and POS Form
- Minimization Techniques
- K-Map Minimization
- Three Variable K-Map
- Four Variable K-Map
- Five Variable K-Map
- Six Variable K-Map
- Don't Care Condition
- Quine-McCluskey Method
- Min Terms and Max Terms
- Canonical and Standard Form
- Max Term Representation
- Simplification using Boolean Algebra
- Combinational Logic Circuits
- Digital Combinational Circuits
- Digital Arithmetic Circuits
- Multiplexers
- Parity Bit Generator and Checker
- Comparators
- Encoders
- Keyboard Encoders
- Priority Encoders
- Decoders
- Demultiplexers
- Arithmetic Logic Unit
- 7-Segment LED Display
- Code Converters
- Code Converters
- Binary to Decimal Converter
- Decimal to BCD Converter
- BCD to Decimal Converter
- Binary to Gray Code Converter
- Gray Code to Binary Converter
- BCD to Excess-3 Converter
- Excess-3 to BCD Converter
- Adders
- Half Adders
- Full Adders
- Serial Adders
- Parallel Adders
- Full Adder using Half Adder
- Half Adder vs Full Adder
- Binary Adder-Subtractor
- Subtractors
- Half Subtractors
- Full Subtractors
- Parallel Subtractors
- Full Subtractor using 2 Half Subtractors
- Half Subtractor using NAND Gates
- Sequential Logic Circuits
- Digital Sequential Circuits
- Clock Signal and Triggering
- Latches
- Flip-Flops
- Conversion of Flip-Flops
- Shift Registers
- Shift Register Applications
- Counters
- Finite State Machines
- Algorithmic State Machines
- A/D and D/A Converters
- Analog-to-Digital Converter
- Digital-to-Analog Converter
- DAC and ADC ICs
- Realization of Logic Gates
- NOT Gate from NAND Gate
- OR Gate from NAND Gate
- AND Gate from NAND Gate
- NOR Gate from NAND Gate
- XOR Gate from NAND Gate
- XNOR Gate from NAND Gate
- NOT Gate from NOR Gate
- OR Gate from NOR Gate
- AND Gate from NOR Gate
- NAND Gate from NOR Gate
- XOR Gate from NOR Gate
- XNOR Gate from NOR Gate
- NAND/NOR Gate using CMOS
- Memory Devices
- Memory Devices
- RAM and ROM
- Cache Memory Design
- Programmable Logic Devices
- Programmable Logic Devices
- Programmable Logic Array
- Programmable Array Logic
- Field Programmable Gate Arrays
- Digital Electronics Families
- Digital Electronics Families
- CPU Architecture
- CPU Architecture
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.
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 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 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.
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.