The Same Table, Drawn
A gate is a truth table with wires. Set the inputs and the output follows, row by row.
A wire carries one of two things. A signal, or no signal. On, or off.
You have met that before. It is a bit, and in Counting in Twos it was a switch inside a byte. Here it is a signal travelling along a wire, and it is the same idea wearing different clothes: two states, nothing in between.
Now put a part in the middle of some wires. Two wires in, one wire out, and a rule saying what comes out for each combination going in.
That rule is a truth table. The part is called a gate.
AND, in wire
Here is the AND table you know, and beside it the same thing built. Click either input to
turn it on.
Click an input to turn it on or off, and watch the wires.
| A | B | OUT |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Work through all four rows. The gate has no other behaviour, because the table has no other rows.
That is the claim this module rests on, so it is worth stating plainly: a gate is not described by its truth table, it is its truth table. The drawing tells you how to build it. The grid tells you what it does. Neither is more real than the other.
OR and XOR
The same again, with the other two.
Click an input to turn it on or off, and watch the wires.
| A | B | OUT |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
Click an input to turn it on or off, and watch the wires.
| A | B | OUT |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Set both inputs on the XOR and watch the output go out. That is the row where it parts
company with OR, the one Unit 2 of Truth Tables said would be waiting for you.
NOT takes one wire
NOT is the odd one. One wire in, one wire out, and it hands back the opposite.
Click an input to turn it on or off, and watch the wires.
Its output is lit when nothing is going in, which looks wrong until you remember what it is for.
Why these shapes
The shapes are not decoration. They are a notation, the way a musical stave is, and they have been drawn this way for long enough that any book on the subject will use them.
Worth knowing: the little circle on the NOT gate means inverted. Stick it on the nose of
an AND gate and you have a NAND, which is AND followed by NOT. You will not need that
here, but you will see it, and now it will not be a new symbol.
When it’s wrong, see why
- The output is lit when nothing is going in. That is a
NOT, or a gate with a circle on its nose. Check the shape. - You cannot tell AND from OR in a diagram.
ANDhas a flat back and a round front.ORis curved at both ends and comes to a point. - The circuit does not match the table you meant. Set every row in turn. Four rows is a complete test, and there is nowhere for a mistake to hide.
What you’ve learnt
- A wire carries a bit: on or off, the same two states as a switch in a byte.
- A gate is a part whose behaviour is a truth table.
AND,OR,XORtake two wires in;NOTtakes one.- The small circle means inverted.
- Setting all four rows is a complete test of a two-input gate.
What’s next
Three gates, three tables, nothing new. In Unit 2 we wire two of them up and discover we have accidentally built something that adds.