Skip to content

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.

A0B0ANDOUT0

Click an input to turn it on or off, and watch the wires.

An AND gate. The output lights only when both inputs do.
ABOUT
000
010
100
111
The table highlights whichever row you have set the gate to. There is no third thing here. The gate and the table are the same object, drawn two ways.

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.

A0B0OROUT0

Click an input to turn it on or off, and watch the wires.

An OR gate. Its curved back is how you tell it from AND at a glance.
ABOUT
000
011
101
111
A0B0XOROUT0

Click an input to turn it on or off, and watch the wires.

An XOR gate, drawn as OR with a second line across its back. Both inputs on, and the output goes dark.
ABOUT
000
011
101
110

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.

A0NOTOUT1

Click an input to turn it on or off, and watch the wires.

A NOT gate: a triangle with a small circle at its tip. The circle is the part that does the inverting, and you will see it on other gates meaning the same thing.

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. AND has a flat back and a round front. OR is 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, XOR take two wires in; NOT takes 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.