Lesson 7 50 min

The Fetch-Execute Cycle

AI Explain — Ask anything
AI Illustrate — Make it visual

Why This Matters

The Fetch-Execute Cycle is the fundamental process by which a Central Processing Unit (CPU) executes instructions stored in memory. It involves a continuous sequence of fetching an instruction, decoding it, and then executing the specified operation, forming the core of a computer's operation.

Key Words to Know

01
Program Counter (PC) — A register that holds the memory address of the next instruction to be fetched.
02
Memory Address Register (MAR) — A register that holds the address of the memory location currently being accessed.
03
Memory Data Register (MDR) — A register that temporarily stores data or instructions read from or written to memory.
04
Current Instruction Register (CIR) — A register that holds the instruction currently being decoded and executed.
05
Accumulator (ACC) — A general-purpose register used to store the results of arithmetic and logic operations.
06
Control Unit (CU) — Manages and coordinates all operations within the CPU, including fetching, decoding, and executing instructions.
07
Arithmetic Logic Unit (ALU) — Performs arithmetic operations (addition, subtraction) and logical operations (AND, OR, NOT).

Introduction to the Fetch-Execute Cycle

The Fetch-Execute Cycle, also known as the instruction cycle, is the foundational process by which a computer's CPU carries out program instructions. It's a continuous loop that underpins all software execution, from simple calculations to complex operating system tasks. Understanding this cycle is crucial for comprehending how computers process information at a low level. Each cycle involves three main stages: Fetch, Decode, and Execute, though some models also include a 'Store' stage. This cycle is governed by the Control Unit (CU) within the CPU, which generates control signals to coordinate the movement of data and the execution of operations. The speed at which this cycle repeats directly impacts the overall performance of the computer, often measured in clock cycles per second (Hertz).

The Fetch Stage

The Fetch stage is the first step in the cycle, where the CPU retrieves the next instruction from main memory. This process begins with the Program Counter (PC), which contains the memory address of the instruction to be fetched.

  1. The address from the PC is copied to the Memory Address Register (MAR).
  2. The contents of the MAR are then placed onto the address bus, which signals the main memory to locate the instruction at that address.
  3. The instruction at that memory location is then read and transferred via the data bus to the Memory Data Register (MDR).
  4. Finally, the instruction from the MDR is copied into the Current Instruction Register (CIR).
  5. Crucially, the PC is incremented at this point (or sometimes immediately after decoding) to point to the next instruction in sequence, preparing for the next cycle. This ensures sequential program execution.

The Decode Stage

Once the instruction is in the Current Instruction Register (CIR), the Decode stage begins. In this stage, the Control Unit (CU) interprets the instruction to determine what operation needs to be performed and what operands (data) are required.

Instructions are typically composed of two parts: an opcode (operation code) and an operand (or operands). The opcode specifies the type of operation (e.g., ADD, LOAD, STORE), while the operand specifies the data or the address of the data to be used in the operation.

The CU uses a built-in instruction set (microcode) to understand the instruction. If the instruction requires data from memory, the address of that data (if specified in the operand) is transferred to the MAR. If the instruction involves a jump or branch, the CU will modify the PC to point to a new address, altering the flow of execution. This stage effectively translates the machine code instruction into a series of control signals for the CPU's other components.

The Execute Stage

The Execute stage is where the actual operation specified by the instruction is carried out. The Control Unit (CU)...

This section is locked

Registers Involved in the Cycle

Several key registers play critical roles in the Fetch-Execute Cycle, each with a specific function:

  • Program Coun...
This section is locked

2 more sections locked

Upgrade to Starter to unlock all study notes, audio listening, and more.

Exam Tips

  • 1.Be able to clearly describe each stage (Fetch, Decode, Execute) and the role of each register (PC, MAR, MDR, CIR, ACC) within each stage. Use specific register names in your explanations.
  • 2.Practice drawing a diagram of the Fetch-Execute Cycle, showing the flow of data and addresses between the CPU components and memory. Label all registers and buses.
  • 3.Understand the purpose of each register. For example, explain *why* the PC is incremented and *when* the MAR and MDR are used.
  • 4.Differentiate between the roles of the Control Unit (CU) and the Arithmetic Logic Unit (ALU) during the cycle, especially in the Decode and Execute stages.
  • 5.Be prepared to explain how a jump or branch instruction affects the Program Counter (PC) and alters the sequential flow of the cycle.
👋 Ask Aria anything!