The instruction cycle, also known as the fetch-execute cycle, is a fundamental concept in computer organization that describes the process by which a computer executes a machine language instruction. The cycle consists of a series of steps that the central processing unit (CPU) goes through for each instruction in a program. The typical instruction cycle comprises four main stages: fetch, decode, execute, and store.
Fetch (IF - Instruction Fetch):
During the fetch stage, the CPU retrieves the next instruction from memory. The program counter (PC) holds the memory address of the next instruction to be executed. The CPU reads the instruction from this memory location and increments the program counter to point to the next instruction.
Decode (ID - Instruction Decode):
In the decode stage, the CPU interprets the fetched instruction to determine what operation needs to be performed. This involves breaking down the instruction into its opcode (operation code) and operand(s). The opcode specifies the operation to be performed, while the operand(s) provide the data or addresses involved in the operation.
Execute (EX - Execution):
The execute stage is where the actual operation specified by the opcode is carried out. This may involve performing arithmetic or logical operations, accessing data from memory, or interacting with input/output devices. The execution phase depends on the nature of the instruction and the architecture of the CPU.
Store (MEM - Memory Write/Result Write):
After the execution of the instruction, the results may need to be stored back in memory or in registers for future use. This stage involves writing the results of the operation back to the memory location specified by the instruction or to the appropriate registers within the CPU.
The completion of these four stages constitutes one iteration of the instruction cycle. The CPU then moves on to the next instruction by repeating the cycle. The instruction cycle is fundamental to the operation of a CPU and forms the basis for the execution of programs in a computer system. Different architectures may have variations in the specific steps or additional stages, but the basic fetch-execute cycle remains a core concept in computer organization.
Previous
Von Neumann Architecture (ALU)
Next