Instruction execution can be divided into five phases. These are Phase-I: INSTRUCTION FETCH (IF) II: INSTRUCTION DECODE & OPERAND FETCH (ID) III: EXECUTION (EX) V: MEMORY OPERATION (MEM) V: WRITE BACK (WB) - Regards, Subhradip Das
The two-phase process for executing instructions on a typical CPU involves a fetch step and an execute step. Fetch is where the instruction is loaded from memory and execute is where the actions detailed in the instruction are carried out.
In Harvard architecture, the program memory space is distinct from data memory space. Such architecture requiring two connections. It can perform instruction fetch ( from program memory ) and data memory fetch simultaneously , by adopting a pipelined instruction execution approach, as shown below. A typical instruction execution consists of performing Fetch instruction, Decode instruction, Fetch operands, execution operation , store results. Then, by adopting a pipelined approach, which is possible in Harvard architecture, it is evident that the instruction throughput increases by overlapping. It is simple to imagine that in the above case, if all the above states are executed "one after the other" , the execution time of the instruction will be longer than when it is pipelined.
In Harvard architecture, the program memory space is distinct from data memory space. Such architecture requiring two connections. It can perform instruction fetch ( from program memory ) and data memory fetch simultaneously , by adopting a pipelined instruction execution approach, as shown below. A typical instruction execution consists of performing Fetch instruction, Decode instruction, Fetch operands, execution operation , store results. Then, by adopting a pipelined approach, which is possible in Harvard architecture, it is evident that the instruction throughput increases by overlapping. It is simple to imagine that in the above case, if all the above states are executed "one after the other" , the execution time of the instruction will be longer than when it is pipelined.
Summary − So this instruction XCHG requires 1-Byte, 4-Machine Cycles (Opcode Fetch) and 4 T-States for execution as shown in the timing diagram.
three
The possible states that define an instruction execution are as follows: Instruction address calculation - Determine the address of the next instruction to be executed. Instruction fetch - Read instruction from its memory location into the processor. Instruction operation decoding - Analyze instruction to determine type of operation to be performed and operand to be used. Operand address calculation - If the operation involves reference to an operand in memory or available via I/O, then determine the address of the operand. Operand fetch - Fetch the operand from memory or read it in from I/O. Data operation - Perform the operation indicated in the instruction. Operand store - Write the result into memory or out to I/O.
There are three fetch cycles in a three byte instruction. The first one is four clock cycles long, while the other two are three clock cycles long. Depending on what the instruction does, there will then be more read/write cycles.
8086 has two blocks Bus Interfacing Unit(BIU) and Execution Unit(EU).The BIU performs all bus operations such as instruction fetching, reading and writing operands for memory and calculating the addresses of the memory operands. The instruction bytes are transferred to the instruction queue.EU executes instructions from the instruction system byte queue.Both units operate asynchronously to give the 8086 an overlapping instruction fetch and execution mechanism which is called as Pipelining. This results in efficient use of the system bus and system performance.BIU contains Instruction queue, Segment registers, Instruction pointer, Address adder.EU contains Control circuitry, Instruction decoder, ALU, Pointer and Index register,Flag register.
The IP register contains the address of the next instruction to fetch and execute. Normally, IP is incremented by the number of bytes in the instruction after execution of that instruction, unless a transfer of control occurs, in which case IP is loaded with a new value.
The OUT instruction on the 8085 uses 10 T cycles, 3 for opcode fetch, 1 for opcode decode, 3 for port address fetch, and 3 for port data store. Any wait states encountered are above and beyond that.
The process of transferring instruction codes from memory location to instruction queue register is called opcode fetch.