Home > Common Problem > What does machine language that computers can directly recognize consist of?

What does machine language that computers can directly recognize consist of?

coldplay.xixi
Release: 2020-08-29 11:55:07
Original
7376 people have browsed it

The machine language that the computer can directly recognize is composed of operation code and operand. The operation code specifies the operation of the instruction and is the keyword in the instruction and cannot be defaulted; the operand represents the operation of the instruction. The operation object and the computer's instruction format have a great relationship with the machine's word length, memory capacity and instruction function.

What does machine language that computers can directly recognize consist of?

Machine language is the program language or instruction code that the machine can directly recognize. It does not need to be translated. Each An operation code has a corresponding circuit inside the computer to complete it, or refers to a programming language or instruction code that can be directly understood and accepted by the machine without translation. Machine language uses absolute addresses and absolute opcodes. Different computers have their own machine languages, that is, instruction systems. From a usage perspective, machine language is the lowest level language.

Machine language instruction is a binary code consisting of two parts: opcode and operand. The opcode specifies the operation of the instruction. It is a keyword in the instruction and cannot be defaulted. The operand represents the operand of the instruction. The computer's instruction format has a great relationship with the machine's word length, memory capacity and instruction function.

From the perspective of facilitating program design, increasing parallelism of basic operations, and improving instruction functionality, instructions should contain a variety of information. However, in some instructions, because part of the information may be useless, this will waste the storage space occupied by the instruction and increase the number of memory accesses, which may actually affect the speed.

Therefore, how to design the instruction format reasonably and scientifically, so that the instruction can not only give enough information, but also make its length match the word length of the machine as much as possible, so as to save storage space and shorten the value acquisition time. , improve the performance of the machine, which is an important issue in the design of instruction format.

Computers process various data by executing instructions. In order to indicate the source of data, the destination of operation results and the operations performed, an instruction must contain the following information:

(1) Operation code. It specifies the nature and function of the operation. A computer may have dozens to hundreds of instructions, each instruction has a corresponding operation code, and the computer completes different operations by recognizing the operation code.

(2) The address of the operand. The CPU can obtain the required operands through this address.

(3) Storage address of the operation result. The result of processing the operand is saved at this address for reuse.

(4) The address of the next instruction. When executing a program, most instructions are fetched from the main memory in order and executed. Only when a transfer instruction is encountered, the execution order of the program will change. In order to compress the length of the instruction, a program counter (ProgramCounter, PC) can be used to store the instruction address. Every time an instruction is executed, the instruction address of the PC is automatically set to 1 (assuming that the instruction only occupies one main memory unit), indicating the address of the next instruction to be executed. When a transfer instruction is encountered, the transfer address is used to modify the contents of the PC. Due to the use of PC, the address of the next instruction to be executed does not need to be explicitly given in the instruction.

An instruction actually includes two kinds of information, namely Operation code and Address code. The operation code (OperationCode, OP) is used to represent the operation to be completed by the instruction (such as addition, subtraction, multiplication, division, data transfer, etc.). Its length depends on the number of instructions in the instruction system. The address code is used to describe the operand of the instruction. It either directly gives the operand, or indicates the memory address or register address of the operand (that is, the register name).

If you want to know more about programming learning, please pay attention to the php training column!

The above is the detailed content of What does machine language that computers can directly recognize consist of?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template