Approach (cont).
You may have exceeded the 4 operations per packet limit by only computing values in the packet before they are actually needed.
- Count the number of free operation slots which are before the excess operations. If the number of free operation slots is greater than the excess operations, you will definitely have to add another packet. If not, then try moving the excess operations to earlier free slots. Even if enough free slots exist, you may still need to add extra packets because of load/store limitations.
Once all of the operations are scheduled (only 4 operations per packet), assign registers.
- If you run out of registers, you may have to add another instruction packet.