A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

CPU Pipelining

College Depth 101 in the knowledge graph ☐ I know this ☆ Set as goal
7topics build on this
366prerequisites beneath it
See this on the map →
CPU DatapathInstruction Fetch-Decode-Execute Cycle+5 more→→CPU Performance Metrics and Amdahl's LawHazards in Pipelined Processors+3 more
pipelining throughput latency RISC stages

Core Idea

Pipelining overlaps the execution of multiple instructions by dividing the CPU datapath into stages — typically Fetch, Decode, Execute, Memory, and Write-back — and processing a different instruction in each stage simultaneously. While the latency of a single instruction stays the same or increases slightly, throughput approaches one instruction completed per clock cycle (ideal CPI = 1). Pipelining is the primary reason RISC designs with uniform instruction formats are efficient; the fixed-length instruction encoding allows stage work to be balanced and pipelined cleanly.

How It's Best Learned

Draw a pipeline timing diagram for a 5-stage pipeline executing 8 instructions. Count total cycles and compute CPI. Compare to a non-pipelined processor executing the same sequence. Identify how stage boundaries in the datapath require pipeline registers to hold intermediate values.

Common Misconceptions

Explainer

You already understand the CPU datapath — the hardware that fetches an instruction, decodes it, executes it through the ALU, accesses memory if needed, and writes the result back to a register. In a simple non-pipelined processor, these five steps happen sequentially for each instruction: the entire datapath sits idle while one stage does its work, then the next stage takes over. Pipelining eliminates this waste by letting different instructions occupy different stages simultaneously, like an assembly line in a factory.

Imagine a laundry analogy: washing takes 30 minutes, drying takes 30 minutes, and folding takes 30 minutes. Without pipelining, you finish one load completely (90 minutes) before starting the next. With pipelining, you start washing load 2 as soon as load 1 moves to the dryer, and start washing load 3 when load 2 moves to the dryer and load 1 moves to folding. After the initial fill-up time, you complete one load every 30 minutes instead of every 90. The throughput triples even though each individual load still takes 90 minutes (latency is unchanged). This is exactly what happens in a pipelined CPU: after the pipeline fills, one instruction completes every clock cycle.

The classic five-stage pipeline divides execution into Instruction Fetch (IF), Instruction Decode (ID), Execute (EX), Memory Access (MEM), and Write Back (WB). Between each stage, pipeline registers capture and hold the intermediate results — the fetched instruction bits, the decoded register values, the ALU output, the memory read data — so that each stage can work independently on its own instruction. The clock period is set by the slowest stage, not the total path length. If the longest stage takes 200 picoseconds instead of the 800-picosecond total path, the clock runs roughly four times faster, and throughput improves correspondingly.

Pipelining works best when every instruction follows the same format and takes the same stages — which is exactly the design philosophy of RISC (Reduced Instruction Set Computer) architectures. Fixed-length instructions mean the fetch stage always knows where the next instruction starts. Uniform instruction formats mean the decode stage always finds register specifiers in the same bit positions. This regularity keeps the pipeline stages balanced and simple. CISC architectures like x86, with variable-length instructions and complex addressing modes, must work much harder to achieve efficient pipelining, often by translating complex instructions into simpler micro-operations internally.

The ideal of one instruction per cycle is disrupted by pipeline hazards — situations where the next instruction cannot proceed because it depends on a result still moving through the pipeline. These hazards (data, control, and structural) are a direct consequence of overlapping execution, and managing them is the central challenge of pipelined processor design. But even with hazard penalties, pipelining delivers such dramatic throughput improvements that every modern processor uses it. The five-stage pipeline is the foundation; real processors extend it to 10, 15, or even 20+ stages to push clock speeds higher, trading increased hazard complexity for faster clocks.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → The Distributive Property → Variables and Expressions Review → Introduction to Polynomials → Adding and Subtracting Polynomials → Multiplying Polynomials → Factorial → Permutations → Combinations → Counting Principles: Addition and Multiplication Rules → Introduction to Graph Theory → Propositional Logic Foundations → Logical Equivalences → Boolean Algebra → Boolean Type and Truth Values → Comparison Operators and Boolean Tests → Logical Operators and Boolean Algebra → Boolean Algebra and Fundamental Laws → Logic Gates Fundamentals → Implementing Boolean Functions with Gates → Karnaugh Map Simplification → Combinational Circuit Design → Flip-Flops and Latches → Binary Counters: Design and Analysis → Binary Arithmetic → Fixed-Point Number Representation → Two's Complement Representation → Overflow and Underflow Detection → Binary Adders: Half-Adders and Full-Adders → Full Adder and Carry Propagation → Carry Lookahead Adder Design → Half Adder Circuit Design → Multiplication Circuit Design → Sequential Circuit Design → Registers and Register Files → Instruction Set Architecture (ISA) → Assembly Language Basics → CPU Datapath → Instruction Fetch-Decode-Execute Cycle → CPU Control Unit → Microinstruction Format and Control Signals → Hardwired vs. Microprogrammed Control → Processor Control Unit Design → Finite State Machines in Processor Control → Single-Cycle Processor Architecture → Multi-Cycle Processor Design and Execution States → CPU Pipelining

Longest path: 102 steps · 366 total prerequisite topics

Prerequisites (7)

Leads To (5)