What is the working process of the CPU? Do you know?
CPU working process
The CPU fetches instructions from memory or cache, places them into instruction registers, and decodes the instructions. It breaks up the instructions into a series of micro-ops, then issues various control commands to execute the micro-operation series to complete the execution of an instruction. An instruction is a basic command that the computer specifies the type and operand to perform the operation. An instruction consists of one byte or more bytes, including an opcode field, one or more fields related to the operand address, and some status words and signatures that characterize the state of the machine. Some instructions also directly contain the operand itself.
extract
The first stage, extracting, retrieves the instruction (either a value or a series of values) from memory or cache. The location of the memory is specified by the program counter. (The program counter holds the value for identifying the location of the program. In other words, the program counter records the trace of the cpu in the program.)
decoding
The CPU determines its execution behavior based on the instructions fetched by the memory. During the decoding phase, the instructions are broken down into meaningful segments. The values ​​are interpreted as instructions according to the instruction set architecture (isa) of the cpu. A portion of the instruction value is an opcode indicating which operations are to be performed. Other values ​​typically supply the necessary information for the instruction, such as the operation target of an addition operation.
carried out
After the extraction and decoding phases, the execution phase is followed. In this phase, you connect to various cpu components that can perform the required operations.
For example, an addition operation is required, and an arithmetic logic unit (alu) will be connected to a set of inputs and a set of outputs. The input provides the value to be added, and the output will contain the result of the sum. Alu contains a circuit system that makes it easy for the output to perform simple normal and logical operations (such as addition and bit operations). If the addition produces a result that is too large for the cpu processing, an arithmetic overflow flag may be set in the flag register.
Write back
In the final stage, write back and simply write back the results of the execution phase in a certain format. The result of the operation is often written into the scratchpad inside the cpu for quick access by subsequent instructions. In other cases, the results may be written in a main memory that is slower but larger and cheaper. Some types of instructions operate on program counters without directly producing results. These are commonly referred to as "jumps" and bring looping behavior, conditional execution (through conditional jumps), and functions in the program. Many instructions change the status bits of the flag register. These flags can be used to influence program behavior, as they often show various results. For example, a "comparison" instruction is used to determine the size of two values, and a value is set on the flag register based on the comparison result. This flag can be used to determine the program direction by subsequent jump instructions. After executing the instruction and writing back the result, the program counter value is incremented, repeating the entire process, and the next instruction cycle normally extracts the next sequential instruction.
Shenzhen MovingComm Technology Co., Ltd. , https://www.movingcommiot.com