Download Computer Achitecture and org- Addressing Modes and more Study notes Computer Architecture and Organization in PDF only on Docsity!
Addressing Modes
Introduction
The way the operands are chosen during
the program execution is dependent on
the addressing mode of the instruction.
Implied Addressing Mode
- (^) No address field is required
- (^) Operand is implied / implicit
- (^) Ex:
- (^) Complementing Accumulator
- (^) Set or Clearing the flag bits (CLC, STC etc.)
- (^) 0 โ address instructions in a stack organized computer are implied mode instructions.
- (^) Effective Address (EA) = AC or Stack[SP]
- (^) Ex: Tomorrow, I am on leave (implies that there is no CAO class)
- (^) Come to my cabin (implies to come to 316B- SJT)
Immediate Addressing Mode
- (^) Operand is specified in the instruction itself
- (^) Useful for initializing the registers with constant value
- (^) Operand = address field
- (^) Ex: Mov Dx, #0034H
- (^) Advantage: No memory Reference, fast
- (^) Disadvantage: Limited operand magnitude
- (^) Ex: Come to my cabin: 316B-02 SJT Opcode Operand Instruction
Indirect Addressing Mode
- (^) The address field of the instruction gives the
address of the effective address of the
operand stored in the memory.
- (^) EA = (A)
- (^) Ex: Mov CX, [4200H]
- (^) Advantage: Large address space, may be
nested, multilevel or cascaded
- (^) Disadvantage: Multiple memory accesses to
find the operand, hence slower
- (^) Ex: Anil, please bring my laptop from my
cabin (cabin is not known to Anil)
Indirect Addressing Mode Diagram
Register Addressing Diagram
Register Indirect Addressing Mode
- (^) Address part of the instruction specifies
the register which gives the address of the
operand in memory
- (^) Special case of indirect addressing
- (^) EA = (R)
- (^) Ex: Mov BX, [DX]
- (^) Advantage: Large address space
- (^) Disadvantage: Extra memory reference
Displacement Addressing Mode
- (^) EA = A + (R)
- (^) Address field holds two values
- (^) A = Base value
- (^) R = register that holds displacement
- (^) Or vice-versa
Relative Addressing Mode
- (^) Version of the displacement addressing
- (^) R = program counter, PC
- (^) Content of PC is added to address part of the instruction to obtain the effective address of the operand
- (^) EA = A + (PC)
- (^) Ex: JC next
- (^) It is often used in branch (conditional and unconditional) instructions, locality of reference and cache usage
- (^) Advantage: Flexibility
- (^) Disadvantage: Complexity
Base Register Addressing Mode
- (^) The content of the base register is added
to the address part of the instruction to
obtain the effective address of the operand.
- (^) Used to facilitate the relocation of
programs in memory.
- (^) EA = A + (BX)
- (^) Ex: Mov 2345H [BX], 0AC24H
- (^) Advantage: Flexibility
- (^) Disadvantage: Complexity
Auto Increment and Auto Decrement Addressing Modes
- (^) This addressing mode is used when the
address stored in the register refers to a
table of data in memory, it is necessary to
increment or decrement the register after
every access to the table.
- (^) Ex: Mov AX, (BX)+, Mov AX, -(BX)
- (^) Used mostly in Motorola 680X0 series of
computers
Problems
- (^) Find the effective address and the content of AC for the given data.
Addressing Mode Effective Address Content of AC Direct Address Immediate operand Indirect address Relative address Indexed address Register Register Indirect Autoincrement Autodecrement AC โ (500) 800 AC โ 500 AC โ ((500)) AC โ (PC + 500) AC โ (XR + 500) AC โ R AC โ (R1) AC โ (R1)+ AC โ -(R1) 500 300 325 900 400 700 700 450 500 201 702 600 400 400 399 800
-