haute.engineer

How computers work · Part 01 / End to end

One addition,
all the way down.

A computer adds two numbers. Follow that small act through a program, instructions, bits, and memory—then come back up to the result you can see.

What happens when we add?

Our machine has 8-bit values, three working registers, and a tiny invented instruction set. These are teaching stages, not clock cycles.

Conceptual 8-bit machine

Stage 01 / Input

The numbers become data.

You chose 7 and 5. A program reads those input values and represents each as an unsigned 8-bit quantity. Those bits are data; they do not say what to do with themselves.

On a real computer, input passes through software and devices. We start after that input has been interpreted as numbers.

Invented instructions · not an actual ISA

  1. 00LOAD R0, [a]
  2. 01LOAD R1, [b]
  3. 02ADD8 R2, R0, R1
  4. 03STORE [out], R2
  5. 04EMIT [out]
R0 / A—
R1 / B—
R2 / SUM—
Visible output—
1 of 6 teaching stagesNo timing implied

Eight bits. One carry at a time.

Flip a bit in A or B. Each column adds two input bits and the carry from the column to its right.

bit76543210
A
B
C in00001110
sum00001100
Stored: 12Carry out: 0Exact sum: 12
sum = A XOR B XOR carry-in
carry-out = (A AND B) OR (carry-in AND (A XOR B))
Why does 250 + 10 store 4?

Eight bits represent unsigned values from 0 through 255. The exact sum is 260, or binary 1 00000100. The low eight bits store 4; the extra bit becomes carry-out 1. The arithmetic did not change: the storage width changed what fits. Carry-out is not the same as signed overflow.

Where do transistors and gates fit?

A transistor controls electrical behavior. In digital circuits, carefully chosen voltage ranges stand for 0 and 1; the voltages themselves are physical, continuous signals. Networks of transistors implement logic gates, and gates implement structures such as this full adder.

This ripple-carry drawing is a useful construction, not a claim about an Apple CPU’s adder. Real arithmetic units use more elaborate designs to meet timing and power goals. Digital abstraction · Adders

Data has to get there.

The CPU needs operands in registers before arithmetic can use them. Where a load finds those bytes matters.

CPU registersCPU cachesRAM

The needed data is already in a CPU cache. A load can bring it into a register without fetching it from RAM for this example.

“Needs RAM” assumes the relevant CPU caches miss. A cache miss does not automatically mean disk access. Files and paging involve the operating system; they are a separate path.

Are registers, RAM, and storage the same thing?

They hold information, but serve different roles and use different circuits. Registers hold immediate working state. CPU caches commonly use SRAM. Main memory commonly uses DRAM, which needs refresh. Flash storage retains data without continuous power. One feedback-loop story does not explain every memory technology.

Our diagram groups cache levels together and omits address translation and coherence. It shows data movement, not a measured latency ratio. Memory hierarchy reference

Where is the clock?

A clock coordinates state changes in synchronous logic. It does not promise a complete instruction finishes every tick. Instructions and memory accesses have different dependencies; modern processors overlap work and can execute several operations in parallel.

The six stages are a narrative, neither CPU clock cycles nor a literal hardware pipeline.

Keep the question

Your field notes.

Explain the journey in your own words. What is still fuzzy? What would change with a wider number, or data that is not cached?

Notes stay in this browser. They do not sync to the website or another device.

Notes are stored only in this browser.

Read the originals

Sources & scope.

  1. MIT · The digital abstractionHow physical signals become reliable logical values.
  2. MIT · Arithmetic structuresFull adders, arithmetic circuits, and propagation.
  3. MIT · The memory hierarchyRegisters, caches, main memory, and locality.
  4. Apple · Addressing CPU bottlenecksModern CPU execution and memory behavior.