In a data processor having a prefetch controller for prefetching a plurality of instruction words from a memory, for storage in an instruction queue, said instruction queue having a predetermined number of buffers, each buffer having a predetermined n-word instruction boundary for storing a set of n instruction words retrieved from said memory, where n is an integer, and for providing a predetermined number of instruction words comprising one or more instructions from said instruction queue to a pipelined instruction unit, a method for filling the instruction queue, based upon an amount of movement of said pipelined instruction unit occurring as a result of loading said predetermined number of instruction words, the method comprising the steps of:
- decoding, via said pipelined instruction unit, a first sequence of said predetermined number of instruction words resident in said pipelined instruction unit to determine the amount of movement of said pipelined instruction unit, said amount of movement corresponding in value to a number of said first sequence of instruction words used by said pipelined instruction unit during a first part of a machine cycle;
- incrementing a current value of a queue pointer in said prefetch controller, by an amount corresponding in value to the amount of movement of said pipelined instruction unit, in response to said prefetch controller receiving a first control signal from said pipelined instruction unit during a second part of said machine cycle,
- said first control signal indicating the amount of movement of said pipelined instruction unit;
- and
- retrieving a next sequence of instruction words from said memory to refill said instruction queue, if any one of the following conditions are met:
- the current value of the queue pointer combined with the amount of movement of said pipelined instruction unit occurring as the result of loading said first sequence of instruction words points to a last instruction word in one of said predetermined number of buffers in said instruction queue;
- or
- the current value of the queue pointer combined with the amount of movement of said pipelined instruction unit occurring as the result of loading said first sequence of instruction words crosses the n-word instruction boundary of one of said predetermined number of buffers in said instruction queue.