Pipelining
Definition
- Increasing Throughout by overlapping executions of instructions
- At every pipeline stage, a new instruction is fed into the pipeline
Five Stages of Classic Pipeline#
IF(Instruction Fetch): Getting instruction from instruction memoryID(Instruction Decode): Determine instruction typeEX(Execute): ALU does computationMEM(Memory): Read and write data memoryWB(Write Back): Write into register file
Pipeline Hazards#
- Structural Hazards
- Conflict over hardware structure
- Instructions want to use the same hardware structure in the same clock cycle
- Data Hazards
- Data dependence between instructions in pipeline
- (EX)
add r3,__,__add __,r3,__(r3is used in two subsequent instructions)
- Branch Hazards/Control Hazards
- Because branch takes time to know direction of branch
- (EX)
beq __,__,labeladd __,__,__(it is unknown is theaddis going to happen or not until the branch equality is evaluated)