From one transistor to a tiny CPU.

Every machine in the museum ultimately reduces to controlled electrical switching. Work upward from a transistor and an LED to logic gates, binary addition, ripple carry and a functioning 4-bit computer you can single-step by hand.

1. A transistor as an electronic switch

Start with the simplest useful idea: a small control signal determines whether current can flow through another path. This demonstration uses an NPN transistor because it is easy to visualize. Modern processors are built mostly from MOSFETs, but the digital abstraction — controlled switching between logic states — is the key idea.

Low-side transistor switchToggle the base input and follow the highlighted current path.
LED OFFTransistor is cut off; collector current is approximately zero.
+5 V330 ΩLEDNPN0 VBASE0 / 1

2. Switches become logic gates

Once transistors are combined, the output can depend on more than one input. The diagrams use simplified NMOS/resistor logic so the switching topology remains visible: series pull-down transistors implement NAND; parallel pull-down transistors implement NOR. AND and OR follow by adding an inverter.

Two-input gate explorerChoose a gate, then change A and B.
OUT 0
ABXOROUTPUTXOR can be built from NAND gates; those NAND gates reduce to transistor switch networks.

Transistor-network view

3. XOR + AND = a binary half-adder

This is the first point where the circuit performs arithmetic. XOR produces the low-order sum bit. AND detects the case where both inputs are 1 and therefore produces a carry into the next binary column.

AB
XOR
SUM
0SUM
AB
AND
CARRY
0CARRY
ABCarrySum
0000
0101
1001
1110
0 + 0 = 00₂
The important jump 1 + 1 = 10₂ is not a convention invented by software. The carry is physically produced by the logic network.

4. Chain full adders into a 4-bit adder

A full adder accepts A, B and a carry-in. Four of them can add values from 0 to 15. When a low-order bit generates a carry, that carry ripples into the next stage — an early example of why circuit organization affects speed.

Operand A

A = 0

Operand B

B = 0
RESULTS3S2S1S0CARRY OUT0000₂ = 0

Change the input bits or load the example, then animate the addition from bit 0 to bit 3.

5. Put the adder inside a tiny 4-bit CPU

The following computer is intentionally small, but it is real in the important sense: it has memory, a program counter, an instruction register, a decoder, an accumulator, an ALU, flags and an output register. Each press of CLOCK advances one micro-step so the movement of information is visible.

READY · phase FETCH ADDRESS

Datapath

Program counter0
Address0
RAM data00
Instruction register00
DecoderNOP
Accumulator0
ALU
Output register0
Z=1C=0PHASE=FETCH A
3210
PCADDRESSRAMIRDECODEALUACCOUT
The next clock places the program counter on the address path.
HexInstructionEffect
0xNOPNo operation
1aLDA aACC ← RAM[a]
2aSTA aRAM[a] ← ACC
3aADD aACC ← ACC + RAM[a]
4aSUB aACC ← ACC − RAM[a]
5aAND aACC ← ACC AND RAM[a]
6aJMP aPC ← a
70OUTOUT ← ACC
8nLDI nACC ← immediate nibble
F0HLTStop

16-byte memory — click individual bits to edit

Each row stores one 8-bit byte. The high nibble is the opcode and the low nibble is an address or immediate value. The CPU datapath remains 4-bit.

From the lab to the real machines

The scale changes. The principle does not.

The tiny CPU above is deliberately primitive, but the same hierarchy — switches, gates, arithmetic, registers, control and memory — scales into the processors used throughout the museum. Real CPUs use vastly more sophisticated transistor structures, timing, buses, caches and execution techniques, but there is no magical boundary between logic and a computer.