Want to keep learning?

This content is taken from the Raspberry Pi Foundation & National Centre for Computing Education's online course, How Computers Work: Demystifying Computation. Join the course to learn more.
2.4

Raspberry Pi Foundation

Skip to 0 minutes and 1 second In this step, we’re going to recap some of the logic gates we have already made and look at all the other gates. You should be familiar, by now, with the basic NAND gate and its truth table. In the last step, we also tied the two inputs of a NAND gate together. In this configuration, when the switch was turned on, the lamp turned off, and vice versa. This set up is also known as a NOT gate, which has this symbol. In the video, we also went over the construction of an AND gate and showed you that truth table. You also independently put some NAND gates together and worked out the truth table, that should have come out like this.

Skip to 0 minutes and 39 seconds This is actually called an OR gate. Another type of gate we can make is called an XOR gate. It can be assembled from four NAND gates, like this. This is the symbol for an XOR gate, and here is its truth table. Any of the basic gates can be combined with a NOT gate to reverse the output. An “N” is then placed with the name of the gate, and a small circle added to the output end of the symbol. So when an AND gate is combined with a NOT gate, it produces a NAND gate, which you’re already familiar with.

Skip to 1 minute and 16 seconds An OR gate and a NOT gate produces a NOR gate, and an XOR gate with a NOT gate produces an XNOR gate. So here’s a summary of all the logic gates with their NAND equivalents, and also their truth tables. There is a downloadable PDF of this summary at the bottom of this step.

Skip to 1 minute and 39 seconds In the next step, there’s going to be a quiz on truth tables and logic gates, so it might be worth spending a little time reviewing the previous steps in this week to ensure that you can answer all the quiz questions.

All the other gates

In this step we’re going to recap some of the logic gates we have already met, and look at all the other gates.

You should be familiar by now with the basic NAND gate and its truth table.

In the last step we also tied to the two inputs of a NAND gate together to make what is called a NOT gate, which has its own symbol. The diagram below shows again how it is made from a NAND gate, and then shows the symbol for a NOT gate.

In the video, we also went over the construction of an AND gate and showed you its truth table. Here they are again, with the symbol for an AND gate.

You also independently put some NAND gates together in the configuration below, and worked out its truth table. This is called an OR gate and also has its own symbol.

Another type of gate we can make is called an XOR gate (‘eXclusive OR’). Its output is 1 when one, but not both, of its inputs is 1. It can be assembled from four NAND gates like this and has the symbol shown:

Any of the basic gates can be combined with a NOT gate to reverse the output. When this happens, the new gate created has an N inserted into the name, and the symbol has a small circle added to the front.

So when an AND gate is combined with a NOT gate, it produces a NAND gate – which you are already familiar with. An OR gate and a NOT gate produces a NOR gate. And an XOR gate with a NOT gate produces an XNOR gate.

There is a downloadable PDF of the summary of all the gates and their NAND equivalents at the bottom of this step.

In a later step there’s going to be a quiz on truth tables and logic gates, so it might be worth spending a little time reviewing the previous steps from this week, to ensure that you can answer all the questions.