14.5 - Examples of Addressing Modes
Enroll to start learning
You’ve not yet enrolled in this course. Please enroll for free to listen to audio lessons, classroom podcasts and take practice test.
Interactive Audio Lesson
Listen to a student-teacher conversation explaining the topic in a relatable way.
Immediate Addressing Mode
🔒 Unlock Audio Lesson
Sign up and enroll to listen to this audio lesson
Today, we're going to explore addressing modes, starting with immediate addressing. In this mode, the operand is included directly in the instruction. Can anyone give me an example of an instruction that uses this mode?
How about `LOAD R1, 32`? Here, `32` is used directly as the value.
So, it means we just load that value into `R1`, right?
Exactly! This instruction involves fewer steps since the operand is directly accessible. We only need to fetch the instruction and load the immediate value into the register. Can anyone recall how many steps this typically takes?
I think it takes four steps.
That's right! Four micro instructions for immediate addressing. Great job! Remember - MI for 'Immediate = 4 Instructions.' Let's move on to direct addressing.
Direct Addressing Mode
🔒 Unlock Audio Lesson
Sign up and enroll to listen to this audio lesson
Now, let’s talk about direct addressing mode. Here, the operand’s address is given directly in the instruction. For example, `LOAD R1, M` where `M` is a memory location.
So, we fetch the instruction and then access the memory location to get the operand?
Exactly! And how many steps do you think are required for this process?
I remember it's six steps for direct addressing.
Correct! Direct addressing requires six micro instructions. To help you remember this, think: 'D6 for Direct = 6 Steps.'
Indirect Addressing Mode
🔒 Unlock Audio Lesson
Sign up and enroll to listen to this audio lesson
Lastly, let’s delve into indirect addressing. In this mode, the operand's address is not specified directly; instead, it is found by first accessing another memory location.
So, if the instruction is like `LOAD R1, (M)`, it means we first read from memory location `M`, and then that gives us the actual memory address of the operand?
Correct! This requires two memory accesses. Can anyone tell me how many steps this mode typically requires?
I think it requires seven steps.
Exactly! So, to remember, think: 'Seven Steps for Indirect: I7!' Let's summarize what we've learned today.
Comparing Addressing Modes
🔒 Unlock Audio Lesson
Sign up and enroll to listen to this audio lesson
Let's recap what we've discussed regarding the different addressing modes. Immediate addressing is the simplest, followed by direct and then indirect. Who can tell me the order from least to most complex?
Immediate, Direct, and then Indirect.
Great! And the number of steps required are 4, 6, and 7 respectively. Any questions about how these modes work together?
So, why are more steps needed for indirect addressing?
Good question! It’s due to the need for extra memory accesses, which reflect the complexity in finding the operand's address.
Introduction & Overview
Read summaries of the section's main ideas at different levels of detail.
Quick Overview
Standard
The section elaborates on different addressing modes, notably immediate, direct, and indirect. It describes how each mode affects the sequence of control instructions required for instruction execution in a computer’s architecture, highlighting the variations in steps taken for each mode.
Detailed
Detailed Summary
In the context of computer organization and architecture, understanding different addressing modes is vital for grasping how instructions are executed. This section provides a comprehensive exploration of several addressing modes, including immediate, direct, and indirect addressing.
Key Addressing Modes
-
Immediate Mode: In immediate addressing mode, the operand is part of the instruction itself. This means that a single word instruction could look like
LOAD R1, 32, where32is directly utilized in the operation. The steps of execution consist of fetching the instruction and transferring the immediate value to the specified register, which is straightforward with fewer steps — typically 4 micro instructions. -
Direct Mode: In direct addressing, the operand's memory address is specified directly in the instruction. For instance, the instruction might read
LOAD R1, M, whereMindicates the specific memory address. This mode involves more steps (6 micro instructions), as the program counter must load the address into the memory address register, read the operand from the memory data register, and then ultimately load it into the register specified. - Indirect Mode: Indirect addressing means that the operand's address is indirectly specified via a pointer included in the instruction. This involves two memory accesses: first to retrieve the address pointing to the actual operand and secondly to load the operand itself. This mode usually requires the most steps (7 micro instructions), reflecting its complexity.
Significance
Understanding these addressing modes is crucial for comprehending how control signals are generated and utilized within computer architecture. Each mode influences the sequence and number of micro instructions needed for executing an instruction, thus playing a foundational role in processor design and performance.
Youtube Videos
Audio Book
Dive deep into the subject with an immersive audiobook experience.
Understanding Instruction Fetch Steps
Chapter 1 of 4
🔒 Unlock Audio Chapter
Sign up and enroll to access the full audio experience
Chapter Content
As we have already discussed in the last unit that basically the first 3 steps that is step 1, step 2 and step 3, basically consist of instruction fetch. So, what happens in step 1? The program counter value is loaded into the bus. That bus basically or the program counter is read into memory address register. Memory is given in read mode and then actually in these 3 steps, ALU actually adds program counter value which is now in the bus with a constant value, which is the next memory location and then it is again waited to be loaded into the program counter in the next iteration.
Detailed Explanation
In the first three steps of instruction execution, we focus on fetching the instruction. Step 1 involves loading the value of the program counter (PC) onto a bus which carries data. This value is then read into the memory address register (MAR), indicating which memory location is to be accessed. The memory is set to 'read' mode to allow fetching of instructions. During these steps, the Arithmetic Logic Unit (ALU) adds the PC value to a constant that indicates the next memory address to access. After the instruction is fetched, the PC is updated for the next instruction. Essentially, these steps ensure that the processor retrieves the correct instruction to execute next.
Examples & Analogies
Imagine you're cooking a recipe. First, you check your recipe book (the program counter) to see what dish you must prepare next. You open the book to the right page (loading into the memory address register), and then you look for the next ingredient you need (the instruction), ensuring everything is ready for your next step in cooking.
Direct Addressing Mode
Chapter 2 of 4
🔒 Unlock Audio Chapter
Sign up and enroll to access the full audio experience
Chapter Content
For example, if the instruction is a direct instruction that is you have to read something from or write something from the memory location. Then in the fourth stage, what is going to happen basically, you are going to take from the instruction register the value of M which corresponds to the memory location for an instruction because it’s a direct instruction. So, the value of the operand will be present in memory location M which will be specified in the instruction itself.
Detailed Explanation
In direct addressing mode, the instruction specifies the exact memory location (M) where the relevant operand is stored. In the fourth step of instruction execution, the processor retrieves this memory location value from the instruction register (IR) and loads it into the memory address register (MAR). The next step is to set the memory to read mode, which allows for retrieval of the operand stored at this specified memory address. After the reading process is completed, the operand is transferred to the appropriate registers for execution.
Examples & Analogies
Consider having a written shopping list (the instruction) where it specifically states to get apples from aisle 5 in the supermarket (the memory location). You head directly to aisle 5 (the processor fetching the value from memory) to collect your apples (the operand) without having to search elsewhere.
Indirect Addressing Mode
Chapter 3 of 4
🔒 Unlock Audio Chapter
Sign up and enroll to access the full audio experience
Chapter Content
But in case say for example, if it is an indirect instruction where the memory location M actually points to another memory location which has the operand. So, basically it’s an address to another location maybe say for example.
Detailed Explanation
In indirect addressing mode, the instruction does not directly specify the operand; instead, it provides a memory location (M) that contains the address of the actual operand. This means that the first operation involves reading the address from M into the MAR, and then retrieving the operand stored at that secondary address. This process adds an extra step compared to direct addressing, where the operand is immediately accessible at the address specified in the instruction.
Examples & Analogies
Think of it like getting directions to a friend's house (the memory location) via your navigation app. The directions may lead you to a meeting point (the first address) that gives you additional directions to your friend's actual house (the operand) - therefore, you need to take an extra step to reach your destination.
Immediate Addressing Mode
Chapter 4 of 4
🔒 Unlock Audio Chapter
Sign up and enroll to access the full audio experience
Chapter Content
So, first instruction mode the simplest one is the immediate mode. So, we are just saying LOAD R, 32; that means, the value of 32 constant will be loaded to R.
Detailed Explanation
In immediate addressing mode, the operand is directly specified in the instruction itself, making it the simplest addressing mode. For example, an instruction like 'LOAD R, 32' indicates that the constant value of 32 should be loaded into register R directly. There are fewer steps involved as there is no need to access memory to get the operand, just a straightforward transfer from the instruction register to the targeted register.
Examples & Analogies
Imagine you are buying a ready-made meal (the instruction) that is specified on the packaging to heat for a few minutes (the operand itself). There’s no need to measure or cook anything; you simply place it in the microwave as stated – just like directly loading the value into the register.
Key Concepts
-
Immediate Addressing: Operand is directly within the instruction.
-
Direct Addressing: Operand’s address appears directly in the instruction.
-
Indirect Addressing: Operand’s address is specified indirectly via another memory location.
-
Control Signals: Directives in a CPU that dictate instruction execution.
-
Micro Instructions: Fundamental actions constituting the complete instruction.
Examples & Applications
Immediate Addressing Example: LOAD R1, 32 loads the immediate value 32 into register R1 with 4 micro instructions.
Direct Addressing Example: LOAD R1, M retrieves the operand from memory location M, requiring 6 micro instructions.
Indirect Addressing Example: LOAD R1, (M) first accesses M to find the actual operand's address, needing 7 micro instructions.
Memory Aids
Interactive tools to help you remember key concepts
Rhymes
Immediate is neat, with values that meet, Put them in the instruction seat.
Stories
Imagine a librarian where you go directly to the books (direct addressing) or you ask a friend to fetch a book (indirect addressing), finding knowledge through the shortest path possible (immediate).
Memory Tools
Remember: 'I - 4 for Immediate, D - 6 for Direct, I - 7 for Indirect'.
Acronyms
D7I
Direct takes six
Indirect takes seven
Immediate takes four.
Flash Cards
Glossary
- Immediate Addressing
A mode in which the operand is part of the instruction itself.
- Direct Addressing
A mode where the operand’s address is specified directly in the instruction.
- Indirect Addressing
A mode where the address of the operand is held in a memory location specified by the instruction.
- Control Signals
Signals used in a computer system to control the sequences of actions.
- Micro Instructions
The low-level operations that define the steps to execute an instruction.
Reference links
Supplementary resources to enhance your learning experience.