Consider a high level language instruction that could be executed in a language such as BASIC or FORTRAN.
As an example:
X=X+Y
This statement instructs the computer to add the value stored in Y to value stored in X.
Now, the question arise - How this is accomplished?
Let us assume that the variable X and Y corresponds to location 513 and 514.And if we assume a simple set of machine instructions, then this operations could be accomplished with three instructions:
1. Load a register with the contents of memory location 513.
2. Add the contents of memory location 514 to the register.
3. Store the contents of register in memory location 513.
Here we see that, the single BASIC instruction may require three machine instructions.This is typical of the relationship between HLL and ML, i.e., A HLL express operation in an algebraic form, using variables, and after conversion, machine language express operations in basic form involving the moment of data to or from register.
Thus, with this example, we can say that, there are many types of instructions that are included in computer for formulate any task.
That is, there are various types of machine instructions, in a computer, that must be sufficient to express any of the instruction from a HLL.Therefore, now lets we discuss, types of instructions that must be included in a practical computer.These are:
1. Data Processing Instruction
2. Data Storage and Retrieval Instruction
3. Data Moment Instructions
4. Control Flow Instructions
5. Miscellaneous Instructions
Now, we will discuss about each types of instructions one by one.
1. Data Processing Instruction:
Data Processing Instructions contain arithmetic and Logic Instructions.That is, these instructions are used for arithmetic and logic operations in a machine.
Example of these instructions are:
-Arithmetic Instructions such as add and subtract
-Logic instructions such as AND, OR, and NOT
Example of these instructions are:
-Arithmetic Instructions such as add and subtract
-Logic instructions such as AND, OR, and NOT
In short we can say that, Arithmetic Instructions provide computational capabilities for processing numeric data.And Logical(Boolean) Instructions operate on bits of word as bits rather than as numbers.These operations primarily performed on data stored in processor register.
2. Data Storage and Retrieval instructions:
Since Data Processing Operations are normally performed on the data in CPU register.Therefore, there is a need of an instructions to bring data to and from memory register.Such instructions are called Data Storage and Retrieval instructions.
As an example: Load and Store Instructions.
3. Data Moment Instructions:
These are basically input/output instructions.And I/O instructions are needed to transfer program and data into memory and the result of computations back out to the user.
That is, these instructions are used to bring in programs and data from various devices (specifically Input) to memory or to communicate the result to the output device.
Example of these Instructions include: Input, Output and Move etc.
4. Control Flow Instructions:
Control flow Instructions are used to control the flow of instruction of a program.It include test and branch instructions, where,
"Test instructions" are used to test the status of computation through value of data word, and,
"Branch instructions" are used to branch to a different set of instructions depending on the decision made.Besides this, branch instruction are also used for transfer of control.
5. Miscellaneous Instructions:
These are some more instructions which do not fit in any of the above categories.
Example of these instructions are: Interrupt or Supervisory Call, Halt instruction or some or more instructions of operating system.
No comments:
Post a Comment