【Computer composition principle】-【CPU working principle】

 

The original working mode of the CPU

   Before we get into understanding how the CPU works, let's briefly talk about how the CPU was originally produced.

 

    The CPU is made on a particularly pure silicon material. A CPU chip contains millions of tiny transistors. Transistors are chemically etched or photolithographically etched on a silicon wafer the size of a fingernail. So, in this sense, the CPU is made up of transistors. In simple terms, transistors are tiny electronic switches. They are the building blocks of a CPU. You can think of a transistor as a light switch. They have an operating bit that represents two states: ON (on) and OFF (off) . This switch is equivalent to the connection and disconnection of the transistor, and these two states correspond to the basic states "0" and "1" in binary! In this way, the computer has the ability to process information.

 

    But please don't think that the principle of transistors with only simple "0" and "1" states is very simple. In fact, their development is obtained after years of hard research by scientists. Before transistors, computers relied on slow, inefficient vacuum tubes and mechanical switches to process information. Later, researchers put two transistors into a silicon crystal, creating the first integrated circuit, and then the microprocessor.


    Seeing this, you may be wondering, how does a transistor use the two electronic signals "0" and "1" to execute instructions and process data? Actually, all electronic devices have their own circuits and switches, the flow of electrons in the circuit or break is completely controlled by the switch, if you set the switch to OFF, the electrons will stop flowing, if you set it to ON again, Electrons will continue to flow again. This ON and OFF switching of transistors is only controlled by electronic signals, and we can call transistors binary devices. In this way, the ON state of the transistor is represented by "1", and the OFF state is represented by "0", which can form the simplest binary number. The special order and pattern of multiple '1's and '0' produced by numerous transistors can represent different situations, which are defined as letters, numbers, colors, and graphics. For example, 1 in decimal is also "1" in binary mode, 2 is "10" in binary mode, 3 is "11", 4 is "100", 5 is "101", and 6 is "110" and so on, and so on, this makes up the binary language and data in which computers work. Groups of transistors can be combined to store values, as well as perform logical and digital operations. Combined with the control of a quartz clock, the transistor groups perform their functions synchronously like a complex machine.

 

Internal structure of CPU

    Now we have a general idea of ​​what the CPU is responsible for, but which components are responsible for processing data and executing programs?

 

1. Arithmetic Logic Unit ALU (Arithmetic Logic Unit)

   The ALU is the heart of the operator. It is based on a full adder, supplemented by a circuit composed of a shift register and corresponding control logic, which can complete four operations of addition, subtraction, multiplication, and division and various logical operations under the action of control signals. As just mentioned, this is equivalent to the production line in the factory, which is responsible for computing data.

 

2. Register Set RS (Register Set or Registers)

   The RS is essentially a 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 used by the CPU to access the register is shorter than the time to access the memory. The use of registers can reduce the number of times that the CPU accesses the memory, thereby improving the working speed of the CPU. However, due to the limitation of chip area and integration, the capacity of the register group cannot be very large . The register group can be divided into special-purpose registers and general-purpose registers . The role of the special registers is fixed, and the corresponding data are respectively registered. General-purpose registers, on the other hand, are widely used and can be specified by the programmer. The number of general purpose registers varies from microprocessor to microprocessor.

 

3. Control Unit

    Just like the logistics distribution department of the factory, the control unit is the command and control center of the entire CPU. It consists of three components: the instruction register IR (Instruction Register), the instruction decoder ID (Instruction Decoder) and the operation controller OC (Operation Controller). It is extremely important to coordinate the orderly work of the entire computer. According to the program pre-programmed by the user, it sequentially fetches each instruction from the memory, 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. A micro-operation control signal is issued to the corresponding component. The operation controller OC mainly includes control logic such as beat pulse generator, control matrix, clock pulse generator, reset circuit and start-stop circuit.

 

4. Bus (Bus)

    Just like the communication channel between various parts in the factory, the bus is actually a set of wires, a collection of various public signal lines, used as a "highway" used by all the components in the computer to transmit information. A bus directly connected to the CPU can be called a local bus. Including: data bus DB (Data Bus), address bus AB (Address Bus), control bus CB (Control Bus). Among them, the data bus is used to transmit data information; the address bus is used to transmit address information sent by the CPU; the control bus is used to transmit control signals, timing signals and status information.

