The CPU is a core part the computer architecture. In this chapter, we will go into a bit more detail on the components within the CPU, some characteristics, and how the CPU communicates with other components like main memory through buses.
Introducing the Von Neumann Block Diagram
Do you remember the diagram below from Chapter 2?
That diagram laid out the basics of how a computer operates. When we talk about architecture, we need to get into a bit more detail, and for this, we use the Von Neumann Architecture diagram.
Central Processing Unit (CPU)
The Central Processing Unit (CPU) is the logic circuitry that processes the instructions that are given to the computer. The CPU is seen as the main and most crucial integrated circuit (IC) chip in a computer, as it is responsible for interpreting most computer commands. The CPU performs most basic arithmetic, logic and I/O operations, as well as coordinate commands to ensure smooth instruction execution.
Components Inside the CPU: CU, ALU and Accumulator
The tasks carried out by the CPU are complex, which is why it is made up of multiple components, the most important being:
Control Unit (CU) The Control Unit fetches instructions from memory, interprets them and manages their execution to ensure tasks are carried out efficiently. It sends signals to different parts of the CPU and coordinates their actions, ensuring that each step in the process happens in the correct order. Additionally, the Control Unit manages communication between the CPU and memory, such as RAM, to ensure smooth data flow throughout the system.
Arithmetic Logic Unit (ALU) The ALU is responsible for performing all arithmetic and logical operations within the CPU, such as addition, subtraction, and comparisons. It works closely with the Control Unit, which sends the necessary instructions to the ALU for execution. Once the ALU processes the data, the results are sent back to the Control Unit, which coordinates the next steps in the task.
Registers e.g., Accumulator: Registers are small, fast memory locations within the CPU that temporarily store data during processing. They can be divided into two types: general-purpose and special-purpose registers. General registers store data or instructions that are actively used in tasks, enabling quick access for the CPU during processing. There are special registers that serve specific functions and are crucial for managing the CPU’s oprations. One important special register you must know about is the Accumulator, located within the ALU. The Accumulator temporarily holds the results of calculations performed by the ALU, allowing for quick access and efficient processing during arithmetic and logic operations.
Buses
The term bus, in computing, is a set of physical connections for example, cables or printed circuits, used to pass information from one place to another. Each bus has a particular width which refers to the number of bits that a bus can transmit at once.
The main pathway that carries data between the CPU and RAM is the System Bus which is made up of:
The Address Bus which carries memory addresses that the CPU wants to access to read data from or write data to. Since it only transfers an address, it only carries data in one direction, so we say that it is a unidirectional bus.
The Data Bus which carries the instructions and data go to memory from the CPU or go to the CPU from memory. This means that data is carried in two directions, so we that is it is a bi-directional bus.
The Control Bus carries signals from the Control Unit to different parts of the computer such as memory and I/O, ensuring smooth communication during operations. These signals can take the form of a read instruction, where the processor requests data from memory, or a write instruction, where the processor sends data to be stored in memory. These signals can travel in two directions, so we say that is a bidirectional bus.
Some Special Facts
The Address Bus determines what we call the address space, which means the total number of unique memory locations the CPU can use. A wider address bus allows for a larger address space which ultimately means more RAM.
The wider the address bus then the more RAM a computer can support.
The Data Bus determines what we call the word length, meaning the number of bits the CPU can process or transfer in one signal. For maximum efficiency and reliability, the width of the data bus should match the exact number of bits the CPU can handle in a single 'pulse' during instruction execution.
The more bits in a CPU signal, the wider the data bus.
The Fetch-Execute Cycle
Each time a signal is generated by the CPU, one atomic instruction is executed. The CPU continuously generates these signals in succession, retrieving instructions from memory and processing them. This ongoing process is known as the Fetch-Execute Cycle which we break down into the following steps:
Fetch:
The Control Unit fetches the instruction from RAM by activating the address bus, which specifies the location of the instruction in memory.
Decode:
The Control Unit decodes the instruction by activating the data bus, which transfers the instruction data from memory to the CPU.
Execute:
The Control Unit, with assistance from the ALU if needed, executes the instruction, utilizing the appropriate internal pathways.
Store:
The Control Unit stores the result in a register, such as the Accumulator, or directly to a memory location by activating the control bus, which manages the flow of data to and from memory.
The Need for Speed!
When we are buying a computer, one of the key things we look out for is the CPU speed which is measured in fetch-execute cycles. The more cycles, the better your CPU performs. This is why, when shopping you check the system clock speed which is measured in Hertz (Hz) — higher numbers mean more power! This rating is like the heartbeat of your computer, dictating how quickly those cycles can happen.
And when we cannot improve the CPU's 'heartbeat' what can we do? I have a feeling you know the answer already.
Single-Core vs. Multi-Core
If you are thinking of the idea of adding more processing units, or cores, within a CPU, then you are on the right track.
The first computer I owned had a single-core CPU which is like a having one-lane road for instructions; so only one instruction could be executed within a single 'heartbeat'.
Nowadays this has changed. Even our wearable gadgets feature multi-core CPUs, so we get multiple lanes, allowing several instructions to zoom through at once. This is great for multitasking and heavy-duty applications.
So for your perfect computer you want multiple high-speed traffic lanes, meaning, a fast system clock with multi-core power. Now that is a recipe for some serious performance!
Comments