A Guide to CPU Components
Control Unit, ALU, and Registers
1 Purpose
This document provides a detailed guide to the three core components of a Central Processing Unit (CPU): the Control Unit (CU), the Arithmetic Logic Unit (ALU), and the Registers. You will learn how these components are architected and how they interact to perform the fundamental task of a CPU: executing program instructions.
2 What You’ll Learn
By the end of this reading, you will be able to:
- Describe the role of the Control Unit as the orchestrator of the CPU.
- Explain the function of the ALU as the mathematical engine of the CPU.
- Identify the different types of CPU registers and their purpose.
- Trace the fetch-decode-execute cycle and understand how the CU, ALU, and registers collaborate to complete an instruction.
This reading maps to the following program and course learning outcomes:
- Program Learning Outcomes (PLOs):
- 3. Apply terminology and numeric or system concepts: This document is rich with the fundamental terminology of CPU architecture, including the instruction cycle, registers, and the ALU.
- Course Learning Outcomes (CLOs):
- 1. Identify hardware and basic network components: This reading provides a deep dive into the micro-architecture of the CPU, the most critical hardware component.
This exercise will help you develop the following skills and knowledge, which align with the O*NET SOC Code 15-1232.00 for Computer User Support Specialists.
| Learning Objective | O*NET KSAs | Technologies Used |
|---|---|---|
| Explain the role of the CU, ALU, and Registers. | Knowledge: Computers & Electronics Skills: Reading Comprehension Abilities: Information Ordering |
N/A (Conceptual) |
| Describe the Fetch-Decode-Execute cycle. | Knowledge: Computers & Electronics Skills: Systems Analysis Abilities: Deductive Reasoning |
N/A (Conceptual) |
3 The Core Components of the CPU
A CPU, at its heart, is a collection of three fundamental components working in tight coordination: the Control Unit (CU), the Arithmetic Logic Unit (ALU), and a set of Registers. Understanding how they interact is key to understanding how a computer executes software.
- The Control Unit (CU): The Conductor
- Directs the entire operation, fetching and decoding instructions.
- The Arithmetic Logic Unit (ALU): The Calculator
- Executes all mathematical and logical calculations, as directed by the CU.
- The Registers: The Workspace
- Provide an extremely fast, temporary storage location for the data the ALU is currently manipulating.
4 The Control Unit and the Instruction Cycle
The Control Unit (CU) is the executive function of the CPU. Its fundamental purpose is to manage the Instruction Cycle (also called the Fetch-Decode-Execute cycle), which is the process of fetching instructions from memory, decoding them, and generating the signals required to execute them.
4.1 The Three Phases of the Instruction Cycle
- Fetch: The CU retrieves the next instruction from main memory. It uses the Program Counter (PC) register to know which address to fetch from.
- Decode: The CU’s instruction decoder translates the raw binary instruction into a sequence of micro-operations the CPU must perform. It determines which operation the ALU must do and which registers hold the necessary data.
- Execute: The CU generates a precise sequence of electrical control signals that direct the other components. It tells the registers to send their data to the ALU, tells the ALU which calculation to perform, and tells a destination register to store the result.
5 The Arithmetic Logic Unit (ALU)
The ALU is the digital circuit that executes all arithmetic (addition, subtraction) and logical (AND, OR, NOT) operations. It is a combinatorial circuit, meaning its output is purely a function of its current inputs.
5.1 Inputs and Outputs
- Inputs: The ALU takes two operands (A and B) from registers and a “function code” from the Control Unit that specifies the operation to perform.
- Outputs: It produces a result (R) and a set of status flags.
5.2 Status Flags
The status flags are critical for conditional logic (e.g., if statements). They are stored in a special register (like %rflags in x86-64) and indicate the outcome of an operation:
- Zero Flag (Z): Set if the result was zero.
- Sign Flag (N): Set if the result was negative.
- Carry Flag (C): Set if an unsigned addition resulted in a carry-out.
- Overflow Flag (V): Set if a signed operation resulted in an overflow (an incorrect result).
6 The Registers
Registers are the fastest form of storage in the computer, acting as the immediate workspace for the CPU. Because they are located directly on the CPU die, access is nearly instantaneous. They are used to hold instruction addresses, data for the ALU, and results.
6.1 Types of Registers
- General-Purpose Registers (GPRs): The workhorses for most operations. In x86-64, these are registers like
%rax,%rbx, etc. They hold data for arithmetic and logic. - Special-Purpose Registers: These have specific jobs:
- Program Counter (PC) / Instruction Pointer (IP): Holds the memory address of the next instruction to be fetched.
- Status Register / Flags Register: Holds the status flags (Z, N, C, V) from the ALU.
- Instruction Register (IR): Holds the current instruction after it is fetched from memory, while the CU decodes it.
7 Putting It All Together: Tracing an Instruction
Let’s trace a simple instruction, ADD R1, R2, R3, which means R1 = R2 + R3.
| Cycle | Action | Control Unit | ALU | Registers |
|---|---|---|---|---|
| T1 | Fetch Instruction | Gets address from PC, sends Read signal to memory. |
Idle. | PC value is put on the address bus. |
| T2 | Decode Instruction | Instruction arrives in IR. Decoder identifies it as an ADD operation. | Idle. | IR holds the instruction ADD R1, R2, R3. |
| T3 | Execute - Get Operands | Sends control signals to R2 and R3 to output their values. | Idle. | R2 and R3 place their data on the internal bus, which is routed to ALU inputs. |
| T4 | Execute - Calculate | Sends the ‘ADD’ function code to the ALU. | Performs the addition. Sets flags. | ALU inputs hold the values from R2 and R3. |
| T5 | Execute - Store Result | Sends control signal to R1 to latch the data from the ALU’s output. | Outputs the result of the addition. | R1 stores the new value. The Flags Register is updated. |
This sequential, step-by-step process—timed by the system clock and controlled entirely by the Control Unit—is how a software instruction is translated into the tangible electrical events that perform a computation.
8 Reflect and Review
Now that you have reviewed this document, take a moment to reflect on your learning. In your Microsoft Teams Student Notebook, create a new page for this topic and write down the following:
- 3 core components of a CPU.
- 2 status flags and what they indicate.
- 1 question you still have about the instruction cycle.
This reflection is for your instructor to review and helps solidify your understanding of the concepts.
Test your understanding with the following questions. These questions provide retrieval practice and reinforce key concepts covered in this reading. In your Microsoft Teams Student Notebook, answer the following:
- What are the three main components of a CPU, and what is the primary role of each?
- What are the three phases of the instruction cycle?
- What is the purpose of the Program Counter (PC) register?
- If the ALU subtracts 5 from 5, which status flag would be set?
- Why are registers necessary when the computer already has main memory (RAM)?