1.4 introduction to the command system-3

Source: Internet
Author: User

1.4 introduction to the Command System

The operations that the CPU can perform are determined by the commands it executes. These commands are called machine commands. Command System

Interface between hardware and software in a computer

1. Instruction format

A command is a command that directs a computer to complete various operations. Generally, a command consists of two basic components:

; Operation code and address. The basic format is as follows:

The operation code indicates the function and operation nature of the command. The address code is used to indicate the operation object of the command. It indicates that

The address of the operand or operand and the address of the instruction execution result.

The operation code is represented by binary encoding. The longer the field, the more commands can be expressed. If the operation code length is N, it can represent the N power of the command 2, the command format is divided into the following types based on the number of address codes in the command:

(1 ). The format of the Three-address instruction. The three-address Instruction format is:

OP is the operation code A1, A2, and A3, which are source operand 1, source operand 2, and destination operand 3.

(A1) OP (A2)-> (A3)

(2) The format of the second address command.

(A1) OP (A2) à (A1)

 

(3) One-address Instruction format

In an address command, only the address of one operand is given. If the operation is an instruction for one operand,

The operation is OP (A) à (A). If the operation is an address instruction for two operands, the other operand is usually implicit (the other operand is in the accumulators ), the operation is: (AC) OP (A) à (AC)

 

(4 ). Zero-address Instruction format, only the operation code, excluding the operand address

Zero-address commands are divided into two types of operations: one is non-operand control operations, such as null operation commands NOP; the other is implicit operation operations, which are not reflected in the commands.

2. Addressing Mode

It is how to explain the address field in the instruction to obtain the operand method or to obtain the transfer address of the program.

(1). Addressing immediately. The operand is included in the instruction. When the machine code form of the instruction is formed, the immediate number is followed by the instruction operation. When the instruction is pointed out, the operand can be obtained.

(2) direct addressing. The operands are stored in the inner unit, and the address of the storage unit where the operands are stored is directly given in the instruction.

(3 ). Registers are indirectly addressable. The operands are stored in the inner memory unit. The address of the storage unit where the operands are stored is in a register,

(4 ). Registers are indirectly addressable. The operands are stored in the inner unit, and the address of the storage unit where the operands are stored is in a register.

(5 ). Indirect addressing. In this addressing mode, the address of the operand address is given in the instruction.

(6 ). Relative addressing: The instruction Address Code provides an offset, and the operand address is equal to the instruction address.

.

(7 ). Address Change Addressing. The operand address is equal to the offset added to the content of the address change register.

1. Types of commands

1) Data Transmission commands

This type of command transfers data from one place to another. The commands are as follows:

(1) Data Transmission commands generally have two operands. Source and target

Transfer Method:

Send the data to the Register immediately

Send the data to the storage unit immediately

Transfer the content of one register to another

Transfer the register content to the storage unit

Transmit data from storage units to registers

(2) Data Exchange commands. It mainly includes

Data exchange between registers

Data exchange between memory units and registers

Data exchange between memory units and memory units

(3) stack operation commands, including the stack pushing command and the stack pop-up command

2) Input and Output I/O commands

These commands are used to transmit information between the host and peripherals, including data input, output, and

There are usually three methods for peripherals to send control commands and input the status of peripherals.

3 ). Arithmetic Operation commands

This type of commands supports CPU addition, subtraction, multiplication, division, and other commands

4) logic operation commands

5) shift operation commands

...

6 ). Program Control commands

Program Control commands are used to change the direction of each control flow in the order of command execution.

(1 ). Jump command

(2 ). Subroutine call and return command

(3) trap command: the trap is an interruption caused by an unexpected event. Generally, the trap command is implicit.

It is not provided for use by users. When an unexpected event is interrupted, it is automatically executed by the CPU.

7) string operation commands

8) processor control commands

9) Data Conversion commands

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.