Home  >  Article  >  What are the characteristics of machine language

What are the characteristics of machine language

青灯夜游
青灯夜游Original
2020-12-24 14:26:0418489browse

Characteristics of machine language: 1. Machine language programs are composed of a series of instruction codes. These instruction codes are composed of hexadecimal numbers. There is no connection between them and the functions to be realized, so it is difficult to Learn, difficult to understand, difficult to understand. 2. No universality. 3. Need to allocate memory. 4. Machine language is the only language that computers can recognize and directly produce effects. It does not need to go through the compilation process, and its execution speed is very fast, hundreds of times that of high-level languages. 5. Save memory space. 6. The functions are more complete. 7. Can be used to design extended functions.

What are the characteristics of machine language

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

Machine language is a programming language or instruction code that the machine can directly recognize without translation. Each operation code has a corresponding circuit inside the computer to complete it, or it can be directly translated to the machine without translation. Understand and accept programming language or instruction code. 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.

What are the characteristics of machine language

Characteristics of machine language

1. Difficult to learn, difficult to understand, difficult to understand .

Machine language programs are composed of a series of instruction codes, which are composed of hexadecimal numbers. There is no connection between them and the functions to be realized.

2. No universality.

Machine language is the most direct and primitive language. It completely depends on a specific computer system.

3. It is necessary to allocate memory

The machine language program and all the parameters it needs to use during operation, like high-level languages, need to be stored in in the host's memory. However, where exactly they are stored in the memory and how to arrange them reasonably needs to be manually determined by the programmer based on the specific conditions of the system and program under the computer.

4. The fastest running speed

Machine language is the only language that the computer can recognize and directly produce effects. It does not need to go through the compilation process and the execution speed is very fast. Fast, hundreds of times faster than high-level languages.

5. Save memory space

6. More complete functions

Functions that machine language can complete, High-level languages ​​may not necessarily be able to achieve it; the functions that high-level languages ​​can achieve can also be achieved by machine language.

7. Can be used to design extended functions

Format of machine language instructions

Machine A language instruction is a binary code consisting of an operation code and an 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. [2] The instruction format of a computer 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, shorten the value time, and improve the performance of the machine. This is an important issue in instruction format design.

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).

The instruction includes two parts: the opcode field and the address field. According to the number of addresses involved in the address field, the common instruction formats are as follows.

① Three-address instruction: A1 and A2 in the general address field determine the first and second operand addresses respectively, and A3 determines the result address. The address of the next instruction is usually given sequentially by the program counter.

②Two address instructions: A1 in the address field determines the first operand address, and A2 determines the second operand address and result address at the same time.

③Single address instruction: A in the address field determines the address of the first operand. Fixed use of a certain register to store the second operand and operation result. Their addresses are therefore implicit in the instructions.

④Zero address instruction: In a stack computer, the operands are generally stored in the two units on the top of the push-down stack, and the results are placed on the top of the stack. The addresses are implicit, so most instructions only have operations code but no address field.

⑤Variable address number instruction: The number of addresses involved in the address field changes with the operation definition. For example, the number of addresses in the instructions of some computers can be as few as 0 and as many as 6.

Related recommendations: "Programming Video"

The above is the detailed content of What are the characteristics of machine language. 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