Turing Complete: From Logical Gates to CPU Architecture


Posted by Pierre-Edouard Guerin · 4 min read · Published on September 17, 2025

In 2021, LevelHead published Turing Complete, a game about computer science. My friend Christophe Georgescu recommended me to play it. Unfortunately, I took his advice and now I can not stop to play this game! The game challenges you to design an entire computer from scratch. You start with basic logic gates, then move on to components, memory, CPU architecture, and finally assembly programming. By the way, the game is neat and present all these concepts in a playful and intuitive way.

Truth Tables

A truth table shows how the truth or falsity of a compound statement depends on the truth or falsity of the simple statements from which it is constructed.

Example with the AND gate:

Input 1Input 2Output

Input and Output will often be represented with variable names, like in algebra. And instead of using colors, you will often see the values represented as 0/1 or False/True.

Logical Gates

It turns out tht you can build all the logic for a computer out of either NAND or NOR gates. The Apollo guidance computers, were built entirely of NOR gates. Designed in the sixties, they had only 4KB of RAM and 32KB of disk space, but guided astronauts to the moon nonetheless.

Modern computers are not built entirely of just one of the logical gates, but when applicable NAND gates are prefered over NOR, because they have less delay and occupy less area.

picture_logical_gates

NAND gate

logical_gate_nand

1 unless both inputs are 1.

Input 1Input 2Output
001
101
011
110

AND gate

logical_gate_and

1 when both inputs are 1.

Input 1Input 2Output
000
100
010
111

OR gate

logical_gate_or

1 when either input is 1

Input 1Input 2Output
000
101
011
111

NOR gate

logical_gate_nor

1 when neither inputs are 1.

Input 1Input 2Output
001
100
010
110

XOR gate

logical_gate_xor

1 when inputs are different

Input 1Input 2Output
000
101
011
110

XNOR gate

logical_gate_xnor

1 when inputs are the same.

Input 1Input 2Output
001
100
010
111

Buffer

logical_gate_buffer

Outputs this tick's input, next tick.

NOT gate

logical_gate_not

Inverts the input.

InputOutput
01
10

De Morgan's Laws

The truth tables of the four fundamental gates are symmetrical. You can convert betwee, them by inverting the input (vertical arrows) or inverting the output (horizontal arrows) as indicated by the graphic below.

demorgan_laws_schema

Notes:

  1. You can get from any basic gate to any other, at most you have to NOT both inputs and output.
  2. You can go between OR/NOR by inverting output. The same goes AND/NAND. In fact NOR means NOT OR and NAND means NOT AND. Notice the component shape of OR/NOR are identical except for the little dot at the tip which means NOT. AND/NAND are also identical except for this dot.
  3. Negating the output flips all the bits in the last row of the truth table. Negating the inputs mirrors the last row of the truth table around the center.

Arithmetic Logic Unit

Memory

CPU Architecture

Assembly

References

https://www.nand2tetris.org/

https://turingcomplete.game







Relevant Tags

About the Author