Bubble (computing)

From Wikipedia, the free encyclopedia
Jump to: navigation, search

In computing, a bubble is an alternative name for a pipeline stall. It represents a delay in execution of an instruction in an instruction pipeline in order to resolve a hazard.[1]

During the decoding stage, the control unit will determine if the decoded instruction reads from a register that the instruction currently in the execution stage writes to. If this condition holds, the control unit will stall the instruction by one clock cycle. It also stalls the instruction in the fetch stage, to prevent the instruction in that stage from being overwritten by the next instruction in the program.

To prevent new instructions from being fetched when an instruction in the decoding stage has been stalled, the value in the PC register and the instruction in the fetch stage are preserved to prevent changes. The values are preserved until the bubble has passed through the execution stage.[2]

The execution stage of the pipeline must always be performing an action. A bubble is represented in the execution stage as a NOP instruction, which has no effect other than to stall the instructions being executed in the pipeline.

Example [edit]

The following is two executions of the same four instruction through a 4-stage pipeline but, for whatever reason, a delay in fetching of the purple instruction in cycle #2 leads to a bubble being created delaying all instructions after it as well.

Pipeline, 4 stage.svg Pipeline, 4 stage with bubble.svg
Normal execution Execution with a bubble

See also [edit]

References [edit]

  1. ^ Patterson, David A.; Hennessey, John L., Computer Organization and Design (4 ed.), Morgan Kaufmann, p. 338 
  2. ^ Patterson, David A.; Hennessey, John L., Computer Organization and Design (4 ed.), Morgan Kaufmann, p. 373