Skip to content
Tactiverge

BUILD 008: Create a Virtual Computer

Facilitator guide · 60 minutes · free to reuse with attribution

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

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.

Before the session

  • Open /build/virtual-computer/ and complete Levels 2 and 4 yourself: build the three circuits and get a multiply program to pass.
  • In Level 3, ripple 1111 + 0001 on the settle clock so you can show the carry crawling across the adder.
  • Decide teams of three in advance. Learners who join alone can pair with the facilitator.
  • Check the live room link works, chat is off and the moderated question box is on.

Run of show

  1. 5 minHook. Show 0110 + 0111 worked as column addition. Ask: could a few switches do this on their own?
  2. 10 minBinary and bits. Place value, conversions and overflow. Level 1 learners do the conversions now.
  3. 10 minThe ideas. NAND as NOT, the half adder truth table and carry. Build NOT from NAND together on screen.
  4. 12 minGroup challenge. Teams build and prove the half adder. Ask each team to show you the row that needs the carry.
  5. 10 minDesign task. Individually, XOR from NAND. Learners on other levels work on their own level task.
  6. 8 minQuestions. Answer moderated questions, then set the flip-flop extension.
  7. 5 minReflect & save. Everyone saves their circuits and writes one sentence: what surprised you about how a computer adds?
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.
Individual design task
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.

Five levels, one project

LevelTaskEvidence
ExplorerUse the 4-bit register: show 13, 6 and 9 on the lamps, turn 1010 and 0111 back into numbers, find the largest number 4 bits can hold, and predict what a register holding 1111 shows after you add 1.
Makes: Seven correct answers, including the overflow.
Answer key: 1101, 0110, 1001; 10, 7; 15; 0000 (the carry falls off the top).
Checked by the facilitator against the answer key
BuilderIn the circuit builder, wire NOT from one NAND, XOR from at most four NANDs, and a half adder from at most two gates. Toggle the inputs to watch signals light up and read your live truth table; the server checks every row.
Makes: Three passing circuits within the gate limits.
Answer key: NOT: NAND(A, A). XOR: g1 = NAND(A, B), g2 = NAND(A, g1), g3 = NAND(B, g1), Y = NAND(g2, g3). Half adder: S = XOR(A, B), C = AND(A, B).
Checked by the facilitator against the answer key
InnovatorFill in the full adder truth table, find two 4-bit numbers whose carry has to ripple through all four columns (watch it on the settle clock), and work out how many gate delays the 4-bit ripple adder needs before its carry out is certain.
Makes: A correct truth table, a full-ripple pair and the delay.
Answer key: Rows 000 to 111 give Cout S = 00, 01, 01, 10, 01, 10, 10, 11. Any pair with A0 = B0 = 1 and the two bits different in columns 1 to 3, for example 0111 + 1001 or 1111 + 0001. 9 gate delays: 1 for the first XOR, then 2 per bit.
Checked by the facilitator against the answer key
Systems EngineerWrite 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.
Makes: A program that passes every server test and a short explanation of the trick it uses.
Answer key: LOAD 2, ADD 0, STORE 2, LOAD 1, ADD 15, STORE 1, JNZ 0, HALT (M15 holds 15). 1111 is −1 in 4-bit two's complement: adding it carries out of the top bit and leaves one less. y = 0 still works: the loop runs 16 times and 16·x wraps to 0.
Checked by the facilitator against the answer key
Research EngineerAsk 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.
Makes: A results table for four or more sizes and a report with a hypothesis, method, results and limits, reviewed by a person.
Reviewed by an adult

Common misconceptions

  • ✗ “Binary is a code that only computers understand.”
    ✓ It is ordinary place value with base 2 instead of base 10. You can do it on paper exactly like column addition.
  • ✗ “The sum of two bits is just OR.”
    ✓ OR gives 1 for 1 + 1, but 1 + 1 is 10 in binary: sum 0, carry 1. The sum bit is XOR.
  • ✗ “A computer adds big numbers in one step.”
    ✓ In a ripple-carry adder the carry has to pass through every bit in turn, which is why faster carry designs exist.
  • ✗ “A computer needs a separate circuit to subtract.”
    ✓ It can add the two's complement instead: in 4 bits, adding 1111 is the same as taking away 1. Real processors reuse the adder this way.
  • ✗ “Overflow means the computer has crashed.”
    ✓ It means the answer needs more bits than you have. The hardware usually just drops the extra bit, which is why programs must check for it.

Accessibility

Truth tables are real tables that screen readers can read, and every gate is labelled in text as well as by symbol. Every lamp, gate and memory cell is a labelled button or select that works by keyboard; animations (signals, the rippling carry, fetch-decode-execute) have a reduced-motion version and a step-by-step control, and it all runs on a low-cost phone. Binary conversions come with a place-value grid to follow.

BUILD 008 worksheet: a computer from switches

Name: ______________________ Level: ____________

  1. Convert 13 to 4-bit binary and 1010 to decimal. Show your place-value working.
  2. What is the largest number 8 bits can hold? Explain using 2ⁿ − 1.
  3. Draw NOT made from a NAND gate. Fill in its truth table to prove it works.
  4. Write the truth table for a half adder (inputs A, B; outputs S, C). Which gate gives S and which gives C?
  5. Add 0110 + 0111 in binary, showing every carry. Check your answer in decimal.
  6. What happens when a 4-bit adder adds 1111 + 0001? Why might that matter in a program?
  7. The Nibble machine has no subtract instruction. Show in binary why ADD 15 takes 1 away from 0101.

Follow-up

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