Arm Isa
Arm Isa
About ARM
● Advanced RISC Machines !
● ARM v4 architecture (latest)
● Popular for mobile phones, embedded devices
– Why?
ARM characteristics
● RISC like
– 32 bit instructions
– Load and store – to do memory I/O
– ALU operations work on registers
● Non-RISC (or CISC) like
– Mov R1, (R2)+ autoincrement type instruction, also autodecrement
– PC Relative addressing mode
● Conceptually like this: Mov R1, PC(-4)
– Conditional codes (N, Z, V, C)for branching
● What does this mean?
– Multiple byte transfers to-and-from memory
Concept: status register
● Many processors have a “status” register
● Used to store “status” of last instruction executed
● E.g. Whether last instruction resulted in an overflow, if the
computation result was zero, etc.
● Conditional branches
– One type: BNZ R1, LOOP
– Status register type: BNZ LOOP
● Here status register is checked, and not R1 or any such register
Addressing Modes
● Basic Indexed Addressing Mode
– Pre-indexed mode—The effective address of the operand is the sum of the
contents of a base register, Rn, and a signed offset.
– Examples
1) LDR Rd, [Rn, #offset]
Meaning
Rd ← [[Rn] + offset]
2) LDR Rd, [Rn, Rm]
meaning
Rd ← [[Rn] + [Rm]]
3) LDR Rd, [Rn]
Meaning
Rd ← [[Rn]]
Addressing Modes
● Relative Addressing Mode
– Program counter used as base register
E.g.
LDR R1, ADDR
Here effective address is PC + ADDR due to
pipelined execution, to be discussed later
In the figure, the offset
calculated by the
assembler is 52,
because the
updated PC will contain
1008 when the offset is
added to it during
program execution.
The numbers
in the first row of
the matrix can be
accessed
conveniently in a
program loop by
using the
Post-indexed
addressing mode,
with the offset
contained in a
register.
Addressing Modes
● Index Modes with Writeback
– Modifications of the auto-increment and auto-decrement addressing modes
– Pre-indexed with writeback mode—The effective address of the operand is
generated in the same way as in the Pre-indexed mode, then the effective
address is written back into Rn.
– Post-indexed mode—The effective address of the operand is the contents of
Rn. The offset is then added to this address and the result is written back into
Rn
● In the Pre-indexed mode, the exclamation character ‘!’ signifies that writeback is to be
done. The Post-indexed mode always involves writeback, so the exclamation character
is not needed.
Branch offset (2’s complement
number in instruction )
Calculation:
the value in the instruction
is shifted left two bit positions
(multiple of word offsets)
then
sign-extended to 32 bits to
generate the offset.