The instructions of the application can be divided into two categories: the instruction set of the central processor, that is, the CPU, and the instruction set used to request specific services from the operating system; the processing flow of the central processor operation instructions is roughly divided into instruction fetching and translation. code, execute, fetch, write back and update the PC.
The operating environment of this article: Windows 7 system, DELL G3 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:
Fetch(fetch)
The value phase reads the instruction bytes from the memory, Put it into 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)
ALU reads up to two operands from the register file (a collection of general-purpose registers). (That is, reading the contents of up to two registers at a time)
Execution(execute)
During the execution phase, the arithmetic/logic unit (ALU) will be used for different functions according to the type of instruction. Purpose. 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.
For more related knowledge, please visit PHP Chinese website!
The above is the detailed content of Application instructions can be divided into what. For more information, please follow other related articles on the PHP Chinese website!