Addressing Mode and Command System

Source: Internet
Author: User

The following command formats are available:
OPC d
Opc r, D
Opc r, R, D
Opc m, d
In the preceding command, OPC is the control code, r is the register, M is the primary storage unit, and D is the immediate number. The above are several typical immediate number commands:
The first address (also the destination address) is an implicit accumulators, and the second address is an immediate number.
The first address (also the destination address) is the register, and the second address is the immediate number.
The first and second addresses are the registers, and the third addresses are the immediate numbers. Of course, the second address can also be the immediate number.
4th commands are memory-type two-address commands. The first address (also the destination address) points to the primary memory, and the second address is the number of immediate messages.
The advantages of the instant data addressing method are:
1. InstructionsFast execution speedBecause the data required to execute commands can be directly obtained from the instructions without accessing the registers or primary memory;
2.Saves data storage unitsBecause the real-time addressing method does not need to store data registers or primary memory units.
The disadvantage of the immediate number addressing method is:
1. It can only be used for addressing source operands;
2. Data LengthCannot be too longBecause an instruction is usually divided into multiple fields, only one of them can be used to represent the number of immediate actions.
3. A large amount of immediate data addressing will makeProgramOfReduced versatility.

The instruction formats of register addressing are as follows:
OPC R
Opc r, R
Opc r, R, R
Opc r, m
The first three commands are addressing one address, two addresses, and three address registers, The three-address commands are mainly used in vector processor and VLIW (ultra-long script) processor. The fourth type of commands can only be used by the load and store commands In CISC (complex command system computer), general operation commands can also be used in this form.
For the input and output commands and some special processor control commands, the registers provided in the instructions may be the control registers of the device, status registers or program counters of the processor, stack pointers, status word registers, and so on.
The register addressing method has the following advantages:
1. Script Length . Since the number of general-purpose registers is generally dozens, the address of an operand can be expressed with only a few digits in the instruction. For example, in ibm370 series computers, there are 16 general-purpose registers that use four binary digits to represent the address of an operand. Even the Three-address instruction only needs 12-bit address codes.
2. Fast command execution speed . Because the access speed of registers is very fast, the access time is almost negligible compared with the primary memory. Therefore, most register-type commands can be completed within one cycle.
Storing the data that needs to be used multiple times in general-purpose registers can greatly improve the program execution speed. Generally, data is stored in General registers or in memory and allocated by the compiler.
In addition, General registers must be supported for the most common binary address commands. Otherwise, the program execution speed will be significantly reduced.
3. Supports vector and matrix operations. When the number of General registers is large, you can put a vector or a part of the vector in the General Register to improve the operation speed.
The register addressing method also has obvious disadvantages, mainly including:
1. Not conducive to optimizing Compilation . Since the general-purpose registers are much faster than the primary memory, whether the general-purpose registers are allocated properly directly affects the program execution speed. Variables that are continuously used or frequently used are usually allocated to general registers, which makes it very difficult to optimize the design of the compiler. . This indicates that, General-purpose register-type machines do not adapt to data models in advanced languages.
In addition, the asymmetry of General registers also brings a lot of trouble to optimize compilation.
In the ibm370 series, it is stipulated that R0 registers cannot be used as address change registers and base address registers. for dual-character long instructions, only general registers with an even number can be used.
In a small computer PDP-11, limit more: R0 is used for macro calls, implicitly stores the return value of macro calls, R5 is used when the high-level language is connected to the assembly language, R6 is used as the stack pointer, r7 serves as the program counter. R0 to R5 can be used as the address change register. for dual-character long instructions, only registers with an even number can be used.
2. On-site switching is difficult. When the program is running, when the call, interrupt, and time-sharing switch occur, you need to save the content in the general-purpose registers to the main memory. When the program returns, recover all the contents in these general registers. . The more general-purpose registers, the longer it takes to save and recover.
To solve this problem, Currently, most processors have two or more general registers. programmers can only see one set of General registers. When field switching occurs, the hardware automatically switches to another set of General registers. For example, sun's iSCSI processor has eight General registers and uses the overlapping register window technology. The 32 General registers that programmers can see are divided into three parts: local registers, registers connected to upper-layer calls, and registers connected to lower-layer calls store the variables brought to this layer by upper-layer calls in registers connected to upper-layer calls, in the registers connected to the lower layer, store the variables transferred by this layer of call to the next layer. the last layer completely overlaps with the lower layer of the connection register and the first layer of the upper layer of the connection register.
3. Hardware complexity

memory addresses can also be stored in registers, which are called indirect register addressing.
the General Register can be long (such as 32-bit or 64-bit, in general-purpose registers, you can store a long primary address.
for a 64-bit computer system, a general-purpose register can not only store a long primary address, you can also store many other information such as the address offset and various logos.
In addition, in some computer systems, registers are also configured with automatic address changes. Assume that the valid address is ea and the increment of the address is D. in the 32-bit computer system with the byte address, D = 4. The calculation process of the valid address automatically changed by the register is as follows:
Register indirect addressing: Ea = (r) or Ea = @ r
Register auto increment addressing: Ea = (r) + d, R (r) + D
Register automatic reduction addressing: Ea = (R)-D, R (R)-D
for register automatic address change, add (subtract) first) after the address, use it first and then add (subtract) the address. For example, for the Register auto increment addressing method used after adding an address first, the calculation process of the valid address is: R (r) + d first, and then obtain the valid address Ea = (R ); the register that uses the Add address first automatically adds the addressing mode. The calculation process of the valid address is: Obtain the valid address Ea = (r) first, and then do R (r) + d.

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.