# Logic Gates in Computer Architecture

## Logic Gates:

A logic gate is an electronic circuit that makes logical decisions. To arrive at these decisions, the most common logic gates used are OR, AND, NOT, NAND, and NOR gates. The NAND and NOR are called the universal gates. The exclusive-OR gate is another logic gate that can be constructed using basic gates such as AND, OR, and NOT gates.

## OR Gate:

The OR gate performs logical addition commonly known as OR function. The OR gate has two or more inputs and only one output. The operation of the OR gate is such that a HIGH(1) on the output is produced when any of the inputs is HIGH(1). The output is LOW(0) only when all inputs are LOW(0).

If X and Y are the input variables of an OR gate and Z is its output, then
[no-highlight]Z = X+Y
[/no-highlight]

## AND Gate:

The AND gate performs logical multiplication commonly known as AND function. It has two or more inputs and a single output. The output of an AND gate is HIGH only when all the inputs are HIGH. Even if any one of the inputs is LOW, the output will be LOW.

If X and Y are the input variables of an AND gate and Z is its output, then
[no-highlight]Z = X.Y
[/no-highlight]

## NOT Gate:

The NOT gate performs the basic logical function called inversion or complementation. The purpose of this gate is to convert one logic level into the opposite logic level. It has one input and one output. When a HIGH level is applied to an inverter, a LOW level appears at its output and vice versa.

If X is the input variable of a NOT gate and Z is its output, then
[no-highlight]z = x̄
[/no-highlight]

## NAND Gate:

NAND is a contraction of the NOT-AND gates. It has two or more inputs and only one input. When all inputs are HIGH, the output is LOW. If any one or both inputs are LOW, then the output is HIGH.

If X and Y are the input variables of a NAND gate and Z is its output, then

[no-highlight]Z = (XY)’
[/no-highlight]

The logic symbol for the NAND gate is shown below figure:

## NOR Gate:

NOR is a contraction of NOT-OR gates. It has two or more inputs and only one input. The is HIGH only when all the inputs are LOW. If any one or both the inputs are HIGH, then the output is LOW.

If X and Y are the input variables of a NOR gate and Z is its output, then

[no-highlight]Z = (X+Y)’
[/no-highlight]

The logic symbol for the NOR gate is shown below figure:

## Ex-OR Gate:

An Ex-OR Gate is a gate with two or more inputs and more output. The output of a two-input. It assumes a HIGH state if one and only one input assumes a HIGH state. This is equivalent to saying that the output is HIGH if either input A or input B is HIGH exclusively and low when both are 1 or o simultaneously.

## Ex-NOR Gate:

The Ex-NOR Gate is an EX-OR gate followed by an inverter. It has two or more inputs and one output. The output of a two-input Ex-NOR Gate assumes a HIGH state if both the inputs assume the same logic state or have an even number of 1’s, and its output is LOW when the inputs assume different logic states or have an odd number of 1’s.