Control Unit and Clock
CPU Basics · Foundations track
3 min read
In this module
The Orchestrator
The ALU can add, subtract, and perform logic. What it can't do is decide what to do or when to do it. That job belongs to the control unit. The control unit reads each instruction, works out which parts of the CPU need to activate, and sends the right signals at the right moments.
Think of it as a conductor directing an orchestra. The musicians (ALU, registers, memory interface) know how to play; the conductor tells them when and what.
What the Control Unit Does
For every instruction, the control unit:
- Directs the fetch by telling memory which address to read.
- Decodes the instruction, identifying the operation type and which operands are involved.
- Sends control signals that activate the ALU, select registers, open data paths, and trigger writes.
It performs no calculations itself. Its job is coordination, making sure the right data flows to the right place at the right moment.
The control unit doesn't compute. It coordinates. It reads instructions, decodes them, and sends signals that tell the ALU, registers, and memory what to do and when.
The Clock: Heartbeat of the CPU
Every action the control unit takes is synchronised to the clock signal, a square wave that alternates between high and low at a fixed frequency. One full period, from one rising edge (low to high) to the next, is one clock cycle.
On each tick, the control unit advances to the next step of the current instruction or kicks off the next one. Without the clock, the CPU's components would have no shared sense of timing. The clock keeps everything in lockstep.
Clock Speed vs. Performance
A 4 GHz clock ticks four billion times per second. Sounds fast, and it is, but clock speed alone doesn't determine performance. Two processors at the same clock speed can have wildly different throughput depending on how much work each one squeezes into a cycle.
Enter pipelining. Instead of finishing one instruction before starting the next, a pipelined CPU overlaps the stages. While one instruction is executing, the next is being decoded, and the one after that is being fetched, all at the same time. Pipelining doesn't make any single instruction faster, but it dramatically increases the number of instructions completed per second.
The visualiser below runs three independent instructions through a five-stage pipeline: fetch (F), decode (D), execute (E), memory access (M) and writeback (W). Step through it one clock cycle at a time. Each instruction still needs five cycles from start to finish, but a new one enters every cycle, so all three are done after 7 cycles. Without the overlap they'd need 3 × 5 = 15.
Instructions
| Cycle | F | D | E | M | W |
|---|---|---|---|---|---|
| 1 | ADD R1, R2, R3 | - | - | - | - |
| 2 | SUB R4, R5, R6 | ADD R1, R2, R3 | - | - | - |
| 3 | AND R7, R8, R9 | SUB R4, R5, R6 | ADD R1, R2, R3 | - | - |
| 4 | - | AND R7, R8, R9 | SUB R4, R5, R6 | ADD R1, R2, R3 | - |
| 5 | - | - | AND R7, R8, R9 | SUB R4, R5, R6 | ADD R1, R2, R3 |
| 6 | - | - | - | AND R7, R8, R9 | SUB R4, R5, R6 |
| 7 | - | - | - | - | AND R7, R8, R9 |
The instructions here don't depend on each other on purpose. When one needs a result the previous one hasn't finished yet, the pipeline has to wait, and that's a story for the later modules.
We'll revisit pipelining in later modules. For now, the takeaway: the clock drives the rhythm, and the control unit rides that rhythm to keep the entire CPU moving in sync.
Try the Simulations
Add Two Numbers
Load two values into registers and add them together. The simplest possible program.
Understanding CPU Flags
Run several comparisons and watch how the CPU flags change. Equal values set the zero flag, smaller-than sets the negative flag - flags are how the CPU remembers comparison results.