← Back to Issue 2

Logic Gates Lab

From switches to circuits — build a computer from scratch

Interactive companion to Issue 2: Building the First Brains

1. Meet the Gates

Click the switches to toggle inputs. Watch the output change instantly.

2. The Half-Adder

Two gates, one addition. This is how computers add.

XOR + AND = Half-Adder

A single XOR gate computes the sum bit, and a single AND gate computes the carry bit. Toggle A and B to add two single-bit numbers.

A + B  =  00   (decimal: 0)
This is how a computer adds! Two gates = one addition.

3. The Full-Adder

Add a carry-in and you can chain adders together.

Two Half-Adders + OR = Full-Adder

A full-adder takes three inputs: A, B, and a Carry-In from the previous column. It produces a Sum and a Carry-Out, which feeds into the next column.

A + B + Cin  =  Carry-Out: 0   Sum: 0   (decimal: 0)
Chain 8 of these together and you can add any number from 0–255!

4. Binary Calculator

Toggle any bit. Watch the result ripple through four full-adders.

4-Bit Ripple-Carry Adder

Each column feeds its carry-out into the next column's carry-in, just like carrying in decimal addition. Toggle the bits below to add two 4-bit numbers.

Number A
8 4 2 1
= 0
+
Number B
8 4 2 1
= 0
Result: 00000  =  0 (decimal)
Try it: Set A = 0111 (7) and B = 0101 (5). The carry ripples all the way through to give 01100 (12)!