11
32000D–04/2011
AVR32
2.8
The Program Counter
The Program Counter (PC) contains the address of the instruction being executed. The memory
space is byte addressed. With the exception of Java state, the instruction size is a multiple of 2
bytes and the LSB of the Program Counter is fixed to zero. The PC is automatically incremented
in normal program flow, depending on the size of the current instruction.
The PC is mapped into the register file and it can be used as a source or destination operand in
all instructions using register operands. This includes arithmetical or logical instructions and
load/store instructions. Instructions using PC as destination register are treated the same way
as jump instructions. This implies that the pipeline is flushed, and execution resumed at the
address specified by the new PC value.
2.9
The Link Register
The general purpose register R14 is used as a Link Register in all modes. The Link Register
holds subroutine return addresses. When a subroutine call is performed by a variant of the call
instruction, LR is set to hold the subroutine return address. The subroutine return is performed
by copying LR back to the program counter, either explicitly by a mov instruction, by using a ldm
or popm instruction or a ret instruction.
The Link Register R14 can be used as a general-purpose register at all other times.
2.10
The Status Register
The Status Register (SR) is split into two halfwords, one upper and one lower, see
Figure 2-6 onwhile the upper halfword contains information about the mode and state the processor executes
in. The upper halfword can only be accessed from a privileged mode.
Figure 2-6.
The Status Register high halfword
Bit 3 1
0
Bit 1 6
In te rrupt Lev el 0 M a s k
In te rrupt Lev el 1 M a s k
In te rrupt Lev el 3 M a s k
In te rrupt Lev el 2 M a s k
1
0
1
0
Se c u re S ta te
FE
I0 M
GM
M1
J
D
M0
EM
I2 M
DM
-
M2
LC
1
SS
In itia l v a lu e
B it nam e
I1 M
M ode B it 0
M ode B it 1
H
M ode B it 2
Re s e rv e d
D ebug S ta te
-
I3 M
Ja v a S ta te
E x c eption M a s k
G lobal In te rrupt M a s k
D ebug S ta te M a s k
J a v a H andle
Re s e rv e d