The central processing unit (CPU) is mainly composed of arithmetic units and controllers. The arithmetic unit is a component in the computer that performs various arithmetic operations and logical operations. It consists of an arithmetic logic unit (ALU), an accumulator, a status register, a general-purpose register group, etc. The controller is the nerve center of the computer, directing all components in the machine to automatically coordinate their work; the controller consists of a program counter, an instruction register, an instruction decoder, a timing generator and an operation controller. It is the "decision-making mechanism" that issues commands. , that is, to complete the coordination and command of the operation of the entire computer system.
#The operating environment of this article: windows10 system, thinkpad t480 computer.
CPU is mainly composed of arithmetic units and controllers.
Central processing unit (CPU) is one of the main devices of electronic computers and the core component of computers. Its function is mainly to interpret computer instructions and process data in computer software. The CPU is the core component of the computer that reads instructions, decodes them, and executes them.
The central processing unit mainly consists of two parts, namely the controller and the arithmetic unit, which also include cache memory and the data and control bus that realize the connection between them. The three core components of an electronic computer are the CPU, internal memory, and input/output devices. The main functions of the central processing unit are to process instructions, perform operations, control time, and process data.
Operator
Operator: arithmetic unit, a component in the computer that performs various arithmetic operations and logical operations.
The arithmetic unit consists of an arithmetic logic unit (ALU), an accumulator, a status register, a general-purpose register group, etc. The basic functions of the Arithmetic Logic Operation Unit (ALU) are the four arithmetic operations of addition, subtraction, multiplication, and division, logical operations such as AND, OR, NOT, and XOR, as well as operations such as shift and complement. When the computer is running, the operations and types of operations of the arithmetic units are determined by the controller. The data processed by the operator comes from the memory; the processed result data is usually sent back to the memory or temporarily stored in the operator. Together with the Control Unit, it forms the core part of the CPU.
The calculator is a functional component in the computer that processes data. Data processing mainly includes arithmetic operations on data and logical operations on logical data. Therefore, implementing arithmetic and logical operations on data is the core function of the arithmetic unit.
The basic function of the arithmetic unit is to complete the processing of various data, such as the four arithmetic operations, logical operations such as AND, OR, and negation, arithmetic and logical shift operations, comparing values, changing symbols, and calculating Main memory address, etc.
The registers in the operator are used to temporarily save the data participating in the operation and the intermediate results of the operation. Corresponding components should also be set up in the operator to record the characteristics of an operation result, such as whether it overflows, the sign bit of the result, whether the result is zero, etc.
Type of operator:
There are many types of operators used in computers. Analyzed from different perspectives, there are different classification methods.
The decimal point representation can be divided into fixed-point arithmetic and floating-point arithmetic.
The fixed-point arithmetic unit can only perform fixed-point number operations. Its characteristic is that the range represented by machine numbers is smaller, but the structure is simpler.
The floating-point arithmetic unit has a strong function and can operate on both floating-point numbers and fixed-point numbers. Its number representation range is large, but its structure is quite complex.
#In terms of the carry system, it is divided into binary operators and decimal operators.
Generally, computers use binary arithmetic units. As computers are widely used in business and data processing, more and more machines are expanding the function of decimal arithmetic, so that the arithmetic units can complete both Binary operations can also be completed with decimal operations.
The arithmetic unit in the computer needs to have the function of completing a variety of computing operations, so various algorithms must be integrated to design a complete computing component.
Controller
The controller is the nerve center of the computer, directing all components in the entire machine to work in automated coordination. Under the control of the controller, the computer can automatically perform a series of operations according to the steps set by the program to complete specific tasks. It is the "decision-making body" that issues orders, that is, coordinates and directs the operations of the entire computer system.
The main components inside the controller are as follows:
①Instruction register: stores instructions obtained from the memory.
②Decoder: Translate the operation code in the instruction into a control signal.
③ Timing beat generator: Generates timing pulse beat signals to make the computer work rhythmically and orderly.
④ Operation control components: combine control signals to control each component to complete the corresponding operation.
⑤Instruction counter: Calculate and point out the address of the next instruction.
basic skills:
Data buffer: Since the speed of the I/O device is low but the speed of the CPU and memory is high, a buffer must be set in the controller. During output, this buffer is used to temporarily store data transmitted from the host at high speed, and then the data in the buffer is transmitted to the I/O device at the rate of the I/O device; during input, the buffer is used It temporarily stores the data sent from the I/O device, and then transmits the data in the buffer to the host at high speed after receiving a batch of data.
Error control: The device controller is also responsible for error detection of data transmitted by the I/O device. If an error occurs during transmission, the error detection code is usually set and reported to the CPU, so the CPU invalidates the data transmitted this time and retransmits it. This ensures the correctness of data entry.
Data exchange: This refers to the data exchange between the CPU and the controller, and between the controller and the device. For the former, the CPU writes data to the controller in parallel through the data bus, or reads data from the controller in parallel; for the latter, the device inputs data to the controller, or transmits data from the controller to the device. . For this purpose, data registers must be set in the controller.
Status description: The controller that identifies and reports the status of a device should write down the status of the device for the CPU to understand. For example, the CPU can start the controller to read data from the device only when the device is in a ready-to-send state. To this end, a status register should be set up in the controller, and each bit in it should be used to reflect a certain status of the device. When the CPU reads the contents of this register, it can understand the status of the device.
Receive and recognize commands: The CPU can send a variety of different commands to the controller, and the device controller should be able to receive and recognize these commands. To this end, there should be corresponding control registers in the controller to store received commands and parameters, and to decode the received commands. For example, the disk controller can receive 15 different commands such as Read, Write, and Format from the CPU, and some commands also have parameters; accordingly, there are multiple registers and command decoders in the disk controller.
Address identification: Just like every unit in the memory has an address, every device in the system also has an address, and the device controller must be able to identify it. The address of each device controlled. In addition, in order for the CPU to write (or read) data to (or from) registers, these registers should have unique addresses.
Extended information
For the CPU, the main indicators that affect its performance are the main frequency and the bits of the CPU. numbers and the CPU's cached instruction set. The so-called main frequency of the CPU refers to the clock frequency, which directly determines the performance of the CPU. Therefore, if you want to improve the performance of the CPU, increasing the main frequency of the CPU is a good way.
The number of bits of the CPU refers to the number of floating-point numbers that the processor can calculate at one time. Generally, the higher the number of bits of the CPU, the faster the CPU will perform operations. . Nowadays, the number of CPU bits is generally 32 or 64 bits.
In the past, the computers used by people were all 32-bit systems. In recent years, the proportion of 64-bit processors in the computers used by people has become larger. This is because the running speed of 64-bit computers has become faster. Faster and improve people's work efficiency.
The CPU cache instruction set is stored inside the CPU, which mainly refers to hard programs that can guide and optimize the CPU's operations. Generally speaking, the CPU cache can be divided into first-level cache, second-level cache and third-level cache, and those processors with stronger processing capabilities generally have larger third-level caches.
Recommended: "Programming Video"
The above is the detailed content of What does a central processing unit (CPU) mainly consist of?. For more information, please follow other related articles on the PHP Chinese website!