There Is an Instruction that Does Nothing
It's mnemonic is nop
- Other instructions can be turned into nops part way through the pipeline
- Look at the diagram on page 303
- Compare it with the diagram on page 316.
- In particular notice the multiplexor leading into pipeline register ID/EX
- This multiplexor can be set to put zeroes into all of the control signals stored in the
pipeline instead of using the values calculated by the control unit
- Now we need to consider what lasting effects an instruction can have
- it can write into a register
- it can write into memory
- it can write into the program counter
- each of these outcomes requires a 1 on a control signal
- if all the control signals are 0, none of these can happen
- setting that multiplexor to replace the control signals with 0's will keep that instruction
from making any lasting change to the state of the machine
- Why might we ever want to do that?
- another way to solve the problem that forwarding addresses is to delay an instruction
by a tick or two until the register in question can be read correctly
- sometimes forwarding does not completely solve the problem it is designed to alleviate
- we can complete the solution by delaying the instruction by a tick
- the way this happens is to turn the instruction into a nop
- at the same time the signal to write into the PC is turned off
- since the program counter does not get changed, the last instruction fetched
(that became a nop) will be fetched again
- on the second try, the instruction completes normally,
but one tick later than it otherwise would have
- the book's metaphor for this is a bubble in the pipeline