The Instruction Queue:
- The execution unit (EU) is supposed to decode or execute an instruction.
- Decoding does not require the use of buses.
- When EU is busy decoding and executing an instruction, the BIU fetches up to six instruction bytes for the next instructions.
- These bytes are called the pre-fetched bytes and they are stored in a first in first out (FIFO) register set, which is called a queue.
Significance of Queue:
- As shown in the above figure, while the EU is busy decoding the instruction corresponding to memory location 100F0, the BIU fetches the next six instruction bytes from locations 100F1 to 100F6 numbered as 1 to 6.
- These instruction bytes are stored in the 6-byte queue on the first in first out (FIFO) basis.
- When EU completes the execution of the existing instruction and becomes ready for the next instruction, it simply reads the instruction bytes in the sequence 1, 2…. from the Queue.
- Thus the Queue will always hold the instruction bytes of the next instructions to be executed by the EU.
Pipelining:
- The process of fetching the next instruction when the present instruction is being executed is called pipelining.
- Pipelining has become possible due to the use of queues.
- BIU (Bus Interfacing Unit) fills in the queue until the entire queue is full.
- BIU restarts filling in the queue when at least two locations of the queue are vacant.
Advantages of pipelining:
- The execution unit always reads the next instruction byte from the queue in BIU. This is faster than sending out an address to the memory and waiting for the next instruction byte to come.
- In short pipelining eliminates the waiting time of EU and speeds up the processing.
- The 8086 BIU will not initiate a fetch unless and until there are two empty bytes in its queue. 8086 BIU normally obtains two instruction bytes per fetch.
8086 Queue is only Six Byte long:
- This is because the longest instruction in the instruction set of 8086 is six bytes long.
- Hence with a six-byte long queue it is possible to pre-fetch even the longest instruction in the main program.