Science  People  Locations  Timeline
Index: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Home > Addressing mode


 Contents
In computer programming, addressing modes are primarily of interest

to compiler writers and to those (few nowadays) who use assembly language. Some computer science students may also need to learn about addressing modes as part of their studies. Those involved with CPU design or computer architecture should already know this and a lot more.

Addressing modes form part of the instruction set architecture for some particular type of CPU. Some machine instructions will need to refer to (addresses of) operands in memory. An addressing mode specifies how to calculate the effective memory address of an operand by using information held in registers and/or constants contained within a machine instruction.


1 Caveats

Note that there is no generally accepted way of naming the various addressing modes. In particular, different authors and/or computer manufacturers may give different names to the same addressing mode, or the same names to different addressing modes, so you really need to look carefully at exactly how the effective address is determined in each particular case.

It may also be difficult to agree on how many addressing modes are available on a particular computer architecture. Some CISC computer architectures, such as

Digital Equipment Corporation (DEC) VAX,

treat registers and literal/immediate constants as just another addressing mode. Other architectures, such as IBM System/390 and most RISCThis article is about the computer architecture. For other uses see: RISC (disambiguation Reduced (or regular instruction set computer (or Computing RISC is a computer CPU design philosophy that favors a smaller and simpler set of instructions that all ta designs, encode this information within the instruction code. Thus the latter machines have three distinct instruction codes for: copying one register to another, copying a literal constant into a register, and copying the contents of a memory location into a register, while the VAX had only a single MOV instruction.

The addressing modes listed below are divided into code addressing and data addressing. Most computer architectures do maintain this distinction, but there are, or have been, some architectures which allow (almost) all addressing modes to be used in any context.

The instructions shown below are purely representative in order to illustrate the addressing modes, and do not necessarily apply to any particular computer.


2 Related topics

Some computers have a Load effective address instruction. This performs any address calculation, and then places the resulting effective address in a register. This can be useful when passing the address of an array element to a subroutine. It may also be a slightly sneaky way of doing more calculation than normal in one instruction, e.g. use with the addressing mode 'base+index+offset' allows you to add two registers and a constant together in one instruction.


3 How many address modes?

Different computer architectures vary greatly as to the number of addressing modes they provide. At the cost of a few extra instructions, and perhaps an extra register, it is normally possible to use the simpler addressing modes instead of the more complicated modes. It has proved much easier to design pipelinedAn instruction pipeline is a technology used on modern microprocessors to enhance their performance. Pipelining greatly improves throughput at a small cost in latency. Instructions consist of a number of steps. Practically every CPU ever manufactured is d CPUs if the only addressing modes available are simple ones.

Most RISC machines have only about five simple addressing modes, while CICS machines such as the DEC VAX supermini had over a dozen addressing modes, some of which were quite complicated. The IBM System/360The IBM System/360 S/360 is a computer system family announced by International Business Machines on April 7 1964. It was the first family of computers making a clear distinction between architecture and implementation. The chief architect of the S/360 wa mainframe had only three addressing modes; a few more have been added for the System/390.

When there are only a few addressing modes, the particular addressing mode required is usually encoded within the instruction code (e.g. IBM System/390, most RISC). But when there are lots of addressing modes, a specific field is often set aside in the instruction to specify the addressing mode. The DEC VAX allowed multiple memory operands for many instructions and so reserved the first few bits of each operand specifier to indicate the addressing mode for that particular operand.

Even on a computer with many addressing modes, measurements of actual programs indicate that the simple addressing modes listed below account for some 90% or more of all addressing modes used. Since most such measurements are based on code generated from high-level languages by compilers, this may reflect to some extent the limitations of the compilers being used.




Read more »

Non User