Logic Gates

Buffer

Buffer: Anything you put in, you get out.

In Out
0 0
1 1

NOT (Inverter)

NOT: Flip the signal.

In Out
0 1
1 0

AND & OR

AND: If both are 1, return 1; otherwise return 0.

A B Out
0 0 0
0 1 0
1 0 0
1 1 1

OR: Inclusive OR

A B Out
0 0 0
0 1 1
1 0 1
1 1 1

NAND & NOR

NAND: NOT AND

A B Out
0 0 1
0 1 1
1 0 1
1 1 0

NOR: NOT OR

A B Out
0 0 1
0 1 0
1 0 0
1 1 0

XOR & XNOR

XOR: Exclusive OR

A B Out
0 0 0
0 1 1
1 0 1
1 1 0

XNOR: Exclusive NOR

A B Out
0 0 1
0 1 0
1 0 0
1 1 1

Universal/Complete Gates

NAND and NOR can create all the basic logic gates.

NAND

NOT:

OR:

AND:

NOR

NOT:

AND:

OR:

NAND:

Multiplexer (MUX)

MUX: Functions like a switchboard.

2:1

This MUX takes three inputs, a, b, and c. 

c out
0 a
1 b

c'a+cb

We can make any basic logic gate with a MUX.

Example: Creating Logic Gate with a 2:1 MUX

Suppose we want to configure a MUX to give this truth table:

a b out
0 0 1
0 1 1
1 0 0
1 1 1

We want to split the table into two states first.

a b out
0 0 1
0 1 1
a b out
1 0 0
1 1 1

Observation: We can immediately see that when a=0, out is always 1, so we can draw a partial MUX like this:

Observation: Looking at the other truth table, we can see that out is always b when a=1, so we can draw a partial MUX like this:

Putting it all together, the final MUX is this:

4:1

TODO draw a 4:1 MUX

This MUX takes six inputs, a, b, c, d, x, and y

x y out
0 0 a
0 1 b
1 0 c
1 1 d

When and How to Use

8:1

TODO draw a 8:1 MUX

x y z out
0 0 0 a
0 0 1 b
0 1 0 c
0 1 1 d
1 0 0 e
1 0 1 f
1 1 0 g
1 1 1 h