Addressing Modes - Coddicted

Addressing Modes 1

Various Addressing modes as used in Computer Architecture:

Register
ADD R1,R2 ,R3
means : R1 comments : used when a value is in register

Immediate
ADD R1, R2 , 1
means : R1 comment : used when a constant is needed

Direct
ADD R1 , R2 , (100)
means : R1 comment :
used to access static data
The adress space of the operand is used in the instruction
space must be provided to accomodate the whole address

Register Indirect ( or register deferred)
ADD R1, R2 ,(R3)
means : R1 comment :
the register (R3) contains the address of a memory location.

Displacement(Base)
ADD R1, R2, 100(R3)
means : R1 comment :
the address is the sum of the content of the register (the base) and a constant from the instruction ( the displacement)
used to access local variables on a stack or data structure
if the displacement is zero, then it is the same as register indirect

Memory Indirect
ADD R1, R2, @R3
means : R1 comment :
used in pointer addressing, if R3 contains the address of a pointer p, then M[M[R3]] yields *pointer

Indexed
ADD R1, R2 (R3)[R4]
means : R1 comment :
Two registers are added to get a memory address
Used in array addressing with one register the base address of the array and other one the offset from the base to desired element in the array

Autoincrement
ADD R1, R2, (R3)+
means : R1 R3 Comment:
used to step through array, the first time it is used, R3 points to the beginning of the array each access increments the R2 with the size of an array’s element

Autodecrement
ADD R1, R2 , -(R3)
means : R3 R1 comment:
can be used like autoincrement, but step through arrays in reverse order. Together with the autoincrement it can be used to implement a stack.


Questions
How many memory accesses are required in the following instructions?

a. ADD R1, R2 , R3
b. ADD R1, R2 , (R3)
c. ADD R1, R2 , @R3

Solution:
a. ADD R1, R2 , R3 : require only 1 memory access for reading the instruction

b. ADD R1, R2 , (R3)
means : R1 requires two memory accesses
1. the first to read the instruction
2. the other one to read the value from the memory locations, whose address is in R3

c. ADD R1, R2 , @R3
means : R1 requires three memory instruction
1. first to read the instruction itself
2. second to get value stored in memory address pointed by R3 ( M[R3])
3. third to get the values stored in memory address resulted from the step second.


Back To Top
Rate this post

One comment on “Addressing Modes

  1. Pingback: louis vuitton handbags outlet store

Leave a Reply