Addressing Techniques - 4.2 | 4. Addressing Techniques and Control Unit Design | Computer and Processor Architecture
K12 Students

Academics

AI-Powered learning for Grades 8–12, aligned with major Indian and international curricula.

Academics
Professionals

Professional Courses

Industry-relevant training in Business, Technology, and Design to help professionals and graduates upskill for real-world careers.

Professional Courses
Games

Interactive Games

Fun, engaging games to boost memory, math fluency, typing speed, and English skillsβ€”perfect for learners of all ages.

games

Interactive Audio Lesson

Listen to a student-teacher conversation explaining the topic in a relatable way.

Immediate Addressing

Unlock Audio Lesson

Signup and Enroll to the course for listening the Audio Lesson

0:00
Teacher
Teacher

Let's start with immediate addressing. In this mode, the operand is directly specified within the instruction. This means if you have a command like `MOV R1, #5`, the value `5` is part of the instruction itself.

Student 1
Student 1

So that makes it really fast, right? But does it have any drawbacks?

Teacher
Teacher

Exactly! It's extremely fast because there's no need to access memory at runtime. The drawback is that the size of the operand is limited by the instruction format.

Student 2
Student 2

I see, so if I need to use bigger numbers, I can't use immediate addressing?

Teacher
Teacher

Correct! Immediate values must fit into the specified operand size of the instruction format.

Register Addressing

Unlock Audio Lesson

Signup and Enroll to the course for listening the Audio Lesson

0:00
Teacher
Teacher

Moving on, register addressing is another efficient mode where data resides directly in CPU registers. This is the fastest way to access data.

Student 3
Student 3

Could you give an example of that?

Teacher
Teacher

Sure! An example is `ADD R1, R2`, where values from minor registers are manipulated quickly without accessing memory.

Student 4
Student 4

Does that mean we need to keep frequently used values in registers to make computations fast?

Teacher
Teacher

Absolutely! Efficient use of registers can significantly speed up processing.

Direct and Indirect Addressing

Unlock Audio Lesson

Signup and Enroll to the course for listening the Audio Lesson

0:00
Teacher
Teacher

Now let's compare direct and indirect addressing. In direct addressing, the instruction specifies an absolute memory address, like in `LOAD A, 2000`.

Student 1
Student 1

So it directly accesses the memory location 2000?

Teacher
Teacher

Exactly! Now, if we consider indirect addressing, such as `LOAD A, (2000)`, the instruction points to the memory address 2000, which holds the address of the operand.

Student 2
Student 2

That seems useful for dynamic data!

Teacher
Teacher

It is! This is particularly helpful in cases where the data location is not known at compile time.

Indexed and Relative Addressing

Unlock Audio Lesson

Signup and Enroll to the course for listening the Audio Lesson

0:00
Teacher
Teacher

Finally, we have indexed and relative addressing. Indexed addressing uses a base address plus an index from a register, which is often used in working with arrays, like `LOAD A, 2000(R1)`.

Student 3
Student 3

That must make it easy to traverse arrays!

Teacher
Teacher

Exactly! And then we have relative addressing, such as `JMP PC+4`, where the operand's address is calculated relative to the program counter.

Student 4
Student 4

Is relative addressing only used for branching?

Teacher
Teacher

Primarily, yes! It's essential for constructing loops and function calls in programs.

Introduction & Overview

Read a summary of the section's main ideas. Choose from Basic, Medium, or Detailed.

Quick Overview

This section covers various addressing techniques that processors use to access operands during instruction execution.

Standard

Addressing techniques are essential for CPUs to correctly access data in memory or registers while executing instructions. The section details six primary techniquesβ€”immediate, register, direct, indirect, indexed, and relative addressingβ€”each with specific use cases and examples.

Detailed

Addressing Techniques in Detail

Addressing techniques are fundamental concepts in computer architecture, essential for determining how operands of instructions are accessed during execution. This section discusses six primary addressing techniques:

  1. Immediate Addressing: The operand is directly specified within the instruction itself, offering fast access yet limited by operand size. For example, in MOV R1, #5, the value 5 is directly stated.
  2. Register Addressing: The operand is stored in a CPU register, providing the fastest access. An example is ADD R1, R2, where values in registers R1 and R2 are used directly.
  3. Direct Addressing: Here, the instruction specifies the memory address of the operand, like LOAD A, 2000, where 2000 is the specific memory location.
  4. Indirect Addressing: The instruction points to a memory address that contains the operand's address; for instance, LOAD A, (2000) accesses the operand via an address stored in the memory.
  5. Indexed Addressing: This combines a base memory address with an index from a register, used frequently in array processing (LOAD A, 2000(R1)).
  6. Relative Addressing: The address is determined relative to the current program counter (PC), common in branching operations such as JMP PC+4.

