0% found this document useful (0 votes)
17 views

Chapter 05-Part II

The document discusses addressing modes used in computer architecture. It describes different data types that require hardware support and various addressing modes like immediate, direct, register, PC-relative, base/indexed, and indirect. Examples are provided to illustrate each addressing mode and how values are accessed in memory.

Uploaded by

kk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Chapter 05-Part II

The document discusses addressing modes used in computer architecture. It describes different data types that require hardware support and various addressing modes like immediate, direct, register, PC-relative, base/indexed, and indirect. Examples are provided to illustrate each addressing mode and how values are accessed in memory.

Uploaded by

kk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

IT 1206

Section 5.0

Addressing
Addressing Issues

• Types of data that can be addressed


• Addressing modes
Data Types

• Hardware support is needed for the data types


referenced by an instruction.
• Data types that need to be supported
– Numeric:
• integers (signed and unsigned) with lengths
short (16 bit) or long (32 bit)
• floating point with lengths of 32, 64 and 128 bits
– Non-numeric:
• mainly strings
Addressing Modes (I)

• Specify how an operand is accessed


– E.g., constant, a register, or a memory location
• Some types of addressing modes
– Immediate
– Base / Indexed
– Direct MIPS - Load and store only instructions accessmemory

– Register
– PC-relative
– Indirect
Addressing Modes (II)

• Immediate
– The operand contains the value of the datum.
– Eg: add $r4, $r2, #5
$r4 = Data in register $r2 + 3
• Direct (pseudo-direct for MIPS)
– The operand contains the memory address of the datum.
– Eg: add $r4, $r2, (1024)
$r4 = Data in register $r2 + Data at memory address 1024
• Register
– The operand contains the register designation where the
datum is located.
– Eg: add $r4, $r2, r3
$r4 = Data in register $r2 + Data in register $r3
Addressing Modes (III)

• PC-relative
– The operand contains the offset from the PC
– Eg: beg $r1, $r2, 25
If ($r1 = $r2) go to PC = PC + offset (25)
PC – Program Counter

• base / Indexed
– A register contains a base address and an operand holds
a displacement from this base
Note: the base register may be another operand or implicit
– Eg: lw $r1, 100($r2)
r1 = Memory(r2 + 100)
Addressing Modes (IV)

• Indirect
– The operand contains the (memory) address of the datum
– E.g: LD $r3, ($r2)
$r3 = Contents of memory address in register $r2

0x1000
35 0x1004
0x1008
$r2 0x1004 0x100c
memory
Addressing Modes – Example

Consider the instruction LOAD $R1, 800


Which value is loaded into register $R1 for each
addressing mode?
• Immediate base register
• Direct 900 800 300

• Base 1000 900
• Indirect …
700 1000

500 1100
Addressing Modes – Answers

• Immediate - 800
• Direct – 900 (800 contains the intended value)
• Base - 500 (800 is added to the content of the base register = 300, which gives
1100, and the content of word 1100 is retrieved)
• Indirect– 1000 (800 has the memory address 900, and memory address 900
contains the value)
base register
900 800 300

1000 900

700 1000

500 1100

You might also like