The central processing unit (CPU) is the primary component of any digital computer system, consisting of the main memory, the control unit, and the arithmetic-logic unit. It is the physical heart of the entire computer system, to which various peripheral equipment, such as input/output devices and auxiliary storage units, are connected. The CPU in modern computers is housed on an integrated circuit chip known as a microprocessor.
A microprocessor is a small electronic device that contains the arithmetic, logic, and control circuitry required to perform the functions of a digital computer’s central processing unit. In practice, this type of integrated circuit is capable of interpreting and executing program instructions in addition to performing arithmetic operations.
The central processing unit’s control unit regulates and integrates the computer’s operations. It selects and retrieves instructions from the main memory in the correct sequence and interprets them so that the other functional elements of the system can perform their respective operations at the appropriate time. All input data are transferred via main memory to the arithmetic-logic unit for processing, which includes the four basic arithmetic functions (addition, subtraction, multiplication, and division) as well as certain logic operations such as data comparison and selection of the desired problem-solving procedure or a viable alternative based on predetermined decision criteria.
The Central Processing Unit (CPU) has the following characteristics:
The CPU itself is made up of the three components listed below.
Memory or Storage Unit
This unit has the capability of storing instructions, data, and intermediate results. When necessary, this unit sends data to other computer units. It is also referred to as an internal storage unit, main memory, primary storage, or Random Access Memory (RAM). Its size has an impact on its speed, power, and capability. In a computer, there are two types of memories: primary memory and secondary memory. The memory unit’s functions are as follows:
The Control Unit
This unit manages the operations of all computer components but does not perform any actual data processing. To function properly, all CPU components must be synchronized. The control unit performs this function at a rate determined by the clock speed and is in charge of directing the operations of the other units through the use of timing signals that run throughout the CPU.
This unit’s functions are as follows:
Arithmetic Logic Unit
This unit is divided into two subsections, namely,
Sections of Arithmetic and Logic
The arithmetic unit’s function is to perform arithmetic operations such as addition, subtraction, multiplication, and division. All complex operations are carried out by repeatedly performing the aforementioned operations.
The logic unit’s function is to perform logic operations on data such as comparing, selecting, matching, and merging.
The arithmetic logic unit (ALU) is responsible for the computer’s arithmetic and logical functions. The input data is held in the A and B registers, and the result of the operation is received in the accumulator. The instruction register stores the instruction that the ALU will execute.
When adding two numbers, for example, one is placed in the A register and the other in the B register. The addition is performed by the ALU, and the result is stored in the accumulator. The data to be compared is placed into the input registers if the operation is logical. The comparison result, a 1 or 0, is stored in the accumulator. The accumulator content is then placed into the cache location reserved by the program for the result, whether it is a logical or arithmetic operation.
The ALU also performs another type of operation. The result is a memory address, which is used to calculate a new memory location to begin loading instructions. The outcome is stored in the instruction pointer register.
Instruction register and pointer
The instruction pointer identifies the memory location in which the CPU will execute the next instruction. When the current instruction is completed, the CPU loads the next instruction into the instruction register from the memory location specified by the instruction pointer.
The CPU never has direct access to RAM. Modern CPUs have one or more cache layers. The CPU’s calculation speed is much faster than the RAM’s ability to feed data to the CPU.
Cache memory is faster than system RAM and, because it is located on the processor chip, it is closer to the CPU. The cache stores data and instructions to keep the CPU from having to wait for data to be retrieved from RAM. When the CPU requires data—and program instructions are considered data—the cache checks to see if the data is already in residence and returns it to the CPU.
If the requested data is not in the cache, it is retrieved from RAM and used to move more data from RAM into the cache using predictive algorithms. The cache controller analyses the requested data and attempts to predict what additional data from RAM will be required. It loads the expected data into the cache. By storing some data closer to the CPU in a faster-than-RAM cache, the CPU can stay busy and avoid wasting cycles waiting for data.
Our simple CPU has three cache levels. Levels 2 and 3 are intended to predict what data and program instructions will be required next, and to move that data from RAM to a location closer to the CPU so that it is ready when needed. These cache sizes typically range from 1 MB to 32 MB, depending on the processor’s speed and intended use.
The Level 1 cache is the one that is closest to the CPU. There are two types of L1 cache in our CPU. The instruction cache is L1i, and the data cache is L1d. Level 1 cache sizes are typically 64 KB to 512 KB.
Memory management system
The memory management unit (MMU) controls the data flow between RAM and the CPU. It also provides the memory protection needed in multitasking environments, as well as the conversion of virtual memory addresses to physical addresses.
RAM stands for random access memory (RAM)
Although RAM, or main storage, is depicted in this and the following diagrams, it is not a true component of the CPU. Its purpose is to store programs and data so that they are available for use when the CPU requires them.
How CPUs work?
CPUs operate on a cycle managed by the control unit and synchronized by the CPU clock. This cycle is known as the CPU instruction cycle, and it is made up of fetch/decode/execute components. The instruction is fetched and placed into the instruction register, which may contain static data or pointers to variable data. The instruction is decoded, and any data that results are stored in the A and B data registers. The instruction is carried out using the A and B registers, and the result is stored in the accumulator. The CPU then increases the value of the instruction pointer by the length of the previous one and starts over.