Home>Article> The instructions in the application can be divided into requesting specific services from the operating system and what?

The instructions in the application can be divided into requesting specific services from the operating system and what?

青灯夜游
青灯夜游 Original
2020-10-27 11:48:00 45748browse

Theoretically, the instructions in an application can be divided into instruction sets that are used to request specific services from the operating system and the central processing unit (CPU). The processing flow of CPU operation instructions is roughly divided into several steps: instruction fetch, decoding, execution, memory access, write back, etc.; each instruction requires 1 to 6 bytes, depending on which fields are required.

The instructions in the application can be divided into requesting specific services from the operating system and what?

#The operating environment of this article: windows10 system, thinkpad t480 computer.

Theoretically, the instructions in the application can be divided into two categories: the instruction set of the central processing unit (CPU) and the one used to request specific services from the operating system.

Central Processing Unit (CPU, Central Processing Unit) is a very large-scale integrated circuit and is the computing core (Core) and control core (Control Unit) of a computer. Its function is mainly to interpret computer instructions and process data in computer software.

The central processing unit mainly includes the arithmetic unit (arithmetic logic unit, ALU, Arithmetic Logic Unit) and the cache memory (Cache) and the bus (Data), control and status that realizes the connection between them. Bus). It, together with internal memory (Memory) and input/output (I/O) devices, are collectively known as the three core components of electronic computers.

The processing flow of CPU operation instructions is roughly divided into several steps: instruction fetch, decoding, execution, memory access, write back, etc. Each instruction requires anywhere from 1 to 6 bytes, depending on which fields are required. The first byte of each instruction indicates the type of instruction: the high 4 bits are the code part (for example: 6 is an integer operation instruction), and the low 4 bits are the function part (for example: 1 is a subtraction instruction in the integer class) 61 Together they are the sub command.

Processing instruction flow

An important property of the instruction set is that the byte encoding must have a unique interpretation. Any sequence of bytes either encodes a unique instruction sequence or is not a valid sequence of bytes. Because the first byte of each instruction has a unique combination of code and function, given this byte, we can determine the length and meaning of all other additional bytes.

Each instruction requires 1 to 6 bytes, depending on which fields are required. The first byte of each instruction indicates the type of instruction: the high 4 bits are the code part (for example: 6 is an integer operation instruction), and the low 4 bits are the function part (for example: 1 is a subtraction instruction in the integer class) 61 Together they are the sub command.

The following is the flow chart for processing each instruction:

The instructions in the application can be divided into requesting specific services from the operating system and what?

fetch

get value The stage reads the instruction byte from the memory and places it in the instruction memory (in the CPU), and the address is the value of the program counter (PC). It calculates the address of the next instruction following the current instruction in a sequential manner (that is, the value of the PC plus the length of the fetched instruction).

Decoding (decode)

The ALU reads up to two operands from the register file (a collection of general-purpose registers). (That is, the contents of two registers can be read at most at one time)

Execution(execute)

In the execution phase, the arithmetic/logical unit ( ALU) are used for different purposes. For other instructions, it will act as an adder to calculate increment or decrement the stack pointer, or calculate the effective address, or simply add 0, passing an input to the output.

The condition code register (CC) has three condition bits. The ALU is responsible for calculating the new value of the condition code. When a jump instruction is executed, the branch signal cnd is calculated based on the condition code and jump type.

Memory access (memory)

In the memory access phase, the data memory (in the CPU) reads or writes a memory word. Instruction and data memory access the same memory locations, but for different purposes.

Write back(write back)

The write back phase can write up to two results to the register file. The register file has two write ports. Port E is used to write the value calculated by the ALU, while port M is used to write the value read from the data memory.

Update PC(PC update)

According to the instruction code and branch flag, select the next PC value from the signal values obtained in the previous steps.

The above is the detailed content of The instructions in the application can be divided into requesting specific services from the operating system and what?. 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