The chip at work from switch to software
From switch to software.
Every app on your phone ends up as billions of tiny switches, each either on or off. This page climbs from one switch to a running program, one rung at a time.
On is 1, off is 0. Everything else, from a photo to a message, is patterns of those two. Scroll to go on.
Wikipedia on CMOS and SRAM; Apple Newsroom, May 2024.
01 The transistor
A switch with no moving parts.
A transistor has three ends. A voltage on the gate opens a channel, and current flows from source to drain. Take the voltage away and the channel closes. That is all a chip's transistors do: open and close.
Schematic. The transistors in the other explainers are this switch, a few tens of nanometres across.
02 Logic gates
Switches that decide.
Wire switches together and they compute. Chips use pairs: a p-type (violet) that conducts when its input is 0, and an n-type (blue) that conducts when it is 1. Two make a NOT gate. Four make a NAND: the output is 0 only when both inputs are 1.
Counts for static CMOS, from Wikipedia and a Cornell course. XOR takes 12 in the plain design, 8 or 6 in cleverer ones; the scene shows it as a block. A remarkable fact: NAND alone is enough. "An entire processor can be created using NAND gates alone."
03 Arithmetic
Gates that add.
A full adder adds two bits plus a carry, and passes a carry on. Chain four and you can add numbers up to 15. Each block here is a full adder: two input lamps on top, the sum bit in front, the carry running right to left.
A standard CMOS full adder takes 28 transistors (Tufts University course notes). A phone's processor adds 64-bit numbers, so its adders are sixteen times as wide, and far cleverer about the carry.
04 Remembering
Six switches to hold one bit.
A computer also has to remember. Fast on-chip cache holds each bit in a loop of six transistors that keeps itself on. Main memory holds each bit as charge in a tiny capacitor behind one transistor: far denser, but it leaks and must be refreshed.
Cell sizes from Wikipedia. The totals are arithmetic, at 8 bits a byte. This is why a laptop's gigabytes of memory sit on separate DRAM chips: as SRAM, 16 GB would need about 825 billion transistors, nearly thirty times Apple's whole M4.
05 Software
A program is just more bits.
Software is a list of instructions, each a pattern of bits. On an Apple chip each instruction is exactly 32 bits. This one, add x0, x0, x1, tells the core to add two of its registers. Tall bars are 1s.
Arm's A64 architecture guide: "It is a fixed-length 32-bit instruction set." The encoding is from the LLVM assembler. The fetch, decode, execute loop is the instruction cycle every processor runs, over and over, from switch-on to switch-off.
06 Scale
Billions of the same trick.
A tap on your screen runs a long chain of instructions, each routing bits through adders and memory built from gates built from switches. Nothing in the chain is more than a switch; there are just a great many of them.
Apple's M1 had 16 billion transistors in 2020; the M4 has 28 billion. The M3 Ultra joins two chips into 184 billion.
Apple Newsroom (2020, 2024, 2025). Bars are on a power-of-ten scale: each step up is ten times more. The first five are arithmetic from the counts above.
07 Where to go next
Now make it fast.
This page built a computer from switches. The next one asks how often they switch, and how a phone does trillions of things a second.
- A billion ticks a second: clock speed, cores and the inside of an Apple chip
- Wrapping the gate: what the switch looks like today
- What "2 nm" means: how small the switches really are