Pipelining Flashcards
What is pipelining
Pipelining is a technique used in computing and electronics to improve the efficiency and performance of a system by dividing a task into multiple smaller stages and processing those stages in parallel.
What can pipelining be related too
A factory, each stage of the pipeline performs a specific part of the task, and the stages are connected in a sequential manner, much like an assembly line in a factory.
What is instruction fetch IF
The processor retrieves the next instruction from memory and stores it in the instruction register (the location of the next task).
Key Components: Program Counter (PC), Memory Interface.
What is instruction decode ID
The instruction is decoded to determine the operation, source/destination operands, and immediate data.
What are the five common stages of a processor pipeline
- Instruction Fetch (IF)
- Instruction Decode (ID)
- Execute (EX)
- Memory Access (MEM)
- Write Back (WB)
What happens during the Execute (EX) stage
The actual operation (e.g., arithmetic, logic, branch) is performed using the ALU or branch units.
What happens during the Memory Access (MEM) stage
Data is fetched from or written to memory, as required by the instruction
What happens during the Write Back (WB) stage
The result of the instruction os written back to the destination (e.g., register of memory)
What is the role of the ALU in pipelining
The ALU performs the athletic and logical operations during the Execute (EX) stage
What is an example of an instruction broken into pipeline stages?
IF: Fetch the instruction.
ID: Decode the operation and operands.
EX: Add values in R2 and R3 using the ALU.
MEM: Not needed for this instruction.
WB: Write the result to R1.
What are pipelining hazards
Issues like data hazards, control hazards, and structural hazards that disrupt smooth pipeline execution.
What is a data hazard in pipelining
A situation where one instruction depends on the result of a previous instruction.
What is a control hazard in pipelining
A delay caused by changed in instruction flow, such as branches or jumps
What is a structural hazard in pipelining
When two or more stages compete for the same resource, causing a conflict.
What are some pipeline optimisation techniques
Branch prediction, hazard handling (e.g., forwarding, stalling), and pipeline registers/buffers.
What is branch prediction in pipelining
A technique to guess the outcome of a branch instruction to reduce control hazards.
What is the main benefit of pipelining
It increases instruction throughput by processing multiple instructions simultaneously.
What is a jump in a processor
A jump is an instruction that unconditionally changes the flow of execution to a different part of the program.
What is a branch in a processor
a conditional instruction that changes the flow of execution based on a condition
What is a conditional branch
A branch that changes the flow only if a specific condition is met (e.g., BEQ R1, R2, Label). E.g. in if or while statements
What is an unconditional branch
A branch that always changes the flow of execution, similar to a jump (e.g., B Label).
How are branches and jumps different
Branches can be conditional or unconditional.
Jumps are always unconditional.
Why do branches and jumps cause control hazards in pipelining?
They disrupt the normal sequential instruction flow, making it difficult to predict the next instruction.
What is branch prediction
A technique where the processor guesses the outcome of a branch to minimize delays caused by control hazards.