CPU Instruction Cycle

In computer science, when we talk about the machine cycle we are referring to the execution of instructions by the microprocessor (the CPU). The CPU executes the machine instructions in a cyclical fashion, according to a scheme that was conceptualized by Von Neumann. The conceptual model of the computer, at least the most famous, is called the Von Neumann Machine and has already been proposed. discussed in this post.

cpu

Conceptually, to execute an instruction, the CPU must go through several steps, called phases. The three main instruction execution phases in the Von Neumann model are:

  • fetch
  • decode
  • execute

Essentially, the CPU must retrieve the instruction from memory (fetch phase), decode it, that is, understand what type of instruction it is from a binary string (decode phase), and finally execute the instruction (execute). These phases occur cyclically, also involving the other components of the architecture. For example, to add two numbers, those numbers must be retrieved from RAM.

In order for the CPU to synchronize the execution of its operations, an internal clock, called a clock, is required. The clock cycle is This is the time interval in which the CPU performs an elementary instruction, such as decoding an operation or reading an operand from memory.

The clock cycle is measured in Hertz. By definition, the frequency is the inverse of the period, so 1Hz = 1/s. Modern processors, to give an idea, have a clock cycle in the order of GHz, meaning they perform an elementary operation in one nanosecond: 1GHz = 1 * 109Hz.