A program residing in the memory unit of the computer consists of a sequence of instructions. The program is executed in the computer by going through a cycle for each instruction.

Each instruction cycle in turn is subdivided into a sequence of subcycles and phases. In the basic computer each instruction cycle consists of the following phases:

  1. Fetch an instruction from memory.
  2. Decode the instruction.
  3. Read the effective address from memory if the instruction has an indirect address.
  4. Execute the instruction.

Upon the completion of step 4, the control goes back to step 1 to fetch, decode, and execute the next instruction. This process continues indefinitely unless a HALT instruction is encountered.

What steps are involved during the execution of a complete instruction?

Answer:

  1. Instruction Fetch (IF):
    • The CPU fetches the next instruction from memory.
    • The program counter (PC) is incremented to point to the address of the next instruction to be fetched.
    • The instruction is fetched from memory and stored in a temporary storage location, such as the instruction register (IR).
  2. Instruction Decode (ID):
    • The fetched instruction is decoded to determine its opcode (operation code) and the addressing mode, if applicable.
  3. Operand Fetch (OF):
    • If the instruction requires operands from memory or registers, the CPU fetches the operands.
  4. Execution (EX):
    • The CPU performs the operation specified by the instruction opcode on the fetched operands.
  5. Memory Access (MEM):
    • If the instruction involves accessing memory, such as a load or store operation, the CPU accesses memory to read or write data.
  6. Writeback (WB):
    • If the instruction produces a result, such as the result of an arithmetic operation or the updated value of a register, the result is written back to the appropriate destination.

 

Categories: Uncategorised

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *