CPU performs following steps to execute an instruction:
- Fetch: Instruction fetch is a process of getting an instruction from the memory to execute it. This process is performed by the control unit.
- Interpret instruction: Interpret instruction is a process to examine the nature of instruction to determine what further operations should be taken. If any operation is needed, it should be carried out before the execution of that instruction.
- Execute Instruction: After interpreting the instruction and getting the required data,
CPU finally executes that instruction. The instruction is executed by ALU.
- Storing: The process of writing the result to the memory is called storing.
These four operations collectively are called a machine cycle or instruction cycle. The time required to fetch and decode instruction is called Instruction time or i-time. The time required to execute and store is called Execution time or e-time.
A set of all instructions that a CPU can perform is called an instruction set. The instruction set consists of the following types of instructions:
- Arithmetic Instructions
- Logical Instructions
- Data Transfer Instructions
- Control Transfer Instructions
1. Arithmetic Instructions
The instructions used to perform arithmetic operations are called arithmetic instructions. Different arithmetic operations are addition, subtraction, multiplication and division. These instructions are executed by the arithmetic & logic unit of CPU.
2. Logical Instructions
The instructions used to perform logical operations are called logical instructions. A logical operation is the comparison of two data values. Possible comparisons are:
- Greater than (>).
- Equal to (=)
- Less than (<)
These instructions are also executed by the Arithmetic & Logic unit of CPU.
3. Data Transfer Instruction
The instructions used to transfer data from one component to another component during the program execution are called data transfer instructions.
4. Control Transfer Instruction
The instructions used to change the sequence of instructions of a program are called control transfer instructions. These instructions transfer the execution control to a certain part of program instead of next instruction.