L-2.9: Relative Addressing Mode || Computer Organisation and Architecture
Summary
TLDRIn this video, the concept of relative addressing mode in computer architecture is explored, particularly in the context of program control instructions like branching and jumping. The video explains how relative addressing reduces instruction size by using an offset or displacement instead of specifying a full memory address. This method improves efficiency and minimizes instruction size, especially for large memory systems. The role of the program counter is highlighted, showing how it tracks the next instruction and interacts with the offset to correctly calculate the jump address. Overall, relative addressing enhances program control and reduces memory overhead.
Takeaways
- 😀 **Relative addressing mode** is used for program control instructions like branching and jumping.
- 😀 In relative addressing, instead of providing the full address, an **offset** or **displacement** is used to specify the jump location.
- 😀 The **Program Counter (PC)** holds the address of the next instruction to be executed.
- 😀 With relative addressing, the instruction size is smaller since we only store the offset, not the full memory address.
- 😀 In direct addressing, if we write 'branch 550', we specify the full address, which can make the instruction size large.
- 😀 For example, in a memory of 1024 words, a 10-bit address is required for direct addressing.
- 😀 **Offset calculation**: Instead of writing the full address, we specify an offset, which is added to the PC to get the effective address.
- 😀 **Displacement issue**: When using relative addressing, the PC already increments after fetching the instruction, so we must adjust the offset by subtracting 1.
- 😀 For instance, to jump from address 500 to 550, the correct offset should be 49 (not 50), accounting for the PC's incremented value.
- 😀 The benefits of relative addressing include reduced instruction size and the ability to handle program relocation effectively.
Q & A
What is relative addressing mode?
-Relative addressing mode is a way to specify memory addresses using an offset or displacement value, rather than providing the full address directly. This is commonly used in program control instructions like branch or jump.
Why do we use relative addressing mode in program control instructions?
-We use relative addressing mode to control the flow of execution, allowing the program to jump to a specific location, such as during a branch or jump instruction, without sequentially fetching instructions.
How is memory divided when a program is loaded into memory?
-When a program is loaded into memory, the memory is divided into 'words,' where each word holds a single instruction. Instructions are then fetched from memory and executed one by one unless a control instruction like a branch is used.
What happens when we use a branch instruction with a direct address like branch 550?
-Using a direct address like branch 550 would require the instruction to include the full address, making the instruction larger. This is inefficient when the number of memory words is large.
What is the problem with using direct addressing for branch instructions?
-The problem is that the instruction size becomes large because the full address (e.g., 550) needs to be stored in the instruction, which requires more bits, especially if there are many memory words.
How does using an offset or displacement in relative addressing help reduce instruction size?
-By using an offset, you only store the displacement value (e.g., 50) instead of the full address, which requires fewer bits, making the instruction size smaller compared to direct addressing.
How is the effective address calculated in relative addressing mode?
-In relative addressing mode, the effective address is calculated by adding the offset value to the value stored in the program counter (PC). For example, if the PC is at address 500 and the offset is 50, the effective address will be 550.
What is the role of the program counter (PC) in relative addressing?
-The program counter (PC) always holds the address of the next instruction to be fetched. In relative addressing, the PC value is used to calculate the effective address by adding the offset value.
Why must the displacement value be adjusted when using relative addressing with the program counter?
-The displacement value must be reduced by one because the program counter is always incremented by 1 after fetching an instruction. Therefore, to reach the correct target address, you need to adjust the displacement to account for this increment.
What are the main benefits of using relative addressing mode?
-The benefits of relative addressing include smaller instruction sizes due to the use of offsets instead of full addresses, and the ability to efficiently control program flow through jumps or branches without sequential execution.
Outlines
This section is available to paid users only. Please upgrade to access this part.
Upgrade NowMindmap
This section is available to paid users only. Please upgrade to access this part.
Upgrade NowKeywords
This section is available to paid users only. Please upgrade to access this part.
Upgrade NowHighlights
This section is available to paid users only. Please upgrade to access this part.
Upgrade NowTranscripts
This section is available to paid users only. Please upgrade to access this part.
Upgrade NowBrowse More Related Video
Index Addressing Mode
L-2.3: Immediate Addressing Mode | Computer Organisation and Architecture
L-1.3:Various General Purpose Registers in Computer Organization and Architecture
L-2.1: What is Addressing Mode | Various Types of Addressing Modes | COA
Lec-10: Unconditional Branching in 8085 | Microprocessor
cisc architecture | COA
5.0 / 5 (0 votes)