Home  >  Article  >  What does the CPU perform to complete a basic operation or judgment?

What does the CPU perform to complete a basic operation or judgment?

王林
王林Original
2020-12-10 15:03:0717329browse

Cpu completes one step of basic operation or judgment by executing an instruction. The CPU mainly consists of two parts, namely the controller and the arithmetic unit; the controller uses instructions to direct the machine to work. Usually an instruction includes two aspects, namely operation code and operand; the operation code determines the operation to be completed, and the operand refers to the data participating in the operation and the unit address where it is located.

What does the CPU perform to complete a basic operation or judgment?

The operating environment of this tutorial: Windows 7 system, Dell G3 computer.

cpu completes one step of basic operation or judgment by executing an instruction.

In the CPU, the execution of an instruction includes three steps: instruction fetching, analysis and execution. Therefore, executing an instruction will complete one basic operation or judgment.

CPU introduction

Central processing unit (CPU) is one of the main devices of electronic computers and a core accessory in 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.

In the computer architecture, the CPU is the core hardware unit that controls and allocates all hardware resources of the computer (such as memory, input and output units) and performs general operations. The CPU is the computing and control core of the computer. The operations of all software layers in the computer system will eventually be mapped to CPU operations through the instruction set.

Instructions

In computers, instructions are instructions and commands that direct the machine to work. A program is a series of instructions arranged in a certain order. The process of executing a program is the working process of the computer.

The controller relies on instructions to direct the machine to work. People use instructions to express their intentions and give them to the controller for execution. The total set of different instructions that a computer can execute is called the computer's instruction system. Each computer has its own specific instruction system, and its instruction content and format are different.

Usually an instruction includes two aspects: operation code and operands

  • The operation code determines the operation to be completed

  • The operand refers to the data participating in the operation and the unit address where it is located

In computers, operation requirements and operand addresses are represented by binary numbers, which are called operation codes and address codes respectively. , the entire instruction is stored in the memory in the form of binary encoding.

The type and number of instructions are related to the specific machine model and will not be described in detail here. Please refer to the specific machine data manual.

Instruction execution process

  • #The first step is to fetch and analyze the instruction.

    According to the order specified by the program, the currently executed instructions are fetched from the internal memory and sent to the instruction register of the controller. The fetched instructions are analyzed, that is, based on the operation code in the instruction, the computer determines what should be done. What operation.

  • The second step is to execute the instructions.

    According to the instruction analysis results, the controller sends out a series of control potentials required to complete the operation in order to direct the relevant computer components to complete the operation, and at the same time, prepare for fetching the next instruction.

What does the CPU perform to complete a basic operation or judgment?

(Learning video sharing: Programming video

The above is the detailed content of What does the CPU perform to complete a basic operation or judgment?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn