Course catalogue

Lab0 / Learn, build, explore

Logic playground

Build circuits from gates. Learn a 4-bit calculator, then make it your own.

0/6 checkpoints passed · Progress saved in this browser

01 / Tiny switches

Meet the bits

A bit is a switch: off is 0, on is 1. Four switches have place values 8, 4, 2, 1, so they represent numbers from 0 to 15. The rightmost switch is bit 0. Use the A and B controls in the circuit editor. The result is computed by the gates and wires you can edit.

Your mini mission

Make A = 9: turn on the 8 and 1 switches. Make B = 3: turn on 2 and 1.

Operand A
Operand B
4-bit result 1000 = 8Carry-out: 0

The display is driven by your circuit’s wires. Change a gate or disconnect a wire to see how the result changes. SUB flips B and supplies the first carry.

Drag parts onto the canvas. Connect pins to wire.
SUB0A01B01
B0 XOR SUB
P0
SUM0
G0
H0
C1
0S0A11B10
B1 XOR SUB
P1
SUM1
G1
H1
C2
0S1A21B20
B2 XOR SUB
P2
SUM2
G2
H2
C3
0S2A30B30
B3 XOR SUB
P3
SUM3
G3
H3
C4
0S30Cout
OutputsS0 0S1 0S2 0S3 1Cout 0
Truth table

The truth table is too big for more than 4 inputs.

Pocket checkpoint

Which four bits represent decimal 9?

Choose an answer
1 / 6
Next adventure: BFS and the magical queue