Computer Architecture : Instruction Execution

The instruction execution is the basic operational process of a computer. It is the process by which a computer executes the given instruction in a program. As we know that the basic function performed by a computer is to be executed is a set of instructions which are stored in memory. The central processing unit or CPU executes the instructions of the program to complete a task. The major responsibility of the instruction execution is with the CPU. The instruction execution takes place in the CPU registers. Let us, first discuss few typical registers, some of which are commonly available in of the machines. These registers are  :


Memory Address Register (MAR) : The Memory Registers specifies the address of memory location from which data or instruction is to be accessed (for read operation) or to which the data is to be stored (for write operation).

Program Counter (PC) : The Program Counter keeps track of the memory address of the instruction that is to be executed next or in other words, holds the address of the instruction to be executed next.

Instruction Register (IR) : The Instruction register is a part of CPU control unit that stores the instruction currently being executed or decoded or in other words it contains the instructions are loaded before their execution.

The simplest model of instruction processing can be a two step process. The CPU reads (fetches) instructions (codes) from the memory one at a time, and executes or performs the operation specified by this. Instruction fetch involves reading of an instruction from a memory location to the CPU register. The execution of this instruction may involve several operations depending on the nature of the instruction. The processing needed for a single instruction (fetch and execution) is referred to as instruction cycle. The instruction cycle consist of the fetch cycle and the execute cycle. Program execution terminates if the electric power supply is discontinued or some sort of unrecoverable error occurs, or by a program itself. For fetch cycle, in typical CPU, program counter is used. Program counter keeps track of the instruction which is to be fetched next. Normally next instruction in sequence is fetched next as programs are executed in sequence. The fetched instruction is in the form of binary code and is loaded into an instruction register (IR), in the CPU. The CPU interprets the instruction and do the required action.


In general, these actions can be divided into the following categories:

Data transfer :

Data is transferred from CPU to memory by using address bus and data bus. The process of transferring data from CPU to memory consists of different steps. These steps are as follows:
  • CPU places the address of main memory on address bus.
  • CPU places the address of the data location on address bus.
  • Main memories see the address on address bus.

Data processing:  A logical or arithmetic operations may be performed by CPU on the data. 

Sequence Control : This action may require alternation of sequence of execution. For example, an instruction from location 100 on execution may specifies that the next instruction should be fetched from location 200. On execution of such an instruction the Program counter which was having location value 101 (the next instruction to be fetched in case where memory word is equal to register size) will be modified to contain a location value 200. Execution of a instruction may involve any combination of these actions. 



Next Topic :

No comments:

Post a Comment