What do you understand by the instruction set? What is the step taken by the CPU to execute
Answer: Instruction Set | Steps of CPU to execute the Instructions
Instruction set :
The computer system cannot do anything on its own. They are programmed or instructed by the user. The instruction is defined as a machine language command to perform a specific task. It should be understandable by the computer system, hence it is a string of binary digits (0 and 1).
Example : It may be issued to read data from the memory, write data into the memory, etc. Generally, an instruction is used to perform a single task.
The set of instructions used to perform specific operations is called the instruction set.
Each instruction has two parts : opcode and operand.
1. Opcode : It specifies the operation to be performed by the instruction issued to the computer system such as ADD to perform addition, MOV to move data from one location to another.
2. Operand : It specifies the memory locations where the input and output data are kept.
The instructions are classified into three categories according to the number of bytes required for their execution.
These are as follows :
1. One‐byte instructions : The instructions that require only one byte for their execution.
Example : MOV
2. Two‐byte instructions : The instructions that require one byte for their execution and one byte for their operand.
Example : MVI
3. Three‐byte instructions : The instructions that require one byte for their execution and two bytes for their operands. These instructions are used to specify the 16 bit operand with the instruction.
Example : STA
According to the number of instructions required and their complexity, based on these instruction sets, the computer architecture is also categorized into two categories : CISC and RISC.
1. CISC : It stands for complex instruction set computer. It provides a large number of instructions. These instructions include some complex instructions to perform complex tasks. These were developed to complete the complicated task in an easy and flexible manner, so that the compiler or other translator has to do very little work in translating the code written in some programming language into machine language. These instructions are memory‐based, and the computer requires a separate circuitry for these instructions. Therefore, more time is required for their execution and their design is complex.
Example : MULT, JA, JPO.
2. RISC : It stands for reduced instruction set computer. It is based on the concept that complex operation can also be performed using simple instruction. For example, the multiplication can be performed by loading the contents in memory; multiplying and then storing them back into the memory. These are the three simpler steps to perform the multiplication, instead of performing it in a single step. Therefore, the RISC computer uses sets of simple instructions that may be completed into a single cycle. Also, it is faster and less expensive than CISC.
Example : ADD, COMPARE.
The processing of an instruction by the CPU consists of following steps :
1. Fetching : The CPU fetch the instruction from the memory, and the program counter is replaced by the next instruction.
2. Decoding : The instruction is decoded by the CPU (CU and ALU) to determine the action to be performed.
3. Execute : The instruction is executed to perform a specific task.
4. Store : The result generated by the execution of an instruction is stored back into the memory.
The completion of all the steps for an instruction is called an instruction cycle of the machine cycle.