CPU stands for Central Processing Unit, and is made up of a number of components which enable it to execute instructions and carry out tasks.
The CPU is the most important hardware component in a computer. It has two main functions:
The primary purpose of a CPU (Central Processing Unit) is to execute instructions that are stored in memory. These instructions make up a program, and the CPU is responsible for fetching, decoding, and executing them in order to perform the desired computation or operation.
The CPU also acts as the "brain" of a computer, controlling and coordinating the activities and interactions of all the other components in the system, such as memory, storage, and input/output devices. It uses a combination of internal registers, buses, and control logic to manage and direct the flow of data and instructions throughout the system.
The central processing unit (CPU) consists of 6 main components parts:
Arithmetic Logic Unit (ALU): This is the component of the CPU that performs mathematical and logical operations, such as addition, subtraction, comparison, and bitwise operations.
Control Unit (CU): This component fetches instructions from memory, decodes them to determine the operation to be performed, and controls the flow of data and instructions throughout the system.
Registers: These are small, high-speed storage locations within the CPU that hold data and instructions that are currently being processed. They are used to temporarily store data and intermediate results during computation.
Cache: A small, high-speed memory used by the CPU to store recently accessed data and instructions. This can help to speed up processing by reducing the number of times the CPU needs to access main memory.
Buses: These are communication pathways that connect the CPU to other components in the system, such as memory and input/output devices. They are used to transfer data and instructions between the CPU and these other components.
Clock: A timing circuit that generates a regular pulse used to synchronize the operations of the CPU and other components in the system.
All components work together to allow processing and system control.
What do each of the components do in more detail?
The Arithmetic Logic Unit (ALU) is a component of the CPU that performs mathematical and logical operations. It is responsible for executing the instructions that make up a program, such as arithmetic operations (e.g., addition, subtraction, multiplication, and division) and logical operations (e.g., AND, OR, NOT, and XOR).
The Control Unit (CU) is a component of the CPU that manages the flow of instructions and data throughout the system. It is responsible for fetching instructions from memory, decoding them to determine the operation to be performed, and controlling the execution of those instructions.
Registers are small, high-speed storage locations within the CPU that hold data and instructions that are currently being processed. They are used to temporarily store data and intermediate results during computation.
Holds the memory address of the next instruction to be executed
Holds the actual instruction, and then the data that has been fetched from memory
Holds the memory address of the current instruction, and then the data that it uses, so that these can be fetched from memory
Holds the result of an instruction before it is transferred to memory
Holds the current instruction being executed and is divided into operand and opcode.
The status register contains a number of bits that indicate what occurrence of interrupt has taken place. The values in the register correspond to different condition flag:
Zero flag - indicating a result of zero in an operation
Carry flag - indicating overflow or underflow in arithmetic operations
Sign flag - indicating whether the result is negative
Overflow flag - indicating an overflow condition in arithmetic operations
Cache is a small, high-speed memory that is located within the CPU, used to temporarily store frequently accessed data and instructions. It is used to speed up the performance of the CPU by reducing the number of times it needs to access main memory.
In a CPU, buses are groups of wires or pathways that are used to transfer data and instructions between different components of the CPU and between the CPU and other components of the computer, such as memory and peripheral devices.
The control bus can receive signals in both directions (bi-directional). The purpose of the control bus is to ensure that the use of the data and address buses by other components in the system do not conflict.
The data bus is a bi-directional bus and is responsible for moving data and instructions between different system components. The data bus is typically composed of 8, 16, 32 or 64 lines.
The address bus is uni-directional unlike the data bus, and is responsible for carrying the memory location/address of the register where the current data is being fetched from or written to
The clock in a CPU is an electronic circuit that generates a steady stream of pulses, called clock cycles, that are used to synchronize the different components of the CPU.
The address of the next instruction is copied from the program counter to the memory address register (MAR).
The instruction held at the address stored in the MAR is then copied to the memory data register (MDR).
The contents of the MDR are then copied to the current instruction register (CIR)
The instruction held in the CIR is decoded. The instruction is split into an opcode and an operand. The opcode is used to determine the type of instruction and which hardware should execute it. The operand can hold any of the following:
The address of the data to be used with the operation, which is then copied to the MAR
The actual data to be operated on, which will be copied to the MDR
The data to be operated on may be passed to the ALU/accumulator
The appropriate instruction/opcode is carried out on the operand
Clock speed is the number of pulses the central processing unit's (CPU) clock generates per second. It is measured in hertz.
Cache is a small amount of high-speed random access memory (RAM) built directly within the processor. It is used to temporarily hold data and instructions that the processor is likely to reuse.
A processing unit within a CPU is known as a core. Each core is capable of fetching, decoding and executing its own instructions
Pipelining is a technique which can be implement into a processor to improve performance. Using pipelining allows the computer architecture allows the next instructions to be fetched whilst the concurrent is still being processed by the arithmetic logic unit, it then holds the instructions in buffer until the instructions can be decode and executed.
Why does each of these effect CPU performance?
Clock Speed
The more pulses per second, the more fetch-decode-execute cycles that can be performed and the more instructions that are processed in a given space of time. Overclocking can cause long term damage to the CPU as it is working harder and producing more heat. The average CPU clock speed is around 2.3-2.69 Ghz (according to steam hardware survery 2022) and the highest a CPU has ever been clocked to is 8.812GHz!
Cache Size
The bigger its cache, the less time a processor has to wait for instructions to be fetched.
Number Of Cores
The more cores a CPU has, the greater the number of instructions it can process in a given space of time. Many modern CPUs are dual (two) or quad (four) core processors. This provides vastly superior processing power.
Pipelining
Allows the processor to fetch the next instructions whilst the ALU is currently executing meaning that once it has finished there is no wait for the next instruction since it is already held in a buffer ready to be executed. This leads to more instructions be processed in an equivalent time to where pipelining is absent.
Von Neumann architecture is the principle that virtually all computers today follow. The structure consists of a processor with a shared memory and bus for both data and instructions.
Harvard Architecture is a computer architecture which has physically separate memories for instructions and data.
Art style for this page - Photo Realism