Amity School of Engineering & Technology
Amity School of Engineering
& Technology
B. Tech. (CSE), V Semester
Computer Architecture
Jitendra Rajpurohit
Amity School of Engineering & Technology
Addressing Modes
Amity School of Engineering & Technology
Addressing Modes
1. Immediate
2. Direct
3. Indirect
4. Register
5. Register Indirect
6. Displacement (Indexed)
7. Relative Addressing
8. Base Register Addressing
9. Stack
Amity School of Engineering & Technology
Immediate Addressing
Operand is part of instruction
Operand = address field
e.g. ADD 5
Add 5 to contents of accumulator
5 is operand
No memory reference to fetch data
Fast
Limited range
Opcode Operand
Instruction
Amity School of Engineering & Technology
Direct Addressing
Address field contains address of operand
Effective address (EA) = address field (A)
e.g. ADD A
Add contents of cell A to accumulator
Look in memory at address A for operand
Single memory reference to access data
No additional calculations to work out
effective address
Limited address space
Amity School of Engineering & Technology
Direct Addressing
Instruction
Memory
Amity School of Engineering & Technology
Indirect Addressing
Memory cell pointed to by address field contains the address of
(pointer to) the operand
EA
Look in A, find address (A) and look there for operand
e.g. ADD (A)
Add contents of cell pointed to by contents of A to
accumulator
Large address space
Multiple memory accesses to find operand
Hence slower
Amity School of Engineering & Technology
Indirect Addressing
Instruction
Memory
Amity School of Engineering & Technology
Register Addressing
Operand is held in register named in address filed
EA = R
Limited number of registers
Very small address field needed
Shorter instructions
Faster instruction fetch
No memory access
Very fast execution
Very limited address space
Multiple registers helps performance
Amity School of Engineering & Technology
Register Addressing
Instruction
Registers
Amity School of Engineering & Technology
Register Indirect Addressing
EA = (R)
Operand is in memory cell pointed to by contents of register
R
Large address space (2n)
One fewer memory access than indirect addressing
Amity School of Engineering & Technology
Register Indirect Addressing
Instruction
Memory
Registers
Pointer to Operand Operand
Amity School of Engineering & Technology
Displacement Addressing
EA = A + (R)
Address field hold two values
A = base value
R = register that holds displacement
or vice versa
Amity School of Engineering & Technology
DisplacementAddressing
Instruction
Address R
Memory
Registers
Pointer to Operand + Operand
Amity School of Engineering & Technology
Relative Addressing
A version of displacement addressing
R = Program counter, PC
EA = A + (PC)
i.e. get operand from A cells from current location pointed to by
PC
Amity School of Engineering & Technology
Base-Register Addressing
A holds displacement
R holds pointer to base address
R may be explicit or implicit
Amity School of Engineering & Technology
Stack Addressing
Operand is (implicitly) on top of stack
e.g.
ADD
Pop top two items from stack and add