These addressing modes enhance programming efficiency, allowing support for complex data structures and reducing the number of instructions needed for operations.

Youtube Videos

L-1.13: What is Instruction Format | Understand Computer Organisation with Simple Story
L-1.13: What is Instruction Format | Understand Computer Organisation with Simple Story
L-2.1: What is Addressing Mode | Various Types of Addressing Modes | COA
L-2.1: What is Addressing Mode | Various Types of Addressing Modes | COA
RISC vs CISC | Computer Organization & Architecture
RISC vs CISC | Computer Organization & Architecture
L-4.2: Pipelining Introduction and structure | Computer Organisation
L-4.2: Pipelining Introduction and structure | Computer Organisation
I/O Interface in Computer Organization
I/O Interface in Computer Organization

Audio Book

Dive deep into the subject with an immersive audiobook experience.

Immediate Addressing

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

  1. Immediate Addressing

● Operand is directly specified in the instruction.
● Fast but limited by operand size.
Example: MOV R1, #5

Detailed Explanation

Immediate addressing is a straightforward technique where the operand (the data being used) is directly specified in the instruction itself. This means that when the processor reads the instruction, it immediately knows the value to work with. For example, in the instruction 'MOV R1, #5', the processor moves the value '5' directly into register R1. The advantage of this technique is speed, as there is no need to fetch the operand from memory; it’s already included in the instruction. However, a limitation is that the size of the operand is restricted by how much can be encoded in the instruction format.

Examples & Analogies

Imagine you have a box with a note inside it that says '5'. Whenever you open the box, you can see '5' right there, without having to look for it anywhere else. This is similar to how immediate addressing works, as the value you need is directly available within the instruction.

Register Addressing

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

  1. Register Addressing

● Operand is in a CPU register.
● Fastest access due to internal storage.
Example: ADD R1, R2

Detailed Explanation

In register addressing, the operand is stored in a CPU register, which is a small storage area inside the processor. This method is incredibly fast because accessing data from registers is much quicker than fetching it from memory. For instance, in the instruction 'ADD R1, R2', the processor adds the values stored in registers R1 and R2. Since both values are in registers, the addition operation can be performed almost immediately, leading to high execution speed.

Examples & Analogies

Think of registers like a small toolbox that you carry with you. You can quickly reach in and grab the tools you need without having to go to a storage shed (like memory) every time you need to do a task. This makes working with the tools (data) a lot faster.

Direct Addressing

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

  1. Direct Addressing

● Instruction provides memory address of operand.
● Simple but requires full memory address in instruction.
Example: LOAD A, 2000

Detailed Explanation

Direct addressing involves the instruction containing the actual memory address where the operand is located. For example, in 'LOAD A, 2000', the processor retrieves the data from memory address '2000' and loads it into variable A. This addressing mode is straightforward and easy to understand, but it requires that the instruction itself be able to provide the full address, which can be a limitation in systems with large memory spaces.

Examples & Analogies

Picture sending someone to a specific street address to deliver a package. You provide them with the exact address (like the memory address in direct addressing) so they know exactly where to go to retrieve or drop off the package (data). While clear, if the address is long, it can be cumbersome to communicate.

Indirect Addressing

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

  1. Indirect Addressing

● Instruction points to a memory location that holds the address of the operand.
● Useful for dynamic memory operations.
Example: LOAD A, (2000)

Detailed Explanation

Indirect addressing utilizes a level of indirection, where the instruction points to a memory location that contains the address of the actual operand. For example, 'LOAD A, (2000)' means that the processor fetches the address from memory location '2000' and then retrieves the operand from that address. This technique is particularly useful for working with data structures whose memory locations can change at runtime, allowing for more flexibility.

Examples & Analogies

Imagine you have a locker (memory location 2000) that holds the key to another locker (the actual operand). You first go to the first locker to get the key (address) and then use that key to open the second locker to get your items (data). It’s a two-step process that allows you to dynamically find the contents without knowing their exact location upfront.

