The central processing unit (CPU, Central Processing Unit) is a very large-scale integrated circuit, which is the core and control unit of a computer. . Its function is mainly to interpret computer instructions and process data in computer software. The central processing unit mainly includes arithmetic units (arithmetic logic unit, ALU, Arithmetic Logic Unit) and high-speed buffer memory (Cache) and the bus (Bus) that realizes the data (Data), control and status of the connection between them. It, together with internal memory (Memory) and input/output (I/O) equipment, is called the three core components of an electronic computer.
The CPU can be logically divided into 3 modules, which are the control unit, the arithmetic unit and the storage unit. These three parts are connected by the internal bus of the CPU.
The fundamental task of the CPU is to execute instructions. For the computer, it is ultimately a sequence of "0" and "1". The CPU can be logically divided into 3 modules, which are the control unit, the arithmetic unit, and the storage unit. These three parts are connected by the internal bus of the CPU. As shown below:
The control unit is the command and control center of the entire CPU, which consists of the instruction register IR (Instruction Register), instruction decoder ID (Instruction Decoder) and operation The OC (Operation Controller), etc., are extremely important for coordinating the orderly work of the entire computer. It fetches each instruction from the memory in turn according to the program programmed by the user, puts it in the instruction register IR, determines what operation should be performed through instruction decoding (analysis), and then operates the controller OC according to the determined timing, Send micro-operation control signals to the corresponding components. The operation controller OC mainly includes control logic such as a beat pulse generator, a control matrix, a clock pulse generator, a reset circuit and a start-stop circuit.
The arithmetic unit
is the core of the arithmetic unit. It can perform arithmetic operations (including basic operations such as addition and subtraction of multipliers and additional operations) and logical operations (including shifting, logical testing, or comparison of two values). Relative to the control unit, the arithmetic unit accepts the command of the control unit to act, that is, all operations performed by the arithmetic unit are directed by the control signal issued by the control unit, so it is an execution component.
Including CPU on-chip cache and register group, it is the place where data is temporarily stored in the CPU, which stores the data waiting to be processed or the data that has been processed. The time it takes for the CPU to access the registers is shorter than the time it takes to access the memory. The use of registers can reduce the number of times the CPU accesses the memory, thereby increasing the working speed of the CPU. However, due to the limitation of chip area and integration, the capacity of the register bank cannot be very large. The register group can be divided into special register and general register. The function of the special register is fixed, register the corresponding data separately. The general-purpose registers are versatile and can be specified by the programmer. The number of general-purpose registers varies from microprocessor to microprocessor.
The logical unit of the CPU
From the perspective of the realized functions, the CPU can be roughly divided into the following eight logical units:
(1) Instruction register: it It is the instruction storehouse on the chip. With it, the CPU does not have to stop and look for instructions in the computer memory, which greatly improves the CPU's computing speed.
(2) Instruction decoder: It is responsible for interpreting complex machine language instructions into a simple format that arithmetic logic unit (ALU) and registers can understand, just like a diplomat.
(3) Control unit: Since instructions can be stored in the CPU, and there are corresponding instructions to complete the preparatory work before calculation, there is naturally a role behind it that plays a driving role-it is responsible for the entire processing process Operation controller. According to the instruction from the decoding unit, it will generate control signals to tell the arithmetic logic unit (ALU) and registers how to operate, what to operate on, and how to process the result.
(4) Register: It is very important for the CPU. In addition to storing part of the instructions of the program, it is also responsible for storing pointer jump information and loop operation commands. It is the arithmetic logic unit (ALU) for completion A small storage area for data used by the task requested by the control unit. The data source can be any of the cache, memory, and control unit.
(5) Logic Operation Unit (ALU): It is an intelligent component of the CPU chip, capable of executing various commands such as addition, subtraction, multiplication, and division. In addition, it also knows how to read logical commands such as OR, AND, and NOT. The message from the control unit will tell the arithmetic logic unit what to do, and then the arithmetic unit will intermittently or continuously extract data from the register to complete the final task.
(6) Prefetch unit: PU performance is very dependent on it. The prefetch hit rate is directly related to the CPU core utilization rate, which in turn brings about the difference in instruction execution speed. According to the requirements of the command or the task to be executed, at any time, the prefetch unit may obtain data and instructions from the instruction cache or computer memory. When instructions arrive, the most important task of the prefetch unit is to ensure that all instructions are arranged correctly, and then sent to the decoding unit.
(7) Bus unit: It is like a highway, which quickly completes the data exchange between various units, and it is also the place where data flows into and out of the CPU from the memory.
(8) Data Cache: Stores specially marked data from the decoding unit for use by the logic operation unit. At the same time, it also prepares the final results distributed to different parts of the computer.
Through the above introduction, it can be seen that although the CPU is small, it can accommodate the big world in a square inch. The interior is more like a developed assembly factory, interlocking and layered. It is precisely because of mutual cooperation that the instructions are finally executed, which constitutes a magical digital world with pictures, texts, and images.
English Processing instructions; this refers to the order of execution of instructions in the control program. There is a strict sequence among the instructions in the program, which must be executed in strict accordance with the order stipulated by the program to ensure the correctness of the computer system.
Perform an action
English Perform an action; the function of an instruction is often implemented by a series of operations performed by components in the computer. The CPU should generate corresponding operation control signals according to the function of the instruction, and send it to the corresponding components, so as to control these components to act according to the requirements of the instruction.
English Control time; time control is the timing of various operations. During the execution of an instruction, what operations are performed at any time should be strictly controlled. Only in this way can the computer work in an orderly manner.
That is to perform arithmetic and logical operations on the data, or perform other information processing.
Its function is mainly to interpret computer instructions and process data in computer software, and execute instructions. In the microcomputer, it is also called the microprocessor. All the operations of the computer are controlled by the CPU. The performance index of the CPU directly determines the performance index of the microcomputer system. The CPU has the following four basic functions: data communication, resource sharing, distributed processing, and system reliability. The principle of operation can be basically divided into four stages: Fetch, Decode, Execute and Writeback.