For executing an instruction, a microprocessor fetches the instruction and executes it. The time taken for the execution of an instruction is known as Instruction Cycle. An instruction cycle is consists of a Fetch Cycle and Execute Cycle. The execution of any 8085 program consists of a sequence of READ and WRITE operations. Of which each transfer a byte of data between the 8085 A and a particular I/O device address or memory address.
These READ and WRITE operations are the only communication between the processor and the other components, and the other components, and are all that is necessary to execute any instruction or program.
Each READ or WRITE operations of the 8085 is referred to as Machine Cycle. An 8085 instruction’s execution consists of a number of machine cycles. These cycles vary from one to five (M1 to M5) depending on the instruction. Each machine cycle contains a number of clock cycles (also referred to as T-states). The first machine cycle will be executed by four or six clock periods. The machine cycles that follow will have three clock periods or T-state. The 8085 machine cycle has been shown in figure below.
Machine Cycle is the sequence of steps in performing the various operation like opcode fetch, memory read, memory writes I/O Read, I/O Write etc.
T-state may be defined as the time taken by the clock to complete one period. To perform a particular task by a programmer on a computer. A programmer writes a set of instructions called a Program and data are stored in the memory. The microprocessor fetches one instruction from memory at a time and executes it. It fetches and executes all the instructions of the program from the memory one by one to produce the final results.
Instruction cycle can be defined as the time taken to complete an instruction. We can also say that an instruction cycle is defined as the sequence of operations that are required by the CPU to fetch an instruction and data from the memory and to execute it. The instruction cycle consists of a fetch cycle and a execute cycle. In a CPU fetches the opcode (the machine code of an instruction) from the memory.
The sequence of operations which are required to fetch an opcode from the memory constitute a fetch cycle. The necessary steps which are required to get data from the memory and to perform the operation specified by an instruction constitute an execute cycle.
Instruction Cycle = Fetch Cycle + Execute Cycle
Instruction may be one byte, two byte or three byte long. The first byte of any type of instruction is the opcode (machine code of the instruction). The second or third byte of an instruction may be the data or the address.
The PC keep the address of the next instruction byte to be executed. In the beginning of a fetch operation, the contents of the program counter which is the address of the memory location where opcode of the instruction is stored is sent to the memory. The memory places opcode of the instruction on the data bus so as to transfer it to the CPU. This is called the Fetch Operation.
To fetch an opcode of an instruction, three clock cycles are required. A slow memory may take more time. In the case of slow memory, the CPU has to wait till the memory send the opcode. The clock cycle for which the CPU waits is called the Wait Cycle. Fetch cycle is shown in figure above.
After the opcode of an instruction fetched from the memory, the execution begins. The opcode fetched goes to the data register and then it goes to instruction register. From the instruction register it goes to instruction decoder which decodes the instruction and after the decoding of the instruction, the task specified in the instruction is carried out. This is called the Execute Operation.
One Byte: In one byte instruction, the operand is a general purpose register and opcode and operand are specified by one byte. The execution of one byte instruction is immediately performed. The time taken in execution is one clock cycle.
Two/Three Byte: In the two byte or three byte instruction which contains data or address which is still lying in the memory, the CPU perform the Read operation to get the desired data. After receiving the data, it performs the execute operation. A Read operation is similar to the fetch operation.
Read Operation: In the Read operation, the quantity received from the memory are data or operand address whereas in the case of fetch operation, it is an opcode. In some instructions the write operation is performed.
Write operation: In the write operation, data are sent from the CPU to the memory or to an output device. So execute operation may also consists of one or more read or write evelcs. Figure shows the in cycle and it contains fetch cycle and execute cycle.
Read more: Internal architecture of 8085 microprocessor