Indexed Addressing

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

  1. Indexed Addressing

● Combines a base address with an index register.
● Common in array processing.
Example: LOAD A, 2000(R1)

Detailed Explanation

Indexed addressing combines a base address and an offset stored in an index register. This is particularly useful in scenarios such as array processing, where you need to access elements at regular intervals. For example, in 'LOAD A, 2000(R1)', the processor takes the base address of '2000' and adds the value from the index register R1 to find the actual address to load into A. This allows for easy access to elements in data structures, especially arrays.

Examples & Analogies

Think of a library where books are organized on shelves (base address). Each shelf might have an index card (index register) that tells you how far to go to find a specific book (data). By combining both, you can quickly locate any book you want without searching through every shelf.

Relative Addressing

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

  1. Relative Addressing

● Operand address is determined relative to the current program counter (PC).
● Common in branching instructions.
Example: JMP PC+4

Detailed Explanation

Relative addressing determines the address of the operand by referencing the current position of the program counter (PC), which points to the next instruction to be executed. For instance, in 'JMP PC+4', the next instruction to execute is four positions ahead of the current instruction. This addressing mode is often used in branching operations, allowing programs to jump forward or backward in the code easily.

Examples & Analogies

Imagine you're reading a book, and you decide to flip forward four pages instead of going to a specific page number. The current page acts as your reference point, and from there, you make a relative jump to where you want to go. This way, you can easily navigate through different parts without needing to know the exact page numbers.

Definitions & Key Concepts

Learn essential terms and foundational ideas that form the basis of the topic.

Key Concepts

  • Immediate Addressing: Fast access to operands directly specified in instructions.

  • Register Addressing: Operands stored in CPU registers for the quickest access.

  • Direct Addressing: Uses an explicit memory address for data access.

  • Indirect Addressing: Accesses data address stored in memory.

  • Indexed Addressing: Combines base address with an index for data structures.

  • Relative Addressing: Uses program counter as a reference for branching.

Examples & Real-Life Applications

See how the concepts apply in real-world scenarios to understand their practical implications.

Examples

  • Immediate Addressing: MOV R1, #5 allows the value 5 to be directly loaded into R1.

  • Register Addressing: ADD R1, R2 directly accesses the values in R1 and R2 for addition.

  • Direct Addressing: LOAD A, 2000 retrieves data from memory address 2000.

  • Indirect Addressing: LOAD A, (2000) fetches the address stored in memory address 2000 first.

  • Indexed Addressing: LOAD A, 2000(R1) accesses data from a definitive base and an index from R1.

  • Relative Addressing: JMP PC+4 moves the program counter 4 addresses forward.

Memory Aids

Use mnemonics, acronyms, or visual cues to help remember key information more easily.

🎡 Rhymes Time

  • Immediate value in sight, fast as the speed of light. Registers are key, for speed they agree.

πŸ“– Fascinating Stories

  • Imagine a CPU trying to find a treasure in memory: Immediate addressing gives it the treasure map right away, while indirect addressing has to check a clue to know where to dig. Indexed addressing helps to search through rows and columns of treasures easily.

🧠 Other Memory Gems

  • I-R-D-I-I-R - Imagine Really Delicious Ice-cream In Rows: Immediate, Register, Direct, Indirect, Indexed, Relative.

🎯 Super Acronyms

ADDRESS - Accessing Data Requires Effective Simple Structures

  • Immediate
  • Register
  • Direct
  • Indirect
  • Indexed
  • Relative.

Flash Cards

Review key concepts with flashcards.

Glossary of Terms

Review the Definitions for terms.

  • Term: Immediate Addressing

    Definition:

    A method of addressing in which the operand is specified directly within the instruction.

  • Term: Register Addressing

    Definition:

    An addressing mode where the operand is stored in a CPU register.

  • Term: Direct Addressing

    Definition:

    A method where the instruction includes the direct memory address of the operand.

  • Term: Indirect Addressing

    Definition:

    An addressing mode that points to a memory location containing the address of the operand.

  • Term: Indexed Addressing

    Definition:

    A method that combines a base address with an offset from an index register.

  • Term: Relative Addressing

    Definition:

    An addressing mode where the location of the operand is determined relative to the program counter.