instructions:
R2 is destination for add, and source for subtract
there is a data dependency between the instructions
subtract has to be stalled, like this:
Control circuit recognises data dependency when it decodes subtract instruction (compare source/destination registers)
Subtract instruction is held in interstage buffer B1 during cycles 3-5
Add instruction proceeds, signals are set in interstage buffer B2 for implicit NOP (no operation) instruction — creates a ‘bubble’ (clock cycle of idle time)
the stalls can be alleviated using operand forwarding:
the result of hardware implementation looks like this:
The new datapath, incorporating operand forwarding: