Home » Computer Science Organization

Computer Science Organization | Machine Cycle

In this article, we will learn about the introduction of Machine cycle, phases of machine cycle and try to understand how a program execute in a computer system?
Submitted by Prerana Jain, on July 05, 2018

Machine Cycle

The cycle during which a machine language instruction is executed by the processor of the computer system is known as the machine cycle. If a program contains 10 machine language instruction, 10 separate machine cycles should be executed for running the program. As the machine cycle contains four phases namely fetching, decoding, executing and storing.

The four-phase of the machine cycle is usually grouped into two categories:

  1. Instruction cycle
  2. Execution cycle

1) Instruction cycle

This concept describes the execution sequence of the program. Instruction cycle includes the first two phases, fetching and decoding.

i) Fetch cycle

In this cycle, the instructions related to binary sequence is transferred from the memory to CPU.

  • CPU generates the memory request based on the program counter to read the instruction from the memory.
  • Program Counter holds the starting instruction address and immediately points the next instruction address.
  • Here, the starting address is provided by the user and the next instruction address is calculated by incrementing.
  • Step size is depending on the size or length of the instruction i.e. if the instruction size is n byte then the step size is n.
  • When the processor supports with fixed length instruction then the PC is incremented to affixed constant during the fetch cycle to points the next time instruction address.
  • So during the fetch cycle only the OPCODE related byte to transfer to the CPU. Then PC will be incremented by 1. During the decoding process, the program counter is incremented the next instruction address.
  • The process of transfer the instruction related binary sequence from the memory to CPU is called an instruction fetch.

ii) Decoding

This phase of instruction cycle is responsible for breaking down the instruction into different parts so that it can be easily understood before being processed by the CPU. The Instruction is usually decoded by the instruction decoder which is a vital component of the CPU. The decoding of an instruction is also known as interpreting. The instruction is interpreted to determine two keys attributes of an instruction the opcode and the operands. the type of operations to be performed is identified by the opcode and the data on which the operation is to be performed is identified by the operand. Data is transferred to the Data Register (DR).

2) Execution cycle

Execution cycle includes two phase executing and storing. The execution cycle executes the instruction and stores the result back to the main memory or sends it to the output device of the computer system.

i) Executing

The objective of the execution cycle processes the currently fetched instructions.

  • To process the instruction there is a need for identifying the type of the operations associated with the instruction.
  • Opcode indicates the type of the operations.
  • The opcode is present in the instruction but that information is defined by the instruction format.
  • Instruction format gives the layout of an instruction that means is shown the internal structure of an instruction.
  • Instruction format is classified into five types based on the CPU organization.
  • CPU Organisation is classified into three types based on the availability of the ALU operand.

ii) Storing

In this phase the result computed in the execution phase is either sent to the memory or to an output device of the computer system. This PC of the CPU is also updated in this phase to point to the next instruction that is to be executed.

Machine Cycle in Computer science organization



Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.