Source: https://mokxi.com/learn/path/gates-to-computer
Updated: 2026-11-11

All paths

# From gates to a computer

Start with one NAND gate, package every circuit you build into a chip, and use your chips to build the next one: an adder, memory, a CPU of your own, and a computer that runs your program.

Free 23 lessons 16 h 6 chapters 5,251 XP Electrical · Advanced +250 XP

0 of 23 done

Start the course free The one gate Lesson plan for teachers

What you will build

## 5 projects, built step by step

23 lessons in 6 chapters, about 16 hours on a simulated breadboard. Free, in your browser, every step checked by the simulator.

Chapter 1 project

### XOR from four NANDs

The gate that says "one or the other, not both", built from exactly four NAND gates. It is the heart of every adder you will build next.
Open it in the simulator

Chapter 3 project

### An 8-bit adder

Two 4-bit adders make an 8-bit one: the adder a small computer uses, all 120 NAND gates of it. The end of the first milestone.
Open it in the simulator

Chapter 4 project

### The 8-bit ALU

Eight ALU slices in a carry chain, a zero detector and a carry flag: the ALU the Kestrel CPU computes with.
Open it in the simulator

Chapter 5 project

### The register file

Four registers with one write port and two read ports: the CPU reads two registers and writes one back, all in the same tick.
Open it in the simulator

Chapter 6 project

### Your first computer

A step clock, a program ROM, your Kestrel and a terminal on one canvas: a computer built from NAND gates, running a program you can change.
Open it in the simulator

The map

## Chapter by chapter

Each lesson opens when the one before it is done, and each chapter ends in a project.

Chapter 1

## One gate, every gate

Make NOT, AND, OR and XOR out of NAND gates, and package each one.

Open 166 XP

### The one gate

Meet the NAND gate, the only gate you need. Wire it between two switches and a lamp, read its truth table, and see why every other gate can be built from it.

0 of 4 steps

Start What is in it

Locked 166 XP

### NOT from NAND, and your first chip

Build a NOT gate out of one NAND, test it against its table, and package it into a chip with your name on it, ready for the next lesson.

0 of 4 steps

Locked 227 XP

### AND and OR

Undo the "not" in NAND to make AND, then turn a NAND inside out with two NOTs to make OR. Two chips, both from NAND gates.

0 of 5 steps

Project Locked 332 XP

### XOR from four NANDs

The gate that says "one or the other, not both", built from exactly four NAND gates. It is the heart of every adder you will build next.

0 of 4 steps

Chapter 2

## Choosing

Build the gates that decide which signal goes where.

Locked 227 XP

### Choosing with MUX and DEMUX

A MUX picks one of two inputs with a select bit, and a DEMUX sends one input to one of two outputs. The switchboard of every processor.

0 of 5 steps

Chapter 3

## Adding

Add one bit, then three, then four and eight at once.

Locked 189 XP

### Adding one bit

Add two bits and get a sum and a carry. The half adder is an XOR and an AND side by side, and it is where arithmetic starts.

0 of 4 steps

Locked 189 XP

### Carrying: the full adder

Add three bits, the two you are adding and the carry from the column before. Two half adders and an OR make a full adder, the building block of every adder.

0 of 4 steps

Locked 189 XP

### Four bits at once

Chain four full adders, carry out to carry in, and add two 4-bit numbers. Number switches and a number display show the values in decimal and hex.

0 of 4 steps

Project Locked 408 XP

### An 8-bit adder

Two 4-bit adders make an 8-bit one: the adder a small computer uses, all 120 NAND gates of it. The end of the first milestone.

0 of 5 steps

Chapter 4

## Eight bits wide

Choose, count and compute a byte at a time, up to an ALU.

Locked 189 XP

### Choosing a whole byte

Eight MUX chips side by side, one select line for all of them: a chip that picks one of two bytes. The CPU uses one at every fork in its data.

0 of 4 steps

Locked 189 XP

### Adding one

