Skip to content
Semitree

Chip Architecture

0%

C · Chip ArchitectureWritten lessonSimulationInteractive 3D modelKnowledge checkQuiz

How a processor runs an instruction

Fetch, decode, execute, memory and write-back: follow one instruction through a processor core and its caches.

Before this: Architecture

Explain it at
Simple explanations and analogies.

Explanation

Beginner

Think of it like this: A processor is like a kitchen following a recipe card. It fetches the next line of the recipe, works out what it means, does the cooking step, fetches ingredients from the fridge (memory) if needed, and puts the result on the counter (a register) for the next step.

A program is a long list of simple instructions, like ‘add these two numbers’ or ‘load a value from memory’.

The processor repeats the same cycle for each instruction: fetch it, decode it, execute it, access memory if needed, and write back the result.

Memory far away from the processor is slow, so processors keep small, fast copies of recently used data close by. These are called caches.

Intermediate

The control unit fetches the instruction from the instruction cache using the program counter, decodes its fields (operation, source and destination registers), and steers the operands from the register file into the arithmetic logic unit (ALU).

Loads and stores go to the data cache. A hit returns data in a few cycles; a miss goes to the next cache level and, eventually, to DRAM, which can take hundreds of cycles.

Real processors pipeline these stages so several instructions are in flight at once, and modern cores also issue several instructions per cycle and execute them out of order.

Advanced

The classic five-stage pipeline (IF, ID, EX, MEM, WB) introduces data and control hazards, handled by forwarding, stalls and branch prediction (Hennessy and Patterson).

Average memory access time = hit time + miss rate × miss penalty, applied at each cache level. Because DRAM latency has improved far more slowly than processor speed (the ‘memory wall’), cache hierarchy design dominates performance for many workloads.

Multicore chips keep private L1/L2 caches coherent with a protocol (e.g. MESI variants) over an on-chip interconnect such as a ring or mesh, with a shared last-level cache and memory controllers at the edge.

The explorer's processor is unpipelined and runs a toy six-instruction set so each stage can be seen on its own; it is a teaching model, not a real microarchitecture.

SimulationCPU architecture explorer · 3D

Step one instruction through a core

Run a short program one stage at a time.

Try this: Step through a load instruction and watch whether it hits in the L1 data cache or misses to memory.

  1. Press Step to fetch the first instruction.
  2. Keep stepping and watch the data move between the registers, ALU and caches.
  3. Find a load that misses the cache and see how far it travels.
Open the CPU architecture explorer →
Interactive 3D modelCPU architecture explorer · 3D

Find the ALU

The part of the core that does arithmetic and logic.

Try this: Select the ALU in core 0 and read what it does.

Open the CPU architecture explorer →

Check your understanding

A quick self-check. Nothing is recorded.

Question 1

Put in order

Put the stages of the instruction cycle in order.

  1. 1.Execute
  2. 2.Fetch
  3. 3.Memory access
  4. 4.Decode
  5. 5.Write back
Question 2

Multiple choice

Why do processors have caches?

Key terms

Key takeaways

  • Every instruction goes through fetch, decode, execute, memory and write-back.
  • Caches hide the long delay of main memory by keeping recently used data close to the core.
  • Real cores overlap these stages (pipelining) and run several instructions at once.

Quiz · 5 questions

Chip architecture check →

Packages, cores, caches and gates.

References

  1. J. L. Hennessy and D. A. Patterson, Computer Architecture: A Quantitative Approach, 6th ed. (Morgan Kaufmann, 2017)
  2. W. A. Wulf and S. A. McKee, Hitting the memory wall: implications of the obvious (ACM SIGARCH Computer Architecture News, vol. 23, no. 1, 1995)

The 3D models and simulations are simplified teaching aids. Proportions, colours and some thicknesses are not to scale; each lab says what it simplifies.

My notes

Private to you. They also appear on your dashboard.

Continue learning

How a processor runs an instruction

Up next

Logic gates from transistors

Chip Architecture

How pairs of n-type and p-type transistors make NOT, NAND and NOR gates, and why NAND alone can build any circuit.

Continue learning →