Workflow of the CPU

    The CPU composed of transistors is the core of processing data and executing programs. Its full English name is: Central Processing Unit, that is, the central processing unit. First, the internal structure of CPU can be divided into three parts: control unit, logic operation unit and storage unit (including internal bus and buffer). The working principle of the CPU is like the processing of products in a factory: the raw materials (program instructions) entering the factory are dispatched and distributed by the material distribution department (control unit), sent to the production line (logical operation unit), and the finished product (processing unit) is produced. After the data), it is stored in the warehouse (storage unit), and finally waiting to be sold in the market (handed over to the application). In this process, we noticed that starting from the control unit, the CPU started the formal work, and the intermediate process is to perform the operation processing through the logic operation unit, and hand it over to the storage unit to represent the end of the work.

 

The operation of data and instructions in the CPU

    The components and basic principles of the CPU have been introduced to you just now. Now, let's take a look at how data runs in the CPU. We know that data flows from the input device through the memory, waiting for the processing of the CPU. The information to be processed is stored in bytes, that is, stored in 8-bit binary numbers or 8-bit units. This information can be data or instruction. Data can be binary representation of characters, numbers or colors, etc. Instructions tell the CPU what to do with the data, such as adding, subtracting, or shifting.

 

    We assume that the data in memory is the simplest raw data. First, the instruction pointer (Instruction Pointer) notifies the CPU to place the instruction to be executed at the storage location in memory. Because each storage unit in the memory has a number (called an address), the data can be taken out according to these addresses and sent to the control unit through the address bus. The instruction decoder takes the instruction from the instruction register IR and translates it into the CPU Executable form, which then decides what operations are necessary to complete the instruction, which will tell the arithmetic logic unit (ALU) when to compute, the instruction reader when to fetch the value, the instruction decoder when to translate the instruction, etc. .

 

    If the data is sent to the ALU, the data will perform the arithmetic and various other operations specified in the instruction. When the data is processed, it will be returned to the register, and the data will be continued to run through different instructions or sent to the data buffer through the DB bus.

 

    Basically, this is how the CPU performs the three basic tasks of reading data, processing data, and writing data to memory. But in the usual case, an instruction can contain many operations performed in a clear order, the job of the CPU is to execute these instructions, and when an instruction is completed, the CPU's control unit in turn tells the instruction reader to read the next instruction from memory to execute. This process is repeated in rapid succession, rapidly executing one instruction after another, producing the result you see on the monitor. It is easy to think that while processing so many instructions and data, due to the data transfer time difference and the CPU processing time difference, there will definitely be chaotic processing. To ensure that each operation happens on time, the CPU needs a clock, and the clock controls every action the CPU performs. The clock is like a metronome, it pulses continuously, determining the pacing and processing time of the CPU, which is the nominal speed of the CPU we are familiar with, also known as the main frequency. The higher the main frequency value, the faster the CPU works, so you can pay attention to this indicator when you go to buy a computer Smile.

 

How to Improve CPU Work Efficiency

    Since the main job of the CPU is to execute instructions and process data, work efficiency will become the most important content of the CPU. Therefore, this has also become a competitive condition for major CPU manufacturers. Each CPU manufacturer also tries its best to make the CPU process data faster. quick.

 

    According to the internal operation structure of the CPU, some manufacturers add another arithmetic logic unit (ALU) in the CPU, or set up another floating point unit (FPU) to process very large and very small data, so that This greatly speeds up the speed of data manipulation.

 

    In terms of execution efficiency, some manufacturers improve the execution speed of instructions by executing instructions in a pipeline manner or in a manner of almost parallel work. We just mentioned that the execution of instructions requires many independent operations, such as instruction fetching and decoding. Originally, the CPU had to execute all the previous instructions before executing the next instruction, but now distributed circuits perform operations individually. That is, when this part of the circuit completes one piece of work, the second piece of work immediately occupies the circuit, which greatly increases the efficiency of execution.

 

    In addition, in order to make the connection between instructions more accurate, the current CPU usually uses multiple prediction methods to control the execution of instructions more efficiently.

 

    (Note: The above memory is basically from the Internet, and is published after editing and editing by myself)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326401429&siteId=291194637