All computer chips are made from the same building blocks: elementary logic gates. A *logic gate* is a physical device that implements a mathematical logic (Boolean) function. The simplest example of a logic gate is the `NOT`

gate. It takes a single input and outputs its inverse. If the signal is ON, the inverter outputs OFF and vice versa. These gates can be constructed in many different ways but their logic behaviour remains consistent across all computers.

For this project, I started with the `Nand`

gate and then built all other gates from it. These standard set of gates were then used to construct the computer’s processing and storage chips.

### Nand: the special one

The `Nand`

gate is designed to compute the following Boolean function:

```
| Input A | Input B | Nand(A, B) |
| ------- | ------- | ---------- |
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
```

The `Nand`

function has an interesting property. Each one of the operations `And`

, `Or`

and `Not`

can be constructed from it, and it alone.

E.g. `x Or y = (x Nand x) Nand (y Nand y)`

Since every Boolean function can be constructed from `And`

, `Or`

and `Not`

operations using the canonical representation method, it follows that every Boolean function can be constructed from `Nand`

function alone. This is why `Nand`

gate was chosen as the primitive gate and the foundational element of all other gates in the project.

## Elementary gates

`Nand`

(primitive)`Not`

`And`

`Or`

`Xor`

`Mux`

`Dmux`

`Not16`

`And16`

`Or16`

`Mux16`

`Or8Way`

`Mux4Way16`

`Mux8Way16`

`DMux4Way`

`DMux8Way`