Tactiverge BuildBUILD 008
Create a Virtual Computer
Every app, game and website comes down to switches that are either on or off. Can you wire a handful of logic gates into a machine that actually adds numbers?
Live build-along: not scheduled yet. Everything here works on your own, any time.
Why it matters
Every processor, from a microwave's controller to a games console, is built from logic gates doing very simple things very fast. Understanding how a few gates add two numbers takes the magic out of computers and is the first step in computer engineering, chip design and embedded systems.
Your objective: Build up a computer from the bottom in a browser simulation: represent numbers in binary, build gates from NAND, watch a carry ripple through a 4-bit adder, then program a tiny 4-bit processor that fetches, decodes and executes your instructions one at a time.
- 1.
The bit
A single 0 or 1. On a chip it is a voltage that is either low or high.
- 2.
The gate
A tiny circuit that makes a decision about bits. NAND alone can build every other gate.
- 3.
The adder
A few gates that add two bits and pass a carry on, exactly like column addition.
- 4.
The processor
Adders, memory and a control unit that fetches, decodes and executes one instruction after another.
Watch (optional, short)
Hand-picked explainers from their creators. Each one has a reason to watch it. Skip them if you’d rather just build.
Shows how ones and zeros can stand for numbers and text, so binary stops feeling like magic.
10 min 45 s · captions on YouTube · source
Nothing loads from YouTube until you press play.
Introduces AND, OR, NOT and XOR, the building blocks behind every digital decision a computer makes.
10 min 7 s · captions on YouTube · source
Nothing loads from YouTube until you press play.
Shows step by step how a handful of gates add binary numbers, using real chips you can buy.
13 min 38 s · captions on YouTube · source
Nothing loads from YouTube until you press play.
The engineering you’ll use
Binary place value
Each place is worth twice the one to its right. 1101 is 8 + 4 + 0 + 1 = 13.
value = Σ bitᵢ · 2ⁱ
Fixed width and overflow
With n bits you can store 0 to 2ⁿ − 1, so 4 bits hold 0 to 15. Adding 1111 + 0001 gives 10000, and the fifth bit falls off: overflow.
range = 0 … 2ⁿ − 1
Universal NAND
NAND with both inputs joined is NOT. Every other gate can be built from NANDs, which is why it matters to chip makers.
NOT A = A NAND A
Half adder
Adding two bits: the sum bit is 1 when exactly one input is 1, and the carry is 1 when both are.
S = A ⊕ B, C = A · B
Full adder and ripple carry
A full adder also takes a carry in. Chain n of them, each carry feeding the next, to add n-bit numbers. The carry has to ripple through, adding two gate delays per bit in the design we build.
S = A ⊕ B ⊕ Cin, Cout = A·B + Cin·(A ⊕ B)
Two's complement
In 4 bits, 1111 can mean 15 or −1: adding 1111 to any number carries out of the top bit and leaves one less. That is how a machine with only an adder can count down and subtract.
−x ≡ 2ⁿ − x
Fetch, decode, execute
A processor repeats one cycle: fetch the instruction the program counter points at, decode its opcode, execute it (often using the adder), then move on. Our Nibble machine has one register A, a zero flag and a carry flag, and five instructions: LOAD, ADD, STORE, JNZ and HALT.
Connects to: Binary, hexadecimal and digital signals · Fixed-width integers, bits and registers · Logic gates and Boolean algebra · Sequential logic and memory · Inside a microcontroller · Functions and decomposition · Testing and debugging · Algorithms, searching and complexity · Decisions and loops
Same machine. Five ways in.
Pick the level that feels like a stretch, not a wall. You can switch any time, and your work saves to your Workshop.
✦ Research Engineer · Investigate speed
Ask one question (for example, how does the longest gate path of a ripple-carry adder grow with the number of bits, and what does carry lookahead cost to beat it?). Record at least four adder sizes, which the server builds from gates, checks and measures, hold everything else fixed, and write a short technical report.
You’ll make: A results table for four or more sizes and a report with a hypothesis, method, results and limits, reviewed by a person.
Reviewed by a person
Our server builds the adder you choose out of real gates, checks it adds correctly, and measures it. Faster carries cost gates: how much, and is it worth it?
- Gates
- 20
- Depth (as drawn)
- 9
- Depth (2-input gates)
- 9
- Widest gate
- 2 inputs
Each carry waits for the one before it.
Sign in to record runs.
At the live build-along
60 minutes, building together
- Team challenge
- Teams of three build the half adder together, then each member checks a different half of the truth table and the team proves it is right for every row. No leaderboard: every team that gets there explains how they know it works.
- Your own design
- On your own: build XOR from as few NAND gates as you can, then explain in plain words why it works.
- Questions
- Moderated questions in the live room. Questions are answered on screen without names, and chat stays off.
- Extension
- Our adder has no memory: change the inputs and the answer changes. Research what a flip-flop does and sketch where one would sit in a computer that adds a list of numbers one at a time.
- You leave with
- A saved set of passing circuits (NOT, XOR and a half adder), a checked full adder, a multiply program that runs on the server and a written explanation of overflow, stored in your Workshop and counted toward your Passport.
For educators & facilitators
A complete run of show, misconceptions, safety notes and a printable worksheet.
Open the facilitator guideSafety: Browser simulation and paper design only. Never open a computer, phone or power supply, and keep any breadboard work to low-voltage battery kits checked by an adult. Any physical extension needs an adult's safety review and supervision before anyone starts.
Go further
- → Playground: digital logic
- → Atlas: binary and hexadecimal
- → Atlas: logic gates
- → Atlas: microcontroller architecture
- → Try BUILD 003 (Create an Intelligent Sorting Machine) to use the same gates to make decisions.
- → Playground: digital logic. Try the 2:1 multiplexer, the circuit a processor uses to choose between values.
- → Atlas: sequential logic and memory, the step from an adder to a computer that remembers.
- → Atlas: fixed-width integers, for how programs deal with overflow.