1.1.1 Architecture of the CPU
In this lesson, we will explore the essential components of a Central Processing Unit (CPU)The main component of a computer. It processes data and instructions and controls the computer system. and understand how they work together to executeThe stage where the CPU carries out the operation specified by the instruction. instructions. We will also delve into the Von Neumann architectureA computer architecture model where data and instructions are stored in the same memory, accessed sequentially., which forms the foundation of modern computer systems.
A Computer SystemA combination of hardware and software that processes data and performs tasks.
A computer system consists of hardwareThe physical components of a computer, such as the CPU, memory, and input/output devices. and softwareThe programs and operating systems that run on a computer to perform specific tasks. that work together to process data and perform tasks. At its core, a computer follows a simple pattern: it takes an input, processes that input, and produces an output for the user. This process is essential for everything a computer does, from running applications to controlling external devices.
Computers receive data through input devicesDevices such as keyboards, mice, or controllers that send data into a computer. like keyboards, mice, or controllers. The CPU processes this data by following programmed instructions, performing calculations, making decisions, and manipulating information as needed. The processed result is then sent to an output deviceA device such as a monitor or speaker that displays or transmits processed data to the user., such as a monitor or speaker, allowing the user to see, hear, or interact with the outcome. This rapid sequence enables computers to function efficiently and respond to user actions in real time.
The Purpose of the CPU
The CPU is at the centre of a computer system, responsible for executing instructions and performing arithmetic and logical operations on data. The CPU fetches, decodes, and executes instructions through a series of steps known as the “fetch-execute cycle”, and through this cycle, is able to control all the other parts of the computer.
The Fetch-Execute CycleThe continuous process of retrieving, decoding, executing, and storing instructions.
The fetch-execute cycle is the process through which the CPU retrieves instructions from memoryA unified system that stores both data and program instructions in the same location., interprets them, and carries out the specified operations.
This cycle consists of the following stages:
- FetchThe stage where the CPU retrieves an instruction from memory.: The CPU fetches the next instructionA command that tells the CPU what operation to perform. from the memory. It uses a component called the “Program Counter” to keep track of the memory address of the next instruction.
- DecodeThe stage where the CPU interprets the instruction using the Control Unit (CU).: The fetched instruction is then decoded by the CPU’s “Control Unit” to understand the operation it represents and the data it requires.
- Execute: In this stage, the CPU carries out the operation specified by the instruction using the data obtained from registersSmall, high-speed storage units within the CPU that temporarily hold data during processing. or memory.
- StoreThe stage where the CPU saves the result of the execution back into memory or registers.: If the instruction alters data, the results are stored back into memory or registers, depending on the specific operation.
The fetch-execute cycle continues repeatedly, allowing the CPU to execute a series of instructions, making the computer perform various tasks.
Common CPU Components and Their Functions
To fully understand the common components of a CPU, we must first learn about their different functions during the fetch-execute cycle.
Arithmetic Logic Unit (ALU)The CPU component that performs arithmetic (e.g., addition, subtraction) and logical operations (e.g., AND, OR).: The ALU is a fundamental component of the CPU responsible for performing arithmetic operations (e.g., addition, subtraction) and logical operations (e.g., AND, OR) on data. During the “Execute” stage of the fetch-execute cycle, the ALU receives data from registers and carries out the specified operation according to the decoded instruction.
Control Unit (CU)The CPU component responsible for managing and coordinating the fetch-execute cycle. It directs data flow within the CPU.: The CU is responsible for coordinating and managing the fetch-execute cycle. During the fetch stage, the CU retrieves the instruction from memory using the Program Counter (PC)A register that holds the memory address of the next instruction to be fetched. and sends it to the instruction register for decoding. It then controls the flow of data and signals between various CPU components, ensuring the proper execution of instructions.
CacheA small, high-speed memory inside the CPU that stores frequently used data for quick access, reducing delays from accessing RAM.: Cache is a small, high-speed memory located within the CPU. It stores frequently used data and instructions to improve the overall performance of the system. When the CPU needs data during the fetch-execute cycle, it first checks the cache. If the data is found in the cache (cache hit), the CPU can access it much faster than fetching it from the main memory (RAM).
Registers: Registers are small, high-speed storage units within the CPU that hold data temporarily during the fetch-execute cycle. They are the fastest form of memory and play a crucial role in speeding up data access for the CPU. There are several types of registers, such as:
- Memory Address Register (MAR)A register that holds the memory address of the data or instruction being fetched or stored.: This register holds the memory address of the data or instruction being fetched from or stored into memory. During the fetch stage, the MAR holds the address of the instruction to be fetched.
- Memory Data Register (MDR)A register that holds the actual data or instruction that has been fetched from or is being written into memory.: The MDR holds the actual data or instruction fetched from memory or the data/instruction that is ready to be written into memory. It acts as a buffer between the CPU and memory, holding the data during data transfer.
- Program Counter (PC): The Program Counter is a special register that keeps track of the memory address of the next instruction to be fetched. During each fetch stage, the PC gets updated to point to the next instruction in memory.
- AccumulatorA register that stores intermediate results of arithmetic and logical operations.: The accumulator is a register that stores intermediate results during arithmetic and logical operations. It holds the output of ALU operations and is used for further processing or for storing the final result.
These registers are key features of the Von Neumann architecture, which we will explore below. For each of the four registers, you must know their names, their acronyms, and their purposes.
Von Neumann Architecture
The Von Neumann architecture describes the structure of modern computer systems. It is named after the renowned mathematician and computer scientist John von Neumann.
The key features of the Von Neumann architecture include:
- Central Processing Unit (CPU): The CPU is the core component of the Von Neumann architecture, responsible for executing instructions and data processing.
- Memory: The Von Neumann architecture has a unified memory system that stores both data and instructions. This means that data and program instructions are stored in the same memory, and they are accessed using memory addresses.
- Input/Output (I/O) Devices: These devices facilitate communication between the computer and the external world. They allow data to be put into the computer (input) and the output to be presented to users.
- BusA communication pathway that transfers data and instructions between the CPU, memory, and input/output devices.: The bus is a communication pathway that enables data and instructions to be transferred between the CPU, memory, and I/O devices.
Whilst the CPU is responsible for executing instructions, how it operates within the broader Von Neumann architecture defines its interactions with memory, buses, and I/O devices to form a complete computer system.
Note
