# Universal gates

## Table of contents

- Introduction
- NOR gate
- NAND gate
- Introduction
- Functional completeness
- Simplification
- Introduction
- Functional completeness
- Simplification

## Introduction

Universal gates are gates which can be used to implement all other gates. This is useful as manufacturers only need to produce 1 type of universal gate to be able to use all other gates.

The universal gates are NOR and NAND. This page will show you how to implement AND, OR and NOT gates using universal gates. The AND, OR and NOT gates are basic gates that are commonly used and are very important.

## NOR gate

The NOR gate is the opposite of the OR gate. It is like an OR gate followed by a NOT gate.

### Implementing NOT gate

A NOT gate can be implemented by passing the same input into both inputs of the NOR gate.

### Implementing OR gate

An OR gate can be implemented by passing the output of NOR to the NOT gate implemented earlier.

### Implementing AND gate

Since the NOR gate outputs true only when both inputs are 0, an AND gate can be implemented by inverting the inputs to a NOR gate.

## NAND gate

The NAND gate is the opposite of the AND gate. It is like an AND gate followed by a NOT gate.

### Implementing NOT gate

Similarly to NOR, a NOT gate can also be implemented by joining the inputs of a NAND gate.

### Implementing OR gate

The only time the NAND gate output is 0 is when both inputs are 1. Therefore, by inverting the inputs of a NAND gate, an OR gate can be implemented.

### Implementing AND gate

The AND gate is simply the output of a NAND gate inverted.

## Introduction

NAND Gates are universal gates. By the virtue of functional completeness, NAND Gates can be used to fully represent a given boolean expression. This simplifies the expression such that only one standard gate is used throughout.

## Functional completeness

Functional completeness is a property pertaining to boolean logic, which states that a functionally complete boolean operator can express all possible truth tables by representing itself in a boolean expression. That is, any given boolean expression can be completely represented by using the a functionally complete boolean operator.

For example, NAND gates can be used to implement the NOT gate, the OR gate and the AND gate.

## Simplification

To simplify any given boolean expression, first find the **minimum** number of NAND gates required. To do this, carry out the following steps.

Let’s find the minimum number of NAND gates required to simplify the logical expression:

```
F(A, B, C, D) = AB' + C'D
```

### Step 1: Double negation

Since the NAND gate is a combination of a NOT gate and an AND gate, we first apply a double negation to the entire expression so that we are able to standardize it later on.

Adding a double negation does not alter the inherent value of the expression as a double negation always nullifies itself.

```
F = (F')' = ((AB' + C'D)')'
```

### Step 2: Applying De Morgan’s law

We first apply De Morgan’s Law to the innermost bracket, such that we preserve the outermost negation at the time of expressing the `F`

as a NAND expression.

Thus, by applying De Morgan’s Law:

```
F = ((AB' + C'D)')'
= ((AB')' . (C'D)')'
```

The boolean expression is now standardized such that it can completely be represented by a NAND gate at every input level.

### Step 3: Construct the NAND circuit

Now that you have gotten the boolean expression to the required standard, you can implement it as a NAND circuit.

```
F = (A NAND B') NAND (C' NAND D)
F = (A NAND (B NAND B)) NAND ((C NAND C) NAND D)
```

Notice that there are input elements that are present in the negative form, namely `B'`

and `C'`

. You can represent them by using the NAND gate in order to realise the NOT gate.

## Introduction

NOR Gates are universal gates. By the virtue of functional completeness, NOR Gates can be used to fully represent a given boolean expression. This simplifies the expression such that only one standard gate is used throughout.

## Functional completeness

Functional completeness is a property pertaining to boolean logic, which states that a functionally complete boolean operator can express all possible truth tables by representing itself in a boolean expression. That is, any given boolean expression can be completely represented by using the a functionally complete boolean operator.

For example, NOR gates can be used to implement the NOT gate, the OR gate and the AND gate.

## Simplification

To simplify any given boolean expression, first find the **minimum** number of NOR gates required. To do this, carry out the following steps.

Let’s find the minimum number of NOR gates required to simplify the logical expression:

```
F(A, B, C, D) = (A + B').(C' + D)
```

### Step 1: Double negation

Since the NOR gate is a combination of a NOT gate and an OR gate, we first apply a double negation to the entire expression so that we are able to standardize it later on.

Adding a double negation does not alter the inherent value of the expression as a double negation always nullifies itself.

```
F = (F')' = (((A + B').(C' + D))')'
```

### Step 2: Applying De Morgan’s law

We first apply De Morgan’s Law to the innermost bracket, such that we preserve the outermost negation at the time of expressing the `F`

as a NOR expression.

Thus, by applying De Morgan’s Law:

```
F = (((A + B').(C' + D))')'
= ((A + B')' + (C' + D)')'
```

The boolean expression is now standardized such that it can completely be represented by a NOR gate at every input level.

### Step 3: Construct the NOR circuit

Now that you have gotten the boolean expression to the required standard, you can implement it as a NOR circuit.

```
F = (A NOR B') NOR (C' NOR D)
F = (A NOR (B NOR B)) NOR ((C NOR C) NOR D)
```

Notice that there are input elements that are present in the negative form, namely `B'`

and `C'`

. You can represent them by using the NOR gate in order to realise the NOT gate.