An 8-bit adder with one input tied to 0 and its carry in tied to 1 adds one to anything. Meet the constant bit, and build the chip a program counter counts with.

0 of 4 steps

Locked 227 XP

### Decoders: one line out of many

Turn a 2-bit number into one of four lines, then a 3-bit number into one of eight, from DEMUX chips. A decoder is how memory finds the one byte a write is for.

0 of 5 steps

Locked 166 XP

### One bit of an ALU

An arithmetic logic unit does one of eight jobs, chosen by a 3-bit code. Build one bit of it: an adder that can subtract, four logic gates, and a MUX tree that picks the answer.

0 of 4 steps

Project Locked 378 XP

### The 8-bit ALU

Eight ALU slices in a carry chain, a zero detector and a carry flag: the ALU the Kestrel CPU computes with.

0 of 4 steps

Chapter 5

## Memory

Latches, flip-flops, registers, a program counter, RAM and a register file.

Locked 189 XP

### Remembering a bit

Two NAND gates wired into each other remember which one was pushed last. Build the set-reset latch, then the D latch that copies a bit and holds it.

0 of 4 steps

Locked 166 XP

### The flip-flop and the clock

Two D latches, one open while the other is shut, make a flip-flop: it takes its input at the instant the clock rises and at no other time. Everything in a computer moves on that edge.

0 of 4 steps

Locked 227 XP

### Registers

A flip-flop and a MUX make a bit that loads only when told to. Eight of them make a register, the byte-sized memory every CPU is full of.

0 of 5 steps

Locked 189 XP

### The program counter

A register that adds one to itself on every tick, loads a new value to jump, and clears to 0 on reset. It is how a CPU knows which instruction comes next.

0 of 4 steps

Locked 166 XP

### RAM: memory with addresses

Eight registers, a decoder that sends a write to one of them, and a MUX tree that reads one back: eight bytes of memory you can address.

0 of 4 steps

Project Locked 332 XP

### The register file

Four registers with one write port and two read ports: the CPU reads two registers and writes one back, all in the same tick.

0 of 4 steps

Chapter 6

## The Kestrel

Decode instructions, build a CPU, and run your own program on it.

Locked 166 XP

### Decoding instructions

The Kestrel has sixteen instructions. The control unit turns each 4-bit opcode into the signals that steer the ALU, the registers, the memory and the jumps.

0 of 4 steps

Locked 166 XP

### The Kestrel CPU

The control unit, the register file, the ALU, the RAM and the program counter on one canvas, one instruction a tick. Package it and the tester runs a program on it.

0 of 4 steps

Project Locked 408 XP

### Your first computer

A step clock, a program ROM, your Kestrel and a terminal on one canvas: a computer built from NAND gates, running a program you can change.

0 of 5 steps

Syllabus

## Every lesson in the course

All 23 lessons, in order, each with what it covers. Any of them opens in the editor right away.

Chapter 1

### One gate, every gate

- The one gate Meet the NAND gate, the only gate you need. Wire it between two switches and a lamp, read its truth table, and see why every other gate can be built from it.
- NOT from NAND, and your first chip Build a NOT gate out of one NAND, test it against its table, and package it into a chip with your name on it, ready for the next lesson.
- AND and OR Undo the "not" in NAND to make AND, then turn a NAND inside out with two NOTs to make OR. Two chips, both from NAND gates.
- XOR from four NANDs The gate that says "one or the other, not both", built from exactly four NAND gates. It is the heart of every adder you will build next.

Chapter 2

### Choosing

- Choosing with MUX and DEMUX A MUX picks one of two inputs with a select bit, and a DEMUX sends one input to one of two outputs. The switchboard of every processor.

Chapter 3

### Adding

- Adding one bit Add two bits and get a sum and a carry. The half adder is an XOR and an AND side by side, and it is where arithmetic starts.
- Carrying: the full adder Add three bits, the two you are adding and the carry from the column before. Two half adders and an OR make a full adder, the building block of every adder.
- Four bits at once Chain four full adders, carry out to carry in, and add two 4-bit numbers. Number switches and a number display show the values in decimal and hex.
- An 8-bit adder Two 4-bit adders make an 8-bit one: the adder a small computer uses, all 120 NAND gates of it. The end of the first milestone.

