The NAND, NOR and XOR Logic Gates
concept
The NOT, AND and OR gates we've already encountered can be considered the three "fundamental" gates however there are some more complex logic functions that we need often enough that they get packaged into their own gates.
In this topic we're going to cover three more exotic gates, the NAND gate, the NOR gate and the XOR gate.
fact
The NAND gate is an AND gate followed by a NOT gate. Its symbol is:
fact
The logic table for the NAND gate is:
A | B | Output |
---|---|---|
0 | 0 | 1 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
Below is an interactive NAND gate, click the inputs to toggle their values and the output will change automatically.
A dark green square is 0, a light green square is 1.
fact
The NOR gate is an OR gate followed by a NOT gate. Its symbol is:
fact
The logic table for the NOR gate is:
A | B | Output |
---|---|---|
0 | 0 | 1 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 0 |
Below is an interactive NOR gate, click on the inputs to toggle their values and see the output change.
fact
The XOR gate, called the "exclusive or" is a special gate that will output a 1 if exactly one of its inputs is 1, if both are 1 or both are 0 the XOR gate will give you a 0.
fact
The logic table for the XOR gate is:
A | B | Output |
---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
Below is an interactive XOR gate example
practice problems