# Logic Gates

In this tutorial, you will learn about the various logic gates used in digital electronics. You will also learn about their truth tables and diagrammatic representations.

Contents:

## What are Logic Gates?

Logic gates are the fundamental building block of any digital circuit. All the higher components in Digital Electronics are made up of logic gates only. The logic gates are designed using analog electronic components like MOSFETs, diodes, resistors, capacitors, bjts, etc.

The kind of devices used in designing a logic gate constitutes the logic family. The available kind of logic families are: –

• Unipolar Logic Family: – Made up of Unipolar devices like MOSFETs
• Bipolar logic family: – Made up of bipolar devices like bjts

Here are some points related to logic gates.

• There are three primary logic gates namely AND, OR & NOT. Any function can be made using these three gates.
• Apart from these, we have NAND, NOR, XOR, and XNOR gates. The NAND and NOR gates are also known as universal gates.
• The XOR and XNOR gates have special functions, hence are used to implement sophisticated logic directly to reduce the number of gates.

## AND Gate

The AND gate is the direct implementation of the conjunction function used in Boolean algebra. It takes two inputs and produces the output as per A.B operation. The AND operation is also known as product operation.

The truth table is shown below for AND gate.

A B A AND B
0
0
0
0
1
0
1
0
0
1
1
1

Here is the diagram of AND gate.

As shown in the figure, it takes two inputs and produces one output AB. It can also be extended to make an n-input AND gate with an output equal to A.B.C….n as it follows associative property.

## OR Gate

The OR gate is the direct implementation of the disjunction function used in Boolean algebra. It takes two inputs and produces the output as per A + B operation. The OR operation is also known as the sum operation.

The truth table is shown below for OR gate.

A B A OR B
0
0
0
0
1
1
1
0
1
1
1
1

Here is the diagram of OR gate.

As shown in the figure, it takes two inputs and produces one output A+B. It can also be extended to make an n-input OR gate with an output equal to A+B+C+D….n as it follows associative property.

## NOT Gate

The NOT gate is the direct implementation of the negation function used in Boolean algebra. It takes one input and produces its inverted output. It is also known as an inverter.

The truth table is shown for NOT gate.

A A’
0
1
1
0

Here is the diagram for NOT gate.

As shown in the figure, a NOT gate is a single input single-output gate. It cannot be extended to many input gates.

## NAND Gate

The NAND gate is obtained by performing inversion operation on the AND gate. It is a two-input gate and it produces a false output only when both the inputs are true. Here is the truth table for the NAND gate.

A B A NAND B
0
0
1
0
1
1
1
0
1
1
1
0

Here is the diagram for the NAND gate. It is shown as an AND gate with a bubble.

As shown in the figure, the NAND gate can have only two inputs and one output. It cannot be made into 3 input NAND gate as it does not have associative property.

## NOR Gate

The NOR gate is obtained by performing inversion operation on the OR gate. It is a two-input gate and it produces a true output only when both the inputs are false. Here is the truth table for the NOR gate.

A B A NOR B
0
0
1
0
1
0
1
0
0
1
1
0

Here is the diagram for NOR gate. It is shown as an OR gate with a bubble.

As shown in the figure, the NOR gate can have only two inputs and one output. It cannot be made into 3 input NOR gate as it does not have associative property.

## XOR Gate

The XOR function is also known as Exclusive-OR is given by f = xy’ + yx’. It is made from two AND gates and one OR gate but due to its extensive usefulness, we have a gate dedicated to this function known as the XOR gate.

The XOR function is also known as the odd one’s detector as it returns true as the output only when either of its input is true. Its truth table is given as: –

A B A XOR B
0
0
0
0
1
1
1
0
1
1
1
0

Here is the diagram for the XOR gate.

As shown in the figure, the XOR gate has two inputs and one output. It can be extended to n-inputs with an output equal to A1 XOR A2 XOR A3…An.

Here are some properties of XOR Gate: –

1. It is commutative and associative.
2. A XOR A = 0
3. A XOR A’ = 1
4. A XOR 0 = A
5. A XOR 1 = A’
6. If n = odd, A1 XOR A2 XOR…. An = A1 XNOR A2 XNOR …An, else if n=even, A1 XOR A2 XOR ..An = (A1 XNOR A2 XNOR A3…An)’

## XNOR Gate

The XNOR function is also known as exclusive NOR and is given as f = x’y’ + xy. It is made up of two AND gates & one OR gate, but it is also like XOR available as a gate. It is also known as even one’s detector as it gives output as true only when both of its inputs are the same, either both are zeros or ones.

Its truth table is shown below.

A B A XNOR B
0
0
1
0
1
0
1
0
0
1
1
1

Its represented diagrammatically as an inverted XNOR gate as shown in the figure.

As shown in the figure, the XNOR gate has two inputs and one output. It can be extended to n-inputs with an output equal to (A1 XNOR A2 XNOR A3…An).

Here are some properties of XNOR Gate: –

1. It is commutative and associative.
2. A XNOR A = A
3. A XNOR A’ = 0
4. A XNOR 0 = A’
5. A XNOR 1 = A

## Key Points to Remember

Here are the key points to remember in “Logic Gates”.

• Logic gates are the fundamental unit of all digital circuits.
• The logic gates are designed using different logic families like unipolar and bipolar logic families.
• The primary gates are:- AND, OR & NOT. Any function can be implemented using these three gates.
• To invert any input or output, we use bubbles in front of a gate.
• The NAND gate and NOR gate are constructed by complementing the outputs of AND gate & OR gate respectively. They are also known as universal gates.
• The XOR gate is given by the function f = xy’ + yx’, and the XNOR gate is given by the function f = x’y’ + xy,
• XOR and XNOR functions are complements of each other for an even number of input variables and are equal to each other for an odd number of input variables.

If you find any mistake above, kindly email to [email protected]

Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!