CAO - Mod1 Mymry, Adress, Adressing Modes
CAO - Mod1 Mymry, Adress, Adressing Modes
CAO - Mod1 Mymry, Adress, Adressing Modes
Module -1 Part -2
b 31 b 30 b1 b0
•
•
•
Sign bit: b 31= 0 for positive numbers
b 31= 1 for negative numbers
(a) A signed integer
0 15 BIG ENDIAN 0 79
1 36 1 58
MSB->LOWR
2 58 2 36
3 79 15
3
‘’
4
‘
‘’
15 79
n-2 36 n-2 58
n-1 58 n-1 36
79 n 15
n
Memory Operations
Both program instructions and data operands are stored in the
memory.
Two basic operations involving the memory are needed, namely,
Read and Write.
To start a Read operation, the processor sends the address of the
desired location to the memory and requests that its contents be
read.
The memory reads the data stored at that address and sends them
to the processor.
The Write operation transfers an item of information from the
processor to a specific memory location.
To initiate a Write operation, the processor sends the address of the
desired location to the memory, together with the data to be written
into that location. The memory then uses the address and data to
perform the write.
Load (or Read or Fetch)
Copy the content
Memory content doesn’t change
Address MAR, read frm mem, content MDR
Registers can be used
Store (or Write)
Overwrite the content in memory
Address MAR and Data MDR, write to mem
Registers can be used
Instruction and Instruction Sequencing
I/O transfers
Register Transfer Notation
R3 ← [R1] + [R2]
Assembly Language Notation
1. Immediate mode
2. Register mode
3. Absolute/ Direct mode
4. Indirect mode
5. Index mode
6. Base with index
7. Base with index and offset
8. Relative mode
9. Auto - increment mode
10.Auto - decrement mode
Indexed / Displacement Addressing
Indexing and Arrays
Index mode – the effective address of the operand is
generated by adding a constant value to the contents of a
register.
X( Ri ) ; EA = [ Ri ] + X
Ri Index register
X constant given either as an explicit number or as a
symbolic name representing a numerical value.
Effective address= start address + displacement
(Index register holds address of a new location and value
of X defines an offset (displacement))
Good for accessing arrays
Indexing and Arrays…
Index mode facilitates access to an operand whose location is
defined relative to a reference point within the data structure in
which the operand appears.
Several variations:
X( Ri ) ; EA = [ Ri ] + X (Index)
EA is the sum of two values; one is given explicitly in the
instruction, and the other is stored in a register.
( Ri, Rj ) ; EA = [ Ri ] + [ Rj ] (Base with Index)
a A second register (base register) may be used to contain the
offset X. EA is the sum of the contents of registers Ri and Rj.
X( Ri, Rj ) ; EA = X + [ Ri ] + [ Rj ] (Base with Index and
offset)
EA is sum of constant X and contents of registers Ri and Rj .
It is useful in accessing multiple components inside each item
in a record, where the beginning of an item is specified by
(Ri, Rj) part of addressing mode (3D arrays).
Relative Addressing (PC-Relative)