A digital logic course, from gates to memory to a CPU
Gates as real chips, a latch that remembers, flip-flops that count and a shift register, then adders, an ALU, RAM and a CPU built from one NAND gate.
How you will learn it
Every computer is built from logic gates, and digital logic is the subject that shows how. It starts with truth tables and ends with circuits that remember, count and compute.
Digital logic and memory is a short course on real chips on a breadboard. From gates to a computer goes all the way: one NAND gate, packaged into chips you then build the next chip from, up to a CPU of your own and a computer that runs your program.
What you will learn
- Use AND, OR, NOT, NAND and XOR gates, and build any of them from NAND.
- Make a bit persist with a latch and count with flip-flops.
- Build adders, a multiplexer, decoders and an 8-bit ALU.
- Put registers, RAM and a program counter together into a working CPU.
The courses and lessons to take
Every lesson opens in the editor right away, signed in or not, and the simulator checks each step.
- Step 1 · 4 lessons · 4 h
Digital logic and memory
Gates and memory on real chips.
- Gates, as real chipsAND, XOR and NOT with two buttons and three lamps. Fill in the truth tables by pressing, and find out what a real chip has that the symbol does not.
- One bit of memoryTwo NAND gates wired into each other hold an answer after the input goes away. The smallest memory there is, and the reason a switch stops bouncing.
- Flip-flops that countA D flip-flop wired to toggle halves a clock. Four of them in a chain count in binary, and the lamps spell out the number.
- Eight outputs from three wiresA 74HC595 driven by a clock and a switch, with no processor anywhere. Load a pattern by hand, watch it march, and find out what the latch is for.
- Step 2 · 23 lessons · 16 h
From gates to a computer
From one NAND gate to a computer.
- The one gateMeet 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.
- Carrying: the full adderAdd 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.
- The 8-bit ALUEight ALU slices in a carry chain, a zero detector and a carry flag: the ALU the Kestrel CPU computes with.
- RAM: memory with addressesEight 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.
- Your first computerA 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.
Guides and tools on the same subject
Build a computer from NAND gates
Open itLogic gate simulator
Open itElectrical 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 the whole trackQuestions people ask
Is digital logic hard to learn?
The first ideas are simple: a gate is a small rule about ones and zeros. It gets deep as you combine them, which is why the course builds one chip at a time.
Can you really build a CPU from NAND gates?
Yes. From gates to a computer starts with one NAND gate and ends with a CPU that runs a program you write, every part built from the ones before it.
Is this useful for a computer science degree?
Yes. Digital logic and computer organization are core classes, and building the parts yourself makes them much easier.