Computer command system (I just learned this and searched it online)

Source: Internet
Author: User
1. Basic concepts of the Command System

CommandA command that requires a computer to execute a certain operation.

Computer Commands include micro commands, machine commands, and macro commands.

  Micro commands: Microprogram-level command, which belongs to hardware;

  Macro commands: Software commands composed of several machine commands, which are software;

  Machine commands(Command): between micro-commands and macro commands, each command can complete an independent arithmetic operation or logical operation.

Command System: A set of commands for all machines in a computer.

Including: A complex command system computer (CISC) and a simplified Command System Computer (RISC ).

 

[Command system performance requirements]

A complete command system should meet the following four requirements:

CompletenessWhen writing various programs in an assembly language, the command system provides sufficient instructions instead of software. Completeness: The instruction system is required to be rich, fully functional, and easy to use.

ValidityThe program compiled by the command system can run efficiently. High efficiency is mainly manifested in the small storage space occupied by programs and fast execution speed. Generally, a more powerful and complete command system must be more effective.

RegularityNormalization includes the symmetry, uniformity, and consistency of command formats and data formats of the command system.

Symmetry means that all registers and memory units in the instruction system can be treated in the same way, and all commands can use various addressing methods;

Uniformity refers to the fact that an operational instruction can support various data types;

The consistency between the instruction format and the data format refers to the relationship between the instruction length and the Data Length for convenient processing and access.

CompatibilityThe same basic structure and common basic instruction sets are available between different types of series machines. Therefore, the command system is compatible, that is, the basic software of each type can be used universally. However, due to the release time of different models and the differences in structure and performance, it is impossible to achieve full compatibility of all software, and only to achieve "upward compatibility ", that is, software running on a low-end machine can run on a high-end machine.

[Relationship between low-level languages and hardware structures]

Computer languages are classified into high-level and low-level languages.

Advanced Language: its statements and usage are irrelevant to the command system of a specific machine.

Low-level languages: including machine language (Binary) and Assembly Language (symbolic language ). Machine language is a machine-oriented language that is closely related to the command system of a specific machine. The machine language uses the command code to write programs, while the symbolic language uses the command mnemonic to write programs.

Advanced languages have nothing to do with computer hardware structures and command systems, and are superior to assembly languages in programming. However, the hardware structure of an "invisible" machine is not used to compile system software or device control software that directly accesses the hardware resources of the machine. Therefore, some advanced Languages provide calling interfaces with assembly languages. A program written in an assembly language can be used as an external process or function of a high-level language to transmit the address of a parameter or parameter using a stack.

2 Command Format

Including the operation code, address code, script length, and command mnemonic.

[Operation code]

A directive is a machine word that represents an instruction.

The command format is the structure of the command word represented by binary code, which consists of the operation code field and address code field.

The operation code field represents the operation features and functions of the command. The address code field usually specifies the address of the operand or operand involved in the operation.

Operation Code Field

Address Code Field

[Address Code]

An address code field is also called an operand field. Generally, an operand contains three types of numbers: the operand, the operand, and the operation result. Therefore, the three-address Instruction format is formed. On this basis, it was later developed into two address formats, one address format and zero address format.

Operation Code

A1

A2

A3

Three-address instruction

Operation Code

A1

A2

2-address instruction

Operation Code

A1

1. Address instruction

Operation Code

 

Zero-address instruction

 

Note:(1) The zero-address command only contains the operation code, but not the address code.

(2) An address command is often called a single-operand command. Generally, this type of instruction uses the data in the accumulate register AC as the operand, And the number indicated by the address code field of the instruction word is the operand, and the operation result is put back into the accumulate register AC.

      (AC) OP (A)-> AC   

OP indicates the operation nature; (AC) indicates the number in the accumulated register AC; () indicates the number of storage units with the address A in the memory or the number of General registers with the address A in the memory; → indicates that the Operation (operation) results are transmitted to the specified place.

(3) A two-address instruction is often called a dual-operand instruction. Its Two address code fields indicate the two numbers involved in the operation in the memory or the register address in the memory, a1 is the address used to store the operation result.

        (A1) OP (A2)-> A1

(4) There are three operands in the Three-address directive.

        (A1) OP (A2)-> A3    

A1 is the address of the operand, also known as the source operand address, A2 is the address of the operand, also known as the end operand address, and A3 is the address that stores the result. Similarly, A1, A2, and A3 are the Unit addresses in the memory, or the general register addresses in the memory.

