supplementary chapter 2 instruction addressing modes
Download
Skip this Video
Download Presentation
SUPPLEMENTARY CHAPTER 2 Instruction Addressing Modes

Loading in 2 Seconds...

play fullscreen
1 / 37

SUPPLEMENTARY CHAPTER 2 Instruction Addressing Modes - PowerPoint PPT Presentation


  • 111 Views
  • Uploaded on

The Architecture of Computer Hardware and Systems Software: An Information Technology Approach 3rd Edition, Irv Englander John Wiley and Sons  2003. SUPPLEMENTARY CHAPTER 2 Instruction Addressing Modes. Little Man Computer. Direct, absolute addressing

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' SUPPLEMENTARY CHAPTER 2 Instruction Addressing Modes' - matana


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
supplementary chapter 2 instruction addressing modes

The Architecture of Computer Hardware and Systems Software: An Information Technology Approach

3rd Edition, Irv Englander

John Wiley and Sons 2003

SUPPLEMENTARY CHAPTER 2Instruction Addressing Modes

little man computer
Little Man Computer
  • Direct, absolute addressing
    • Direct: data is reached directly from the address in the instruction
    • Absolute: address in the instruction field is the actual memory location being addressed

Supplementary Chapter 2 Instruction Addressing Modes

additional addressing modes
Additional Addressing Modes
  • Programmer-accessible registers
    • Provide faster execution with register-based instructions
  • Alternatives to absolute addressing
    • Allow larger range of addressable memory
    • While using a reasonable number of bits for the address field
  • Alternatives to direct addressing
    • Facilitate writing certain types of programs
    • Example: loops that use index to address different entries in a table or array

Supplementary Chapter 2 Instruction Addressing Modes

register addressing
Register Addressing
  • Does not require a memory access
    • Faster execution
  • Implemented directly as part of the CPU
    • RISC machine instruction set: made up almost entirely of register operation instructions

Supplementary Chapter 2 Instruction Addressing Modes

register addressing1
Register Addressing

*Done in parallel with move; only 3 time units required

Supplementary Chapter 2 Instruction Addressing Modes

additional addressing modes1
Additional Addressing Modes
  • Programmer-accessible registers
    • Provide faster execution with register-based instructions
  • Alternative to absolute addressing
    • Allow larger range of addressable memory
    • While using a reasonable number of bits for the address field
  • Alternative to direct addressing
    • Facilitate writing certain types of programs
    • Example: loops that use index to address different entries in a table or array

Supplementary Chapter 2 Instruction Addressing Modes

active area of memory
Active Area of Memory
  • Code executes in a small area of memory that changes as program proceeds
  • Well-written code
    • Small modular subroutines and procedures
    • Local variables
    • Conditional branches

Fig S2.2

Supplementary Chapter 2 Instruction Addressing Modes

2 alternatives to absolute addressing
2 Alternatives to Absolute Addressing
  • Base register addressing
  • Relative addressing
  • Both provide starting address and an offset or displacement from the starting point
      • Starting address in register or program counter
      • Offset: address in the instruction
  • Programming advantage: relocatability

Supplementary Chapter 2 Instruction Addressing Modes

base register addressing
Base Register Addressing
  • Base register set to initial address
    • Hardware design: special, separate register or general-purpose registers
    • Generally large to provide large memory space, frequently gigabytes
  • Final address: contents of instruction address field added to the base address

Supplementary Chapter 2 Instruction Addressing Modes

ibm zsystem
IBM zSystem
  • Base register address creation

Supplementary Chapter 2 Instruction Addressing Modes

ibm zsystem1
IBM zSystem
  • 16 64-bit general-purpose registers
    • Load instruction format

Supplementary Chapter 2 Instruction Addressing Modes

ibm zsystem example load
IBM zSystem Example: Load
  • Base-value register: general-purpose register 3

1 C 2 5 E 016

  • Displacement for the instruction

3 7 A16

  • Absolute address

Supplementary Chapter 2 Instruction Addressing Modes

ibm zsystem example load1

Op code

Base register

Destination register

Displacement

IBM zSystem Example: Load
  • Instruction Word

Supplementary Chapter 2 Instruction Addressing Modes

fetch execute cycle for relative address
Fetch-Execute Cycle for Relative Address

Supplementary Chapter 2 Instruction Addressing Modes

relative addressing
Relative Addressing
  • Value in address field added to value in program counter
    • Program counter used as the base register
    • Similar to base addressing
  • Constraint: address field must be able to store and manipulate positive and negative numbers
    • Complementary representation

Supplementary Chapter 2 Instruction Addressing Modes

relative addressing example
Relative Addressing Example

Supplementary Chapter 2 Instruction Addressing Modes

direct addressing
Direct Addressing
  • Separates data into location different from location of instructions
  • Benefits to programmer
    • Data can be changed without affecting the instruction itself
    • Data is available to different instructions

