L-2.1: What is Addressing Mode | Various Types of Addressing Modes | COA
Summary
TLDRIn this educational video, the concept of addressing modes in computer architecture is explored, emphasizing its significance in programming and exams. Addressing modes dictate how operand bits in instructions are interpreted, whether as direct data, memory addresses, or register numbers. The video outlines the benefits of addressing modes, such as reducing instruction size by using registers instead of memory addresses, and facilitating features like pointers, looping, and indexing. It introduces various addressing modes including immediate, direct, and indirect, and sets the stage for a detailed discussion in the next video.
Takeaways
- 💡 Addressing mode is a crucial concept in computer organization and architecture, frequently appearing in competitive exams and academic curricula.
- 📝 The script explains that an instruction typically contains an opcode and an operand, where the operand refers to the data on which operations are performed.
- 🔍 Addressing mode clarifies how operand bits in an instruction should be interpreted, whether as direct data, memory addresses, or register numbers.
- 👨💻 The video highlights the practical application of addressing modes in programming, especially when dealing with variables and constants.
- 📉 Addressing modes can reduce the number of bits required in an instruction by utilizing registers instead of direct memory addresses, thus compacting instruction size.
- 🔄 The script introduces various types of addressing modes including implied, immediate, register, indirect, direct, auto-increment, decrement, and others, which are essential for different programming scenarios.
- 🏢 RISC systems typically have 4 to 6 addressing modes, while CISC systems may have more, reflecting the complexity and flexibility in handling data.
- 🔑 Addressing modes facilitate advanced programming concepts like pointers, where the address of a variable is used in place of the data itself.
- ➕ They also support looping constructs and counters through auto-increment and decrement modes, streamlining repetitive operations.
- 🔄 The concept of relocation is discussed, explaining how addressing modes help in adjusting memory addresses when a program is moved to a different location in memory.
Q & A
What is an addressing mode in computer architecture?
-An addressing mode is a way to determine how the operand of an instruction is used. It tells the CPU how to interpret the bits in the operand to access the data it needs to perform an operation.
Why are addressing modes important in computer organization?
-Addressing modes are important because they allow for efficient use of memory and registers, reduce the size of instructions, and provide flexibility in how data is accessed and manipulated during program execution.
What are the benefits of using addressing modes?
-Using addressing modes can reduce the number of bits required in an instruction, facilitate the use of pointers and looping constructs, and support features like indexed addressing and relocation.
What is the difference between an operand and an opcode in an instruction?
-An operand is the data or address that an instruction operates on, while an opcode is the part of the instruction that specifies the operation to be performed, such as addition or subtraction.
How does an addressing mode help in the case of variables in programming?
-Addressing modes help with variables by allowing the instruction to refer to the data indirectly through a register or memory address, rather than embedding the actual data value directly in the instruction.
Can you give an example of how addressing modes are used with constants in programming?
-When a constant value like Pi is used in a program, the addressing mode might allow the instruction to directly embed the constant value in the operand, simplifying the instruction and potentially reducing its size.
What is the purpose of the indirect addressing mode?
-The indirect addressing mode is used when the operand contains an address that points to the actual data location. This allows for multi-level indirection where the address in the operand leads to another address that contains the data.
How do auto-increment and auto-decrement addressing modes work?
-Auto-increment and auto-decrement addressing modes automatically adjust the address in the operand by a specified amount after each access. This is useful for iterating through data structures like arrays or for implementing loops.
What is the role of addressing modes in supporting indexed data access?
-Indexed addressing modes allow the CPU to access data based on a base address and an offset. This is useful for accessing elements in arrays or for implementing algorithms that require data access based on a variable index.
Why is addressing mode crucial for relocation in computer systems?
-Addressing modes are crucial for relocation because they help in adjusting the addresses of instructions and data when a program is moved from one memory location to another, ensuring that the program can execute correctly regardless of its location in memory.
Outlines
💡 Introduction to Addressing Modes
The speaker introduces the concept of addressing modes in computer architecture, emphasizing its importance in competitive exams and academic studies. Addressing modes are crucial for understanding how instructions in a computer program interact with data. The speaker explains that instructions typically consist of an opcode (operation code) and an operand (data). The operand can be data itself, or it can be an address where the data is stored, such as in memory or registers. Addressing modes dictate how these operands are treated within an instruction, whether as direct data, memory addresses, or register numbers. The paragraph sets the stage for a deeper exploration of addressing modes and their significance in various programming scenarios.
🔑 Benefits and Types of Addressing Modes
This paragraph delves into the benefits of addressing modes, such as reducing the number of bits required in an instruction by using register numbers instead of memory addresses. The speaker illustrates this with an example of a 1M memory size requiring 20 bits for addressing, but only 4 bits if using register numbers. Addressing modes also facilitate the use of pointers, looping with automatic increment and decrement, and indexing. The paragraph lists various types of addressing modes, including implied, immediate, register, indirect, direct, auto-increment, decrement, relative address mode, indexed addressing mode, and base register. The speaker notes that RISC systems typically have fewer addressing modes compared to CISC systems, which can have more complex and varied addressing modes.
🔄 Addressing Modes in Practical Computing
The final paragraph discusses the practical applications of addressing modes in computing. It explains how addressing modes help in executing instructions that involve variables, pointers, and looping. The speaker mentions that the value of variables is determined at runtime, and addressing modes are essential for accessing this data during instruction execution. The paragraph also touches on the concept of relocation, where the execution of a process may occur at different memory locations over time, and addressing modes help in adjusting the memory addresses accordingly. The speaker concludes by stating that the next video will explore each addressing mode in detail, promising a deeper understanding of how these modes facilitate various programming tasks.
Mindmap
Keywords
💡Addressing Mode
💡Operand
💡Opcode
💡Memory
💡Registers
💡Direct Addressing Mode
💡Indirect Addressing Mode
💡Indexed Addressing Mode
💡Relocation
💡Instruction Size
Highlights
Addressing mode is a crucial topic in computer organization and architecture.
Addressing modes are important for competitive exams and college/university level exams.
An instruction typically contains an opcode and an operand, where the operand refers to data.
Opcode represents the operation such as addition, subtraction, or multiplication.
In micro-instructions, data is not directly included but rather the address of the data.
Addressing mode determines how to treat operand bits in an instruction.
There are various types of addressing modes, including implied, immediate, register, indirect, direct, and more.
Addressing modes can reduce the number of bits needed in an instruction by using registers instead of direct memory addresses.
Addressing modes facilitate the use of pointers in programming by interpreting operand bits as memory addresses.
Auto-increment and auto-decrement addressing modes are used for looping and counters in programs.
Indexed addressing mode allows for data indexing, which is useful in arrays and similar data structures.
Relocation is made possible by addressing modes, which is essential when a program's memory location changes.
Addressing modes help in executing instructions that involve variables, whose values are determined at runtime.
Immediate mode allows for passing direct values in instructions, which is different from using variable values.
The video will cover each addressing mode in detail in the next part.
Transcripts
Hello friends, welcome to Gate Smashers
In today's video, we are going to discuss what is an addressing mode
and what are the types of addressing mode
If we talk about computer organization and architecture
then addressing mode is one of the most important topic
because if you talk about any competitive exam
or if you talk about college or university level exam
then there also you will definitely get the question of addressing mode
and it is a very simple topic
First in this video I am going to tell you what is addressing mode
What are the benefits of addressing mode and what it is providing us
and then what are the types of addressing mode
which we will explain one by one
So here if we talk about what is an addressing mode
So if we talk about instruction
which we are discussing about in the previous videos
So generally in instruction what we have in instruction
Opcode and operand
What is operand generally?
Operand means data
Means which data you have to work on
and what is opcode? Operation
Means plus, minus, multiplication
Now on what you will do plus minus multiplication?
Will do on data only
Like we write programs in simple C
A is equal to 10, int B is equal to 20
C is equal to A plus B
Means we are doing addition or subtraction
So the data which we pass
This data
What we are saying about operand is actually
We are talking about data
But if we talk about an instruction
If we talk about any micro-instruction
Then in instruction we don't have data directly
What can we have?
The address of that data can be
Means the data which we are bringing in the computer
Whatever data is coming, which we are passing in the programs
That data is either saved in our memory
Or that data is saved in our registers
So what we are writing operand here
Whatever data we are writing here
Whatever bits we are writing here
What are those bits actually representing?
Are they directly representing data?
Or are they representing some address of memory?
Or are they representing some number of register?
What is that actually?
We get to know from addressing mode
So addressing mode basically tells us
That how to treat these operand bits
Means how to consider them
This actually tells us addressing mode
So here if we talk
We can give direct data here
Or we give the address that we generally give here
Why? Because if we talk about programming
Then in programming we work on variables
We work on constant
If we are giving directly constant
In any C program we are giving direct constant value
Let's say we are giving the value of constant Pi
Now what is the value of Pi? It is constant
Now if you are giving this constant value
Then you can give that data directly in the instruction
But generally we work on variables
We can also work like this in variables
Like if I have data
A is equal to B * C
Now here when will A come
A value will come when we execute B * C
Means when this instruction will be executed
After that I will get to know the A value
Now this A value
How can I give it in the instruction?
When I will get to know after the execution of the instruction
That what is the value of A
Then we can never give the value of data
Directly in the instruction
Means you can't write directly
Subtraction 2
Or subtraction 3
Or multiplication 4
What do we actually give?
We work on variables
So whenever we talk about variables in programs
Or we ask the user for data many times
We write scanf
So scanf is when we ask the user for data
At run time
When the program runs and is executed
At that time we take data from the user
So for these type of instructions
We can't give the data directly in the instruction
So here I have these bits
How we have to treat them
How to consider them
That actually tells us
Addressing mode
So generally the variables we have
They are generally saved in our memory
Whatever data they have
Or where they are saved
They are saved in the registers
So there we have the data given in operand
Is it address?
Is it the number of the register?
These bits how to consider
This tells us addressing modes
So addressing modes are different types of addressing modes
Which I have written here
Implied, immediate, register, indirect, direct
Auto increment, decrement, direct addressing mode
Relative address mode
Indexed addressing mode, base register
So if we talk about the risk environment
If we talk about the risk systems
Reduced instructions
So there we have
Near about 4 to 5 or 5 to 6 addressing modes
But the CISC computers
Means the complex instruction computers
There we have many times
Many addressing modes
It depends
In different computers
Different computer organizations
Different addressing modes can be
But generally
In the risk system
There are 5 to 6 addressing modes
Which tell us that these bits
Whatever value is written in operand
Whatever address is written
How to treat it
Now if we talk here
What is the benefit of addressing mode
The first benefit of addressing mode
That number of bits
We can reduce in the instruction
How?
Let's say
If we have a memory
And the size of the memory
Let's say 1M
Means 1 million words
There are 1M words in this whole memory
Now in these 1M words
Your instruction can be anywhere
Your data can be anywhere
Now if you give in the instruction
Address
Where is your data
So obviously the size of your address
Will be 20 bits
Because 1M is the location here
So to represent 1M locations
How many bits do we use?
20 bits
So the space of your address in the instruction
Which is the space of operand
How many bits will it be?
It will be 20 bits
And we also have opcode bits
So the size of your instruction
Will increase
So we can keep data in the register
If we talk
Let's say we have 16 registers
Number of registers is 16
So obviously in 16 registers
Where can the data be read
Any register can have data read
So if I want to represent 16 registers in bits
How many bits will I use?
4 bits
How?
From 0 to 15 number of registers
Total registers will be 16
And if we want to represent 16 from 0 to 15
How many bits do we use?
4 bits
So if we want to reduce the size of the instruction
Then we can keep the data in the register
And we can pass the register number in operand
So how many will be here?
How many bits will be here instead of 20 bits?
4 bits
So the size of this will be reduced
So this basically provides the facility to the programmer
That you can reduce the instruction size
You can reduce the bits
Apart from this
If we talk about
Let's say we use pointers in our program
What is a pointer?
Let's say if I say int a is equal to 10
Now what will happen?
A variable will be saved in memory
And the value in it will be 10
Now this location
Let's say the location is 100
Now if I pass the pointer
Let's say there is a pointer ptr
And what will we do in ptr?
We will pass address of a
So address of a is 100
So what value will come in ptr?
100
So here we are using the pointer
We will go to a location
Let's say this is my memory
We checked operand
The value in operand was 100
We went to 100 location
The data in 100 location
Is it our direct data?
Or is it also an address?
We also know this through
Addressing mode
It may be that the value is 200
Now what to consider 200?
Is it an address?
Or is it data?
If we talk about indirect mode
So what does indirect mode say?
That yes, this is also a location ahead
Means you will have to go to 200 location from here
Whatever data is there in 200 location
10, 20
Pick it up and use it
So if we want to facilitate pointers here
Then we can use the addressing mode here
Or if we talk about counters
Let's say if we talk about looping
There is a for loop, for i is equal to 1 to 10
Now here we want that if
For i is equal to 1 to 10 is written
And we printf it
So what does it mean?
Here 1 to 10 automatically increments
So automatically for increment and decrement
We have a facility in addressing mode
Apart from this, indexing
If we want to put indexing in the data
Then we also have the facility of indexing
Indexed addressing mode
And apart from this we have relocation
Relocation means
Let's say I have a data
Means the data is in the memory
The data is in 100 to 200
Any process is there in 100 to 200
Now in that process
Or in those instructions we have written
Whatever instruction is written on 100
Let's say go to
170 location
Means jump to 170
Now here you will go to 170
Whatever instruction is written
You will pick up that instruction
But what happens is
We use the funda of relocation
Means when this process is executed by CPU
Or will use it
In future if this process comes again
Then it is not necessary that it gets the same location
It may get a different location
Means now it may be between 500 to 600
This process is now fit between 500 and 600
Now here if I write go to 170
Then what will happen?
It will go to such an address
Which is actually invalid
Means go to 170 means
According to this question
It should have been go to 570
It should have been at 70
But who changes the addresses?
To relocate these addresses
We also use the concept of addressing mode
So addressing mode provides many facilities and benefits
That is what
Basically if we are using looping
Or if we are using pointers
Or if we are using variables here
All the variables we use
The value of the variables is calculated at run time
At execution time
So if we want to bring the data at that time
Then addressing mode only helps there
We do not pass data directly in the instruction
There are some modes
Like there is an immediate mode
I will bring them in detail one by one
But here I am giving a simple example
There are many instructions
In which we can also pass direct value
But what we write in most of the code
We use variables
So when the data of variables comes
When we run the instruction
When one instruction is run
After that we get to know the other data
So at that time we
Can't pass the data inside the instruction
So these are different benefits of addressing modes
Which help us to execute all these points
So now we will see all these modes in detail one by one in the next video
Thank you.
関連動画をさらに表示
Lec-10: Unconditional Branching in 8085 | Microprocessor
Addressing Modes of 8051 Microcontroller | Immediate | Register | Direct | Indirect | Indexed
L-2.3: Immediate Addressing Mode | Computer Organisation and Architecture
L-1.3:Various General Purpose Registers in Computer Organization and Architecture
L-1.8: Data Transfer Instructions in Computer Organisation and Architecture
SFRs of 8051 Microcontroller | Features of SFR in 8051 | PSW | DPTR | TMOD | TCON | SCON | PMOD
5.0 / 5 (0 votes)