An instruction pipeline lets a CPU work on several instructions at once by assigning successive processing stages to separate units. The goal is higher throughput: once the pipeline is full, one instruction can complete each cycle in the simplified four-stage model. section 8.1.1 section 8.3
Each instruction passes through four stages:
- Fetch the instruction from memory. section 8.1.1
- Decode the operation it requests. section 8.1.1
- Execute the operation. section 8.1.1
- Write the result to memory or a register. section 8.1.1
Two instructions
If every stage takes one cycle, processing two instructions from start to finish one after the other takes eight cycles. Separate stage units allow their work to overlap: while one instruction advances, another can use an earlier stage. This improves the rate of completion without making the four stages disappear. section 8.1.1 section 8.3
Keeping the pipeline supplied with instructions is the catch. At a conditional jump, the CPU may not yet know which instruction to fetch next. Branch prediction guesses the outcome to avoid waiting; a wrong guess costs cycles while the pipeline refills. Longer pipelines can make that penalty larger: a 20-stage pipeline needs at least 20 cycles to fill. Another route to speed—raising the clock frequency—also has limits because it increases power use and heat. section 8.3 section 8.2.2 section 8.1.1






























