Supplementary Chapter 2 Instruction Addressing Modes

additional addressing modes2
Additional Addressing Modes
  • Programmer-accessible registers
    • Provide faster execution with register-based instructions
  • Alternative to absolute addressing
    • Allow larger range of addressable memory
    • While using a reasonable number of bits for the address field
  • Alternative to direct addressing
    • Facilitate writing certain types of programs
    • Example: loops that use index to address different entries in a table or array

Supplementary Chapter 2 Instruction Addressing Modes

alternatives to direct addressing
Alternatives to Direct Addressing
  • Immediate addressing
  • Indirect addressing
  • Register Indirect addressing
  • Indexed addressing

Supplementary Chapter 2 Instruction Addressing Modes

immediate addressing
Immediate Addressing
  • Store data with the instruction itself
    • Example:
      • Data is a constant
    • Constraint:
      • Address field must be able to store and manipulate positive and negative numbers
      • Complementary representation
    • Advantage:
      • Additional memory access not required
      • Faster execution

Supplementary Chapter 2 Instruction Addressing Modes

immediate addressing1
Immediate Addressing
  • Modified LMC Example
    • Constant limited to the size of address field

Supplementary Chapter 2 Instruction Addressing Modes

immediate addressing2
Immediate Addressing
  • Modified LMC Example

Supplementary Chapter 2 Instruction Addressing Modes

indirect addressing
Indirect Addressing
  • Address field of the instruction contains the address of the data
    • Similar to pointers in Pascal or C
    • Frequently used with subscripted data in a table

Supplementary Chapter 2 Instruction Addressing Modes

little man indirect addressing
Little Man Indirect Addressing

a. The Little Man reads in instruction

b. ,,, he finds the address of the data

Supplementary Chapter 2 Instruction Addressing Modes

little man indirect addressing1
Little Man Indirect Addressing

c. … from that address he retrieves the data

d. … with a different address in location 45, he retrieves different data (note: In this step the address of the data has been incremented).

Supplementary Chapter 2 Instruction Addressing Modes

incrementing
Incrementing
  • Treat the instruction as data
    • Modify the address field
  • Pure code: does not modify itself during execution
    • Incrementing does not modify the instruction
    • Address stored in a separate data region
    • Advantage: program can be stored in ROM

Supplementary Chapter 2 Instruction Addressing Modes

slide27

Totalizer Loop

with

Direct Addressing

Instruction in location 07 treated as data, incremented, and replaced to its original location

slide28

Totalizer Loop

with

Indirect Addressing

Asterisk used to indicate indirect instruction

register indirect addressing
Register Indirect Addressing
  • Also called register deferred addressing
  • Address pointed is stored in a general-purpose register
  • Advantage: efficient
    • 1 instruction to load pointer address in register
    • Data accessed in the same number of fetch-execute instructions as direct addressing
    • Small address field required (3 or 4 bits)
    • Excellent for addressing large memory space with small instruction word

Supplementary Chapter 2 Instruction Addressing Modes

register indirect addressing dual duty
Register Indirect AddressingDual Duty
  • Autoincrementing/autodecrementing
    • Direct implementation of C’s “++” and “- -”
  • Instruction
    • Performs normal function like LOAD or ADD
    • Plus increments or decrements register each time instruction executed
  • Advantage: simplifies writing program loops
    • Replaces steps 7,9,10, 11 on Slide #28

Supplementary Chapter 2 Instruction Addressing Modes

register indirect addressing obtaining data
Register Indirect AddressingObtaining Data

Supplementary Chapter 2 Instruction Addressing Modes

motorola 68000 cpu move
Motorola 68000 CPU MOVE

Supplementary Chapter 2 Instruction Addressing Modes

indexed addressing
Indexed Addressing
  • Use address in the instruction like direct addressing
    • But modify address by adding value from another register
    • General purpose or special index register

Supplementary Chapter 2 Instruction Addressing Modes

indexed vs base offset
Indexed vs. Base Offset
  • Both offset address by amount stored in another register
  • Base offset: primarily to expand addressing range for a given address field size
    • Value of base address likely to be large and rarely changed during execution
  • Index register: primarily a table offset for subscripting
    • Value in index register most like small and frequently changing
    • Autoindexing: similar to autoincrementing

Supplementary Chapter 2 Instruction Addressing Modes

index register modifying an address
Index Register: Modifying an Address

Supplementary Chapter 2 Instruction Addressing Modes

using both base offset and indexed addressing
Using Both Base Offset and Indexed Addressing

Supplementary Chapter 2 Instruction Addressing Modes

totalizer loop with indexed addressing
Totalizer Loop with Indexed Addressing

Supplementary Chapter 2 Instruction Addressing Modes

ad