Pin Me

How Do Instructions Get Executed In Microprocessors?

written by: shankar • edited by: KennethSleight • updated: 2/26/2010

We know that program is a sequence of instructions. But how these executions are executed in a microprocessor? How the microprocessor gets to know about which operations they should perform and over which data the operation should be carried out?

  • slide 1 of 2


    In the previous article we discussed about the various addressing modes of 8085 microprocessor. In this article let us discuss about the execution of an instruction by the microprocessor and how data flow occurs from memory to the microprocessor. Also know about what is an opcode and which units aids in executing an instruction.

  • slide 2 of 2

    Instruction Execution

    The instructions which are to be executed by microprocessor are first stored in the memory of the processor and then executed. But the processor does not execute the instructions directly. It reads the instruction byte by byte and then executes it.

    Before understanding instruction execution and data flow, there is a necessity for us to learn a new term, OPCODE.

    What is an Opcode?

    Opcode is nothing but the machine language instruction which denotes the microprocessor about what operation should be performed on the specific data. Microprocessor converts the instruction into suitable machine language, so that it can understand the operation to be performed and executes it.

    Consider MVI A, 18H.

    When the above instruction is to be executed, the microprocessor gets the Opcode for MVI A and performs the necessary operation on the data which is 18H in this case. The Opcode for MVI A is 3EH. So the microprocessor first reads this Opcode from the instruction and then performs the operation specified by Opcode over the data given.

    Now let us assume we want to store the above instruction in a specific address say 5500H. We know that in 8085 processor only one byte can be stored in each address location. Therefore the Opcode 3EH is stored at the location 5500H and the data 18H is stored at the next location 5501H.

    Now for execution of this instruction the processor has to send the address to the memory for reading. Then the MEMR’ signal is activated. As soon as this signal is activated the memory places the Opcode byte (3EH) on the data bus.

    The above process is considered as a single cycle and is called the OPCODE FETCH CYCLE. The period during which the Opcode is fetched from address to the data bus is called as Opcode fetch cycle.

    instruction execution and data flow in microprocessor   A microprocessor by default knows that the first byte which is under execution is always Opcode. The internal data bus sends the Opcode to the instruction decoder. The instruction decoder decodes the Opcode and identifies it as MVI A instruction. As soon as this information is obtained, the microprocessor searches for the data on which this operation should be performed.

    To find the data for performing the operation the microprocessor instructs the timing and control unit to generate a proper timing signal to obtain the data. As a result of the timing signal the program counter is increased by 1. So the address bus moves from 5500H to 5501H. Now we know that the data 18H is placed at 5501H. So when the address bus is placed at 5501H, it identifies the data and the MEMR’ signal is activated. After the activation of this signal the data is placed on the internal address bus and then it is moved to the accumulator. Then the MVI A operation is performed on the data 18H and the result is sent to the respective registers.

    This process of placing the address and reading the data is considered as a single cycle and this cycle is called Memory Read cycle. In general these cycles are called as machine cycles.

    Thus we have successfully discussed the data flow from memory to microprocessor and how the instruction is executed by the microprocessor.


    Stokes, J. (2006) Inside the Machine: An Illustrated Introduction to Microprocessors and Computer Architecture. San Francisco: No Starch Press