ArticleslgStudy

computer science

Addressing mode

Addressing mode is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Addressing mode rather than just read about it. In short: Addressing modes are an aspect of the instruction set architecture in most central processing unit (CPU) designs. Addressing modes define how the machine language instructions in that architecture identify the operand(s) of each instruction.

Key takeaways

  • Addressing mode belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Addressing mode to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Addressing mode from memory before moving on to harder problems.

Reference excerpt

Addressing modes are an aspect of the instruction set architecture in most central processing unit (CPU) designs. Addressing modes define how the machine language instructions in that architecture identify the operand(s) of each instruction. 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 or elsewhere. In computer programming, addressing modes are primarily of interest to those who write in assembly languages and to compiler writers. For a related concept see orthogonal instruction set which deals with the ability of any instruction to use any addressing mode.

Caveats

There are no generally accepted names for addressing modes: different authors and computer manufacturers may give different names to the same addressing mode, or the same names to different addressing modes. Furthermore, an addressing mode which, in one given architecture, is treated as a single addressing mode may represent functionality that, in another architecture, is covered by two or more addressing modes. For example, some complex instruction set computer (CISC) architectures, such as the Digital Equipment Corporation (DEC) VAX, treat registers and literal or immediate constants as just another addressing mode. Others, such as the IBM System/360 and its successors, and most reduced instruction set computer (RISC) designs, encode this information within the instruction. 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 has only a single "MOV" instruction. To confuse matters further: some processors such as the Microchip Technology PIC microcontrollers make no distinction between registers and memory. The term "addressing mode" is itself subject to different interpretations: either "memory address calculation mode" or "operand accessing mode". Under the first interpretation, instructions that do not read from memory or write to memory (such as "add literal to register") are considered not to have an "addressing mode". The second interpretation allows for machines such as VAX which use operand mode bits to allow for a register or for a literal operand. Only the first interpretation applies to instructions such as "load effective address," which loads the address of the operand, not the operand itself. The addressing modes listed below are divided into code addressing and data addressing. Most computer architectures 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 reflect the mnemonics used by any particular computer. Some computers, e.g., IBM 709, RCA 3301, do not have a single address mode field but rather have separate fields for indirect addressing and indexing.

Number of addressing modes Computer architectures vary greatly as to the number of addressing modes they provide in hardware. There are some benefits to eliminating complex addressing modes and using only one or a few simpler addressing modes, even though it requires a few extra instructions, and perhaps an extra register. It has proven much easier to design pipelined CPUs if the only addressing modes available are simple ones. Most RISC architectures have only about five simple addressing modes, while CISC architectures such as the DEC VAX have over a dozen addressing modes, some of which are quite complicated. The IBM System/360 architecture has only four addressing modes; a few more have been added for the ESA/390 architecture. When there are only a few addressing modes, the particular addressing mode required is usually encoded within the instruction code (e.g. IBM System/360 and successors, most RISC). But when there are many 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 almost all instructions, and so reserved the first few bits of each operand specifier to indicate the addressing mode for that particular operand. Keeping the addressing mode specifier bits separate from the opcode operation bits produces an orthogonal instruction set. 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 reflects to some extent the limitations of the compilers being used.

Load effective address Some instruction set architectures, such as IBM System/360 and its successors, Intel x86, and the Motorola 68000 series, have a load effective address instruction. This calculates the effective operand address and loads it into a register, without accessing the memory it refers to. This can be useful when passing the address of an array element to a subroutine. It may also be a clever way of doing more calculations than normal in one instruction; for example, using such an instruction with the addressing mode "base+index+offset" (detailed below) allows one instruction to add two registers and a constant together and store the result in a third register. A few instruction set architectures, such as the Motorola 68000 series, also have a push effective address instruction. This calculates the effective operand address and pushes it on the stack rather than storing it in a register. This can be used to pass pointers as arguments to a function.

Simple addressing modes for code Some simple addressing modes for code are shown below. The nomenclature may vary depending on platform.

Absolute or direct +----+------------------------------+ |jump| address | +----+------------------------------+

(Effective PC address = address)

The effective address for an absolute instruction address is the address parameter itself with no modifications.

PC-relative +----+------------------------------+ |jump| offset | jump relative +----+------------------------------+

(Effective PC address = next instruction address + offset, offset may be negative)

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Addressing mode

Start with the simplest possible case. Write down what Addressing mode claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Addressing mode before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Addressing mode ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Addressing mode

In research
Addressing mode appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Addressing mode in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Addressing mode is common in secondary-school and first-year university syllabi. It links to neighbouring topics Assembly languages, Computer architecture, Machine code, so understanding it makes those chapters shorter.
In everyday life
Look for Addressing mode outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Addressing mode” →

How to study Addressing mode in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Addressing mode means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Addressing mode out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Addressing mode in simple terms?

Addressing modes are an aspect of the instruction set architecture in most central processing unit (CPU) designs. Addressing modes define how the machine language instructions in that architecture identify the operand(s) of each instruction.

Why does Addressing mode matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Addressing mode?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Addressing mode.

Tags

  • Assembly languages
  • Computer architecture
  • Machine code

Keep exploring