**8.01 - using boolean algebra**

**8.02 - logic gates**

Logic gates work with digital values, which only have two values, high or
low, logic 1 or logic 0.

Logic 0 is assumed to be less than 1/2 of +V_{s}.

Logic 1 is assumed to be more than 1/2 of +V_{s}.

A logic gate is a digital circuit who’s output depends on the logic states of its inputs. Logic input and output can be displayed in ‘truth tables’.

All digital electronics are built from AND, OR and NOT gates.

The AND gate takes two inputs, and the output is high, if both inputs are
also high.

The symbol and truth table for an AND gate are:

```
AND GATE
A | B | Q Q is high
--+---+-- when A and B
0 | 0 | 0 are high.
0 | 1 | 0
1 | 0 | 0
1 | 1 | 1
```

The OR gates takes the inputs, and if either are high, then the output
is high.

The symbol and truth table for an OR gate are:

```
OR GATE
A | B | Q Q is high
--+---+-- when A or B
0 | 0 | 0 is high.
0 | 1 | 1
1 | 0 | 1
1 | 1 | 1
```

The NOT gate simply inverts the input, so 0 is 1, and 1 is 0.

The symbol and truth table for an NOT gate are:

```
NOT GATE
A | Q Q is simply
--+--- the opposite
0 | 1 of A.
1 | 0
```

From these gates, more complex gates can be constructed:

The NAND gate is simply the opposite of a AND gate, a NOT AND gate.

The symbol and truth table for a NAND gate are:

```
NAND GATE
A | B | Q Q is the output
--+---+-- of a AND gate, but
0 | 0 | 1 NOT'ed.
0 | 1 | 1
1 | 0 | 1
1 | 1 | 0
```

The NOR gate is simply the opposite of an OR gate, a NOT OR gate.

The symbol and truth table for a NOR gate are:

```
NOR GATE
A | B | Q Q is the output
--+---+-- of a NOR gate, but
0 | 0 | 1 NOT'd
0 | 1 | 0
1 | 0 | 0
1 | 1 | 0
```

The EXOR gate is an EXCLUSIVE OR gate, meaning if A and B are 1 or 0
then Q is low.

The symbol and truth table for a EXOR gate are:

```
EXOR GATE
A | B | Q Q is the
--+---+-- EXCLUSIVE OR.
0 | 0 | 0
0 | 1 | 1
1 | 0 | 1
1 | 1 | 0
```

The EXNOR gate is an EXCLUSIVE OR gate, NOT’d meaning if A and B are 1 or 0
then Q is high, because the output is a EXOR NOT’d.

The symbol and truth table for an OR gate are:

```
EXNOR GATE
A | B | Q Q is a NOT'd
--+---+-- EXOR gate.
0 | 0 | 1
0 | 1 | 0
1 | 0 | 0
1 | 1 | 1
```

**8.03 - boolean algebra laws**

Boolean algebra is the shorthand method of writing logic statements. For example:

```
Boolean expression | Explanation
--------------------+------------------------
A \= B | A equal to B
A + B \= Q | A or B equal Q
¬(A + B) \= Q | not A or not B equal Q
A v B \= Q | A and B equal Q
¬(A v B) \= Q | not A and not B equal Q
```

From here on, ¬ = NOT, v = AND, + = OR

For example an EXOR gate, made using the following gates:

```
A---*--+ +--------+ A B C D Q
| +----+NAND (C)+--+ 0 0 1 0 0
B-*-+--+ +--------+ | +-------+ 0 1 1 1 1
| | +--+AND (Q)+-> 1 0 1 1 1
| +-----+ +------+ | +-------+ 1 1 0 1 0
| +-+OR (D)+----+
+-------+ +------+
```

The intermediate logic sections C and D can be explained
in boolean algebra, for example:

C = ¬(A v B)

D = A + B

Therefore Q is the output of these two gates, AND’d.

Q = (¬(A v B)) v (A + B)

Q = A v ¬B + ¬A v B \

In order to be able to fully simplfy boolean expressions; you must learn the following laws:

```
Commutative | A + B = B + A
| A v B = B v A
--------------+--------------------------
Associative | (A + B) + C = A + (B + C)
| (A v B) v C = A v (B v C)
--------------+--------------------------
Distributive | A v (B + C) = A v B + A v C
| (A is a common factor, multiplying
| out the brackets)
--------------+--------------------------
DeMorgans Law |¬(A v B) = ¬A + ¬B
| (break the line, change
| the sign)
```

**8.04 - boolean identities**

It is reccomended that you learn these:

- A v A = A
- A + A = A
- A v ¬A = 0
- A + ¬A = 1
- A v 1 = A
- A + 1 = 1
- A v 0 = 0
- A + 0 = 0
- A + A v B = A
- A v (A + B) = A
- ¬¬A = A (nots cancel)