What is Pipelining?

A method that splits instruction processing into stages such as fetch, decode and execute, and processes several instructions at once, each offset by a stage.

Field: CPUs and architecture

Japanese name: パイプライン処理

5-stage pipeline and a load-use hazard bubble Time (clock) 1 2 3 4 5 6 7 8 9 Instruction lw x1, 0(x2) IF ID EX MEM WB add x3, x1, x4 IF ID Bubble EX MEM WB sub x5, x6, x7 IF ID EX MEM WB or x8, x9, x10 IF ID EX MEM WB add uses x1 right after lw loads it (load-use hazard) Even with forwarding (arrow), a 1-cycle bubble remains Without stalls, one instruction completes per clock IF fetch · ID decode & register read EX execute · MEM memory access · WB write-back
5-stage pipeline and a load-use hazard bubble · View in diagrams

How a pipeline raises throughput

A pipeline splits instruction processing into stages separated by registers, like an assembly line. The classic five-stage RISC pipeline uses instruction fetch, decode and register read, execute, memory access and write-back. While one instruction executes, the next is being decoded and a third fetched, so ideally one instruction completes every clock and throughput approaches five times that of an unpipelined design. The latency of an individual instruction does not shrink and actually grows slightly, because every instruction now passes through all the pipeline registers.

Why the speedup falls short

The clock period must cover the slowest stage plus register overhead: clock-to-Q delay, setup time and clock skew. If logic cannot be divided evenly, the longest stage sets the frequency and the others idle for part of each cycle. Deeper pipelines shorten each stage, but the fixed register overhead becomes a larger fraction of the period, and the penalty for mispredicted branches grows because more partially processed instructions must be discarded. Beyond a point, adding stages lowers performance and raises power, which is why pipeline depth is a balanced design choice.

Hazards and how they are handled

Three kinds of hazard interrupt the ideal flow. Structural hazards arise when two instructions need the same resource in the same cycle. Data hazards arise when an instruction needs a result that has not yet been written; forwarding, or bypassing, routes results directly from later stages, though a load followed immediately by its use still typically costs a stall cycle in the classic pipeline. Control hazards come from branches, whose outcome is known only several stages after fetch; branch prediction guesses the path and flushes the wrong instructions when it misses.

Pipelining beyond the CPU

RISC instruction sets, with uniform instruction lengths and load/store architectures, were designed to pipeline cleanly; x86 processors reach similar behavior by splitting complex instructions into simple micro-operations. The same idea applies to any synchronous datapath: inserting registers to split a long critical path raises the maximum clock frequency at the cost of latency, and high-level synthesis tools expose this as a pipelining option. Software pipelining is the compiler counterpart, overlapping different loop iterations so loads, computation and stores proceed in parallel, with prologue and epilogue code around the loop.

Try it: questions about Pipelining

What is the main purpose of pipelining in a CPU?

  1. ATo divide instruction processing into stages and overlap the stages of different instructions, increasing throughput
  2. BTo always shorten the execution time (latency) of each instruction
  3. CTo reduce the number of instructions and make programs smaller
Show answer and explanation

Answer: A. To divide instruction processing into stages and overlap the stages of different instructions, increasing throughput

Pipelining overlaps stages such as fetch, decode, execute, memory access and write-back like an assembly line, completing one instruction per clock to raise throughput—ideally about 5× for five stages. Each instruction's latency actually grows slightly. Data dependences, branches and resource conflicts disrupt the flow (hazards), handled with forwarding and branch prediction.

FAQ

Does pipelining reduce the latency of an instruction?

No. Pipelining increases throughput by overlapping instructions, but each instruction still passes through every stage and usually takes slightly longer because of register overhead.

What are the three types of pipeline hazards?

Structural hazards from resource conflicts, data hazards from dependences on results not yet available, and control hazards from branches. Typical remedies are duplicated resources, forwarding and branch prediction.

Why not make the pipeline as deep as possible?

Register overhead stays fixed while stage logic shrinks, so gains diminish, and branch mispredictions waste more work in a deeper pipeline. Power and design complexity also increase.

Questions that mention Pipelining (5)

Pipelining appears in 6 practice questions across 4 topics, including CPUs and architecture, Logic circuits, IC design flow and EDA.

  1. In a synchronous circuit, what determines the maximum clock frequency at which it can operate?
  2. What is the technology called that automatically generates RTL from algorithm descriptions written in C or C++?
  3. Which is a characteristic of RISC (reduced instruction set computer)?
  4. What is the correct basic order in which a CPU processes an instruction?
  5. Which statement is correct about designs like x86, where an arithmetic instruction such as "add eax, [rbx]" can use a memory value directly?

Books on CPUs and architecture Ad

As an Amazon Associate I earn from qualifying purchases.

Comparisons that include this term

This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.

Back to the glossary