Se ha denunciado esta presentación.
Se está descargando tu SlideShare. ×
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Próximo SlideShare
ADDRESSING MODES
ADDRESSING MODES
Cargando en…3
×

Eche un vistazo a continuación

1 de 17 Anuncio

Más Contenido Relacionado

Presentaciones para usted (20)

Similares a Addressing modes (20)

Anuncio

Más reciente (20)

Addressing modes

  1. 1. ADDRESSING MODES MUKTA GARG ASSISTANT PROFESSOR ADVANCED EDUCATIONAL INSTITUTE www.advanced.edu.in
  2. 2. www.advanced.edu.in THE ADDRESSING MODE Specifies a rule for interpreting or modifying the address field of the instruction before the operand is actually referenced. THE OPERATION FIELD OF AN INSTRUCTION SPECIFIES THE OPERATION TO BE PERFORMED. THIS OPERATION MUST BE EXECUTED ON THE DATA STORED IN COMPUTER REGISTERS OR THE MEMORY WORDS. THE WAY THE OPERANDS ARE CHOSEN DURING PROGRAM EXECUTION IS DEPENDENT ON THE ADDRESSING MODE OF THE INSTRUCTION.
  3. 3. www.advanced.edu.in COMPUTERS USE ADDRESSING MODE TECHNIQUES FOR THE PURPOSE OF ACCOMODATING THE FOLLOWING PURPOSES:- To give programming versatility to the user by providing such facilities as pointers to memory, counters for loop control, indexing of data and various other purposes. To reduce the number of bits in the addressing field of the instructions.
  4. 4. www.advanced.edu.in To understand the various addressing modes, It is imperative that we understand the basic operation cycle of the computer. The control unit of a computer is designed to go through an instruction cycle that is divided into 3 major parts:- 1. Fetch the instruction from memory 2. Decode the instruction, and 3. Execute the instruction.
  5. 5. There is 1 register in the computer called the program counter or PC that keeps track of the instructions in the program stored in memory. ¤ PC holds the address of the instructions to be executed next and is incremented each time an instruction is fetched from memory. ¤ The decoding of the instruction that is to be done in the next step tells which operation is to be performed, the addressing mode of the instruction, and the location of the operands. ¤ The computer then executes the instruction and returns to the step1, i.e. to fetch the next instruction. www.advanced.edu.in PROGRAM COUNTER:
  6. 6. MODE FIELD An example of an instruction format with a distinct addressing mode field is shown below: Opcode Mode Address The mode field is used to locate the Operands needed for the operation. There may or may not be the address field in the instruction. www.advanced.edu.in
  7. 7. Although most addressing modes modify the address field of the instruction, there are two modes that need no address field at all: 1.) Implied mode 2.) Immediate mode. IMPLIED MODE: In this mode the operands are specified implicitly in the definition of the instruction. For example:- “compliment accumulator” is an implied-mode instruction because the operand in the accumulator register is implied in the definition of the instruction. In fact, all register reference instructions that use an accumulator are implied-mode instructions. www.advanced.edu.in
  8. 8. Immediate mode In this mode the operand is specified in the instruction itself. In other words, an immediate-mode instruction has an operand field rather than an address field. The operand field contains the actual operand to be used in conjunction with the operation specified in the instruction. Note: It was mentioned previously that the address field of an instruction may specify either a memory word or a processor register. When the address field specifies a processor register, the instruction is said to be in register-mode. www.advanced.edu.in
  9. 9. www.advanced.edu.in Register mode: In this mode the operands are in registers that reside within the C.P.U. The particular register is selected from the register field in the instruction. A K-bit field can specify any one of 2k registers. Register indirect mode: In this mode the instruction specifies a register in the CPU whose contents give the address of the operand in the memory. In other words, the selected register contains the address of the operand rather than the operand itself. Before using a register indirect mode instruction, the programmer must ensure that the memory address of the operand is placed in the processor register with a previous instruction. Advantage: The address field of the instruction uses fewer bits to select a register than would have been required to specify a memory address directly.
  10. 10. Auto increment or auto decrement www.advanced.edu.in This is similar to register indirect mode except that the register is incremented or decremented after (or before) its value is used to access memory. When the address stored in the registers refers to a table of data in memory, it is necessary to increment or decrement the registers after every access to the table. This can be achieved by using the increment or decrement instruction. In some computers it is automatically accessed. The address field of an instruction is used by the control unit in the CPU to obtain the operands from memory. Sometimes the value given in the address field is the address of the operand, but sometimes it is the address from which the address has to be calculated. For that we need to know about the concept of ‘EFFECTIVE ADDRESS’.
  11. 11. www.advanced.edu.in Effective address: The effective address is defined to be the memory address obtained from the computation dictated by the given addressing mode. The effective address is the address of the operand in a computational-type instruction. DIRECT ADDRESS MODE:- In this mode the effective address is equal to the address part of the instruction. The operand resides in memory and its address is given directly by the address field of the instruction.
  12. 12. www.advanced.edu.in INDIRECT ADDRESS MODE: In this mode the address field of the instruction gives the address where the effective address is stored in memory. Control unit fetches the instruction from the memory and uses its address part to access memory again to read the effective address. Some addressing modes requires the following calculation to generate the effective address: Effective address= address part of instruction+content of CPU register
  13. 13. RELATIVE ADDRESSMODE In this mode the content of the program counter is added to the address part of the instruction in order to obtain the effective address. The address part of the instruction is usually a signed number(either a +ve or a –ve number). When the number is added to the content of the program counter, the result produces an effective address whose position in memory is relative to the address of the next instruction. INDEXED ADDERESSING MODE: In this mode the content of an index register is added to the address part of the instruction to obtain the effective address. The index register is a special CPU register that contains an index value. NOTE: If an index-type instruction does not include an address field in its format, the instruction i.e. automatically converted to the register indirect mode of operation. www.advanced.edu.in
  14. 14. BASE REGISTER ADDRESSING MODE In this mode the content of a base register is added to the address part of the instruction to obtain the effective address. This is similar to the indexed addressing mode except that the register is now called a base register instead of the index register. The base register addressing mode is used in computers to facilitate the relocation of programs in memory. When programs and data are moved from one segment of memory to another. www.advanced.edu.in
  15. 15. NUMERICAL EXAMPLE PC=200 R1=400 XR=100 AC LOAD TO AC MODE ADDRESS=500 NEXT INSTRUCTION 450 700 800 900 325 300 ADDRESS MEMORY 200 201 202 399 400 500 600 702 200www.advanced.edu.in
  16. 16. ADDRESSING EFFECTIVE CONTENT MODE ADDRESS TO AC DIRECT ADDRESS 500 800 IMMEDIATE OPERANDS 201 500 INDIRECT ADDRESS 800 300 RELATIVE ADDRESS 702 325 INDEXED ADDRESS 600 900 REGISTER ---- 400 REGISTER INDIRECT 400 700 AUTOINCREMENT 400 700 AUTODECREMENT 399 ` 450 www.advanced.edu.in
  17. 17. Mukta Garg Assistant Professor Advanced Educational Institute Advanced Educational Institutions, 70 km Milestone, Delhi-Mathura Road, Dist. Palwal, Haryana-121105 +91–1275–398400, 302222 Rahul.sharma90@gmail.com www.advance.edu.in www.advanced.edu.in

×