In the binary address Instruction format, the physical locations of the operands can be classified into three types: SS, RR, and RS.

[Script length]

  Script Length: The number of digits that a directive contains binary code.

  Machine font: The number of digits of binary data that can be directly processed by a computer. It determines the computing precision of the computer.

[Command mnemonic]

Since the hardware can only recognize 1 and 0, it is necessary to use a binary operation code, but it is very troublesome to use a binary program to write. To facilitate the writing and reading of programs, each instruction is usually represented by 3 or 4 abbreviations. The abbreviated code is a command enable.

3. Addressing of commands and Data

Including:Instruction addressing and operand addressing

[Addressing method of commands]

  The address of the operand or instruction in the memory:Number of a storage unit when an operand or command is stored in a storage unit. In memory, operations or script writing or reading methods include address-specific methods, associated storage methods, and stack access methods.

When the address is specified, the method that forms the operand or instruction address is calledAddressing Mode.

There are two types of addressing methods: Command addressing and data addressing. The former is relatively simple and the latter is more complex.

[Addressing method of commands]There are two types: sequential addressing and jumping addressing.

[Operand addressing mode]: A method that forms the valid address of an operand. It is called the addressing mode of an operand. It mainly includes:

1) Implicit addressing features that the address of the operand is hidden rather than explicitly given in the instruction.

2) The immediate addressing feature is that the address field of the command points out the address of the operand rather than the address of the operand itself. 3) direct addressing: The address field in the Instruction format directly specifies the address D of the operand in the memory. 4) Indirect addressing features: the form address D in the instruction address field is not the real address of the operand, but the indicator of the operand address. The content of Unit D is the valid address of the operand. 5) Register addressing and register indirect addressing

When the operands are not stored in the memory, but in the General registers of the CPU, you can use the register addressing method. The operand address in the instruction is not the address unit number of the memory, but the number of the General Register.

The difference between the indirect addressing method of registers and the addressing method of registers is that the content of registers in the Instruction format is not the operand, but the address of the operand. The operands specified by this address are in the memory.

6) Relative addressing

Relative addressing is to add the content of the program counter PC to the form address D in the Instruction format to form the valid address of the operand. The content of the program counter is the address of the current command.

7) base address addressing is characterized by adding the content of base address registers in the CPU to the formal address in the Instruction format to form the valid address of the operand. It can expand addressing capabilities. 8. Address Change Addressing

The address change addressing method is similar to the base addressing Method for Calculating valid addresses. It adds the content of an address change register in the CPU to the offset D to form the valid address of the operand. But the address change addressing method is usedThe purpose is not to expand the addressing space,It is to implement regular changes to the program block.

9. Block Addressing

Block Addressing is often used in Input and Output commands to transmit data blocks between external memory or the memory of peripheral devices.

10. segment addressing: the essence of this addressing method is base addressing. In this method, the segment register data is automatically shifted to several places and then added to the offset to form the memory address. Master the effective address E formation methods in various addressing modes.

4 stack addressing

Including:Concatenate stacks and storage stacks

[Concatenate stacks]

Some computer CPUs have a set of specialized registers with 16 or more, which are calledConcatenate stacksEach register can store one word of data. The inbound or outbound data stack follows the "post-in-first-out" principle.

[Storage Stack]

A programmer points out a part of the primary memory as a stack, which is called a memory stack.

This stack has three advantages:

   (1)The stack can have any length required by programmers;

   (2)The number of stacks that can be created as long as the programmer prefers to build;

   (3)You can use any instruction to address the memory to address the data in the stack.

Notes: In the memory stack, data is first stored in the stack, and then the stack indicator is modified. When the stack is output, the stack indicator is modified and then the data is taken out.

5 typical commands

Including:Command classification, basic command system, and simplified Command System (RISC)

[Command classification] mainly includes: Data transmission commands, arithmetic operation commands, logical operation commands, program control commands, input and output commands, string processing commands, privileged commands, and other commands.[Basic command system]

The functions of these commands are universal and can be found in almost all computer instruction sets.

[Streamline the command system, and use the money-to-money command system.]

The biggest feature of the Proteus command system is:

   (1)Some simple commands with the highest usage frequency in the constituency, with fewer command lines;

   (2)Fixed instruction length and fewer instruction formats;

   (3)Only the read/write commands access the memory, and the operations of other commands are performed between registers.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.