Skip to content
Tactiverge

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?

Start buildingWatch first60 min · browser only · free

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. 1.

    The bit

    A single 0 or 1. On a chip it is a voltage that is either low or high.

  2. 2.

    The gate

    A tiny circuit that makes a decision about bits. NAND alone can build every other gate.

  3. 3.

    The adder

    A few gates that add two bits and pass a carry on, exactly like column addition.

  4. 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.

□ Systems Engineer · Program the processor

Write a program for the Nibble machine (LOAD, ADD, STORE, JNZ, HALT) that multiplies M0 by M1 into M2 using only repeated addition. Step through it fetch, decode, execute, then explain why ADD 15 counts down. The server runs it on six test pairs, including zeros.

You’ll make: A program that passes every server test and a short explanation of the trick it uses.

Checked instantly on our server

The job: multiply. When the program starts, M0 = x, M1 = y, M2 = 0 and M15 = 15. When it halts, M2 must hold x × y. There is no multiply and no subtract instruction. Our server runs your program on 6 different pairs, including a zero.

Your program

  1. 00001 0000
  2. 11111 0000
The instruction set
  • LOAD A ← M[a]. Copy a memory cell into the register.
  • ADD A ← A + M[a], keeping 4 bits. C = 1 if a carry fell off.
  • STORE M[a] ← A. Copy the register into a memory cell.
  • JNZ If A was not zero (Z = 0), jump to program line a.
  • HALT Stop.
Test withx =3y =4
FetchDecodeExecute
PC
0 0000
Instruction
—
Register A = 0 (signed 0)
ZC

Press Step to fetch the first instruction.

Data memory (16 cells × 4 bits)

  1. M0 x00113
  2. M1 y01004
  3. M2 answer00000
  4. M3 00000
  5. M4 00000
  6. M5 00000
  7. M6 00000
  8. M7 00000
  9. M8 00000
  10. M9 00000
  11. M10 00000
  12. M11 00000
  13. M12 00000
  14. M13 00000
  15. M14 00000
  16. M15 −1111115

Blue = read, orange = written by the last instruction.

  1. 0: LOAD 0
  2. 1: HALT

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 guide

Safety: 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

Tell the people who built this

Optional. We’re students too, and we change things because of what you say.

Please don’t include your name or anything personal. Nothing you write is shown publicly.

Next build · 001Design a Washing Machine