Modern computers – The computers at our desks
As you may have heard, the computers we have on our desks or in our pockets (like smartphones) work with only two distinct states, that we call 0 and 1. We also speak of bits. Computers use electrical signals for this purpose: If the voltage is low, this is interpreted as 0. If the voltage is high, it is interpreted as 1. In principle, however, the logic described by this system can be represented by anything that has two states: in the case of coins by heads (0) / tails (1) or in the case of a light switch by light off (0) / light on (1).
Gates
A bit is the smallest unit of information in a conventional computer. Any piece of information, be it a picture, a video or a text can be represented by (a probably very long) sequence of bits. The power of a computer stems from its ability to manipulate these bits.
Let’s take a look at how this is achieved. Therefore, think of a light bulb, which can also represent a bit. If electricity flows, the light bulb burns; if no electricity flows, it stays off.
For computers to produce useful results and run programs, they need a way to process and manipulate these bits. For this purpose, computers have so-called gates. A gate has one or more inputs at which it receives signals and one or more outputs at which it passes on signals. Gates are often represented using squares or rectangles. How a gate works can be illustrated with a NOT gate and a light switch.
-
A
The NOT gate inverts the signal from on to off or from 0 to 1 and vice versa.
-
B
The NOT gate turns the signal off always.
Well done! The NOT gate inverts the signal from on to off or from 0 to 1 and vice versa.
Not quite! The NOT gate inverts the signal from on to off or from 0 to 1 and vice versa.
Circuits, because a single gate isn’t that useful
Several gates together form a circuit and are thus the basis for computers as we know them. An algorithm that can be executed by a computer is then nothing more than a precise description of when to apply which gate. Bits are manipulated over time in a stepwise fashion. To understand how a conventional computer works at its core, it is helpful to understand how these gates work.
Circuits can be represented in diagrams much like musical notes. A musician begins on the left at time zero and progresses in time by reading to the right.
Similarly, circuits represent gate operations as a series of moments in time. Like music sheets, the diagram is to be read from left to right. This circuit here is 3 moments long and uses 2 bits (thanks to Stewart Smith for this analogy images):
Circuit diagrams
Reading from left to right, we can observe what happens at each moment. We start in the first column with both bits being initialized with a value 0. In column 1, a gate is applied only to the first bit. Nothing happens with the second bit. The gate in the second step processes bit 1 and 2 together and delivers two outputs. In the third step, a gate is applied to each of the two bits separately.
NOT-Gate
Let’s take a closer look at three different gates.
One way to get an idea of how gates work is to use truth tables. A truth table describes how a gate behaves for every input. For this purpose, one typically writes down the corresponding output for each possible input combination.
Since it accepts only one bit as input, the truth table of the NOT gate consists of only two lines:
Input | Output |
0 | 1 |
1 | 0 |
If the input is 0, the output becomes 1 and vice versa.
≥1 gate
Notes
- Each line represents one bit. Change the input values by clicking on the number at the beginning of a line.
- Perform a measurement by clicking on Measure.
My measurements
-
A
It turns the output into 1 if at least one input is 1.
-
B
It turns the output into 1 if and only if one of the inputs is 1.
-
C
It turns the output into 1 if and only if both inputs are 0.
-
D
It turns the output into 1 if at least one input is not 1.
Well done! It turns the output into 1 if at least one input is 1. This gate is also refered to as the OR gate.
Not quite! It actually turns the output into 1 if at least one input is 1. This gate is also refered to as the OR gate.
? gate
Notes
- Each line represents one bit. Change the input values by clicking on the number at the beginning of a line.
- Perform a measurement by clicking on Measure.
My measurements
-
A
It turns the output into 1 if at least one input is 1.
-
B
It turns the output into 1 if and only if one of the inputs is 1.
-
C
It turns the output into 1 if and only if both inputs are 0.
-
D
It turns the output into 1 if at least one input is not 1.
Well done! It turns the output into 1 if at least one input is 0. This gate is actually called a NAND gate (Not AND). It is the only gate needed to perform every computation a traditional computer can do. That's impressive, isn't it?
Not quite! The gate turns the output into 1 if at least one input is 0. This gate is actually called a NAND gate (Not AND). It is the only gate needed to perform every computation a traditional computer can do. That's impressive, isn't it?