What is CPU

Source: Internet
Author: User
Tags arithmetic comparison numeric numeric value

The CPU extracts instructions from memory or cache memory, puts them in the instruction register, and decodes the instructions. It breaks down the instructions into a series of micro-operations, and then emits various control commands and executes the micro-operation series, which completes the execution of a single instruction. An instruction is a basic command that a computer prescribes the type and operand of an action. Directives are composed of one byte or more bytes, including the opcode field, one or more fields related to the operand address, and some state words and signatures that characterize the state of the machine. Some directives also directly contain the operand itself.

Extraction

The first phase, extraction, retrieves instructions from memory or cache memory (for numeric or series values). The Application counter (program Counter) specifies the location of the memory, and the program counter holds the numeric value to identify the current program location. In other words, the program counter records the traces of the CPU in the current program. After extracting the instruction, the program counter increases the memory cell according to the instruction length. The extraction of instructions must often be sought from relatively slow memory, thus causing the CPU to wait for instructions to be sent. This problem is mainly addressed in the fast-access and pipeline architecture of modern processors.

Decoding

The CPU determines its execution behavior based on the instructions it extracts from the memory. In the decoding phase, the instruction is disassembled into a meaningful fragment. Converts a numeric value to an instruction based on the CPU's instruction set schema (ISA) definition. Part of the instruction value is the operation code (OPCODE), which indicates which operations to perform. Other values usually provide the necessary information for the instruction, such as the operational target of an addition (addition) operation. Such an operational target may provide a constant value (i.e. immediate value), or a addressable value of a space: a register or memory address, which is determined by the addressable pattern. In the old design, the instruction decoding part of the CPU is a hardware device that cannot be changed. However, in many abstract and complex CPU and instruction set architectures, a micro-program is often used to help transform commands into signals of various forms. These micro-programs in the finished CPU can often be rewritten to facilitate the change of decoding instructions.

Perform

After the extraction and decoding phase, then proceed to the execution stage. In this phase, you connect to a variety of CPU parts that can perform the required operations. For example, an addition operation is required, and the Arithmetic logic unit (alu,arithmetic Logic) will connect to a set of inputs and a set of outputs. The input provides the value to be added, and the output contains the result of the sum. The ALU contains a circuit system that is easy to perform simple ordinary and logical operations (such as addition and bitwise operations) for the output terminal. If the addition operation produces a result that is too large for the CPU processing, the operation overflow (arithmetic Overflow) flag may be set in the token register.

Write back

The final stage, written back, writes the results of the execution phase in a certain format to a simple writeback. The result of the operation is often written into a register inside the CPU for quick access to subsequent instructions. In other cases, the result of the operation may be written in a slower, but larger, and less expensive main memory. Some types of directives manipulate program counters without directly producing results. These are generally referred to as "jumps" (jumps), and bring cyclic behavior, conditional execution (through conditional jumps), and functions in the program. Many directives also change the status bits of the flag registers. These flags can be used to influence the behavior of the program, because they often show the results of various operations. For example, the size of two values is judged by a "comparison" instruction, and a numeric value is set on the label register based on the comparison. This flag can be used to determine program movements with subsequent jump instructions. After executing the instruction and writing back the result, the value of the program counter is incremented, the entire process is repeated, and the next instruction cycle normally extracts the next sequential instruction. If the jump instruction is completed, the program counter will be modified to the command address to which it is jumped, and the program continues to perform normally. Many complex CPUs can fetch multiple instructions, decode, and execute at the same time. This section typically involves "classic RISC pipelines", which are actually fast-growing in many electronic devices that use simple CPUs (often called micro-control (microcontrollers)).

Basic structure

The CPU includes operational logic parts, register parts and control parts.

Operational Logic Parts

Operational logic parts that perform fixed-point or floating-point arithmetic operations, shift operations, and logical operations, and also perform address operations and conversions.

Register Parts

A

Register part, which includes a universal register, a dedicated register, and a control register. Universal registers can also be divided into fixed-point number and floating-point numbers, which are used to save the register operand and operation result in the instruction. Universal registers are an important part of the central processing Unit, and most commands have access to universal registers. The width of the universal register determines the width of the data path within the computer, and the number of ports can often affect the parallelism of internal operations. A dedicated register is a register required to perform some special operations. The control registers are usually used to indicate the state of the machine execution, or to keep some pointers, there are processing status registers, address conversion directory of the base address, privileged state registers, conditional code registers, handling exception registers and error checking registers. Sometimes, the central processing unit also has some cache, used for temporary storage of some data instructions, the larger the cache, indicating the faster the CPU operation, the current market in high-end central processing unit has a 2M or so two cache, high-end central processing unit has 4 m or so two-level cache.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.