CSE 259 Lecture4
CSE 259 Lecture4
CSE 259 Lecture4
)
Indexing and arrays: Lists and arrays are represented using index mode.
Index mode: The effective address of the operand is generated by adding a constant
value to the contents of a register. This register may be a special purpose register or a
general purpose register of the processor. This is referred to as index register.
• Index mode is presented as
X(Ri) X is the constant value
• The effective address of the operand is calculated as
EA=X+[Ri] index register
• The constant X may be an explicit number given in the instruction or a
symbolic name representing a numerical value.
Addressing Modes(contd.)
• When the instruction is converted into machine code, the constant X is
considered as a part of the instruction and requires fewer bits than the
word length of the computer.
• Offset/Displacement address: Indicates the distance or location of a
specific data, in an array or other data structure, from the base address.
This is known as relative addressing.
See Figure 2.13, 2.14 and 2.15
⸼ What is dimension of the array (Figure 2.14)?
⸼ How many rows and columns are there in the array (Figure 2.14)?
Addressing Modes(contd.)
Relative mode: The effective address is determined by the Index mode using the PC instead
of a general purpose register.
• X(PC), because PC always identifies the current execution point in a program.
Additional Addressing Modes: Many computers provide additional modes to aid
in programming tasks. The following two modes are used to access data in
successive memory locations:
Autoincrement mode: The effective address of an operand is the contents of a register given
in the instruction. After accessing this operand, the contents of the register are incremented
automatically to point to the next item in the list.
• (Ri)+ The contents of the register would be incremented by (in a byte addressable memory with 32 bit
word length, the increment would be by 4 )
Autodecrement mode: The contents of the register are first decremented automatically and
then used as the effective address of the operand.
-(Ri)
See Figure 2.16
RISC