Chapter 4

### Eight bits wide

- Choosing a whole byte Eight MUX chips side by side, one select line for all of them: a chip that picks one of two bytes. The CPU uses one at every fork in its data.
- Adding one An 8-bit adder with one input tied to 0 and its carry in tied to 1 adds one to anything. Meet the constant bit, and build the chip a program counter counts with.
- Decoders: one line out of many Turn a 2-bit number into one of four lines, then a 3-bit number into one of eight, from DEMUX chips. A decoder is how memory finds the one byte a write is for.
- One bit of an ALU An arithmetic logic unit does one of eight jobs, chosen by a 3-bit code. Build one bit of it: an adder that can subtract, four logic gates, and a MUX tree that picks the answer.
- The 8-bit ALU Eight ALU slices in a carry chain, a zero detector and a carry flag: the ALU the Kestrel CPU computes with.

Chapter 5

### Memory

- Remembering a bit Two NAND gates wired into each other remember which one was pushed last. Build the set-reset latch, then the D latch that copies a bit and holds it.
- The flip-flop and the clock Two D latches, one open while the other is shut, make a flip-flop: it takes its input at the instant the clock rises and at no other time. Everything in a computer moves on that edge.
- Registers A flip-flop and a MUX make a bit that loads only when told to. Eight of them make a register, the byte-sized memory every CPU is full of.
- The program counter A register that adds one to itself on every tick, loads a new value to jump, and clears to 0 on reset. It is how a CPU knows which instruction comes next.
- RAM: memory with addresses Eight registers, a decoder that sends a write to one of them, and a MUX tree that reads one back: eight bytes of memory you can address.
- The register file Four registers with one write port and two read ports: the CPU reads two registers and writes one back, all in the same tick.

Chapter 6

### The Kestrel

- Decoding instructions The Kestrel has sixteen instructions. The control unit turns each 4-bit opcode into the signals that steer the ALU, the registers, the memory and the jumps.
- The Kestrel CPU The control unit, the register file, the ALU, the RAM and the program counter on one canvas, one instruction a tick. Package it and the tester runs a program on it.
- Your first computer A step clock, a program ROM, your Kestrel and a terminal on one canvas: a computer built from NAND gates, running a program you can change.

Keep going

## The next course on your track

From gates to a computer is part of the electrical track, a ladder of courses from zero to expert.

Next course

### Breadboard to PCB

Take three working circuits from the breadboard to a finished board: the schematic, footprints, placement, routing, design rules, and what a board house needs.
Open the next course

Track

### Electrical track

Current and voltage you can see, then transistors, op-amps, filters, power and PCBs. Every circuit runs in a real circuit simulator in your browser.
See every course on the track

Kits

## Build it on your bench too

Every lesson runs in the simulator with nothing to buy. When you want the real thing, these kits have the parts.

Have a kit already?

### Find your kit

Pick the starter kit you own and run every lesson in its manual with the same parts on the same pins.
See every kit

Questions

## About From gates to a computer

Is From gates to a computer free?

Yes. All 23 lessons of From gates to a computer are free and run in your browser, with nothing to install and no parts to buy before you start.

Do I need any parts?

No. Every circuit is built on a simulated breadboard, and the simulator checks each step as you go. When you want to build it for real, the same parts and wiring work on a real bench.

How long does From gates to a computer take?

About 16 hours: 23 lessons in 6 chapters, each one a few short steps. Your progress is kept, so you can stop after any lesson and pick up where you left off.

What will I build?

Each chapter ends in a project that puts it together: XOR from four NANDs, An 8-bit adder, The 8-bit ALU, The register file and Your first computer.

Where do I start?

With "The one gate", and each lesson builds on the one before it. New to circuits? Electronics basics is the course that starts from zero.
