← All notes

SILICON: a computer from NAND gates

12,687 NAND gates and 1,322 flip-flops make an 8-bit CPU that plays Snake. You can zoom in until you're looking at one gate.

Play it One HTML file. Runs in your browser, nothing to install.

Every computer is NAND gates if you squint hard enough. This one doesn’t make you squint.

SILICON is a working 8-bit computer built from 12,687 NAND gates and 1,322 D flip-flops, nand2tetris style. The only other primitive is the ROM. A gate-level simulator runs the whole thing at about 20 kHz in a browser tab, which is slow for a CPU and absurdly fast for 14,000 parts.

What’s in the box

  • A single-cycle CPU with 4 registers and a 16-bit instruction set: load, move, add, subtract, compare, and, xor, memory, video, input, and conditional jumps.
  • 32 bytes of RAM, which is not a typo, and a 16×16 screen with 4-bit colour.
  • Snake, Rainbow, Paint, and Count, written in its own assembly, with an assembler on the page.
  • A zoomable live schematic. Dive from the CPU down to one NAND gate and watch the signal ripple through it in slow motion.

Build it yourself

There’s also a ten-level bench where you build the parts from gates, starting at NOT and working up to a memory bit. It’s how I finally understood a flip-flop, and it only took a decade.