5
32000D–04/2011
AVR32
2.
Programming Model
This chapter describes the programming model and the set of registers accessible to the user.
2.1
Data Formats
When any of these types are described as unsigned, the N bit data value represents a non-neg-
ative integer in the range 0 to + 2N-1.
When any of these types are described as signed, the N bit data value represents an integer in
the range of -2
N-1 to +2N-1-1, using two’s complement format.
Some instructions operate on fractional numbers. For these numbers, the data value represents
a fraction in the range of -1 to +1-2
-(N-1), using two’s complement format.
2.2
Data Organization
multi-byte data is stored in memory, the most significant byte is stored at the lowest address. All
instructions are interpreted as being big-endian. However, in order to support data transfers that
are little-endian, special endian-translating load and store instructions are defined.
The register file can hold data of different formats. Both byte, halfword (16-bit) and word (32-bit)
formats can be represented, and byte and halfword formats are supported in both unsigned and
signed 2’s complement formats. Some instructions also use doubleword operands. Doubleword
data are placed in two consecutive registers. The most significant word is in the uppermost reg-
ister. Valid register pairs are R1:R0, R3:R2, R5:R4, R7:R6, R9:R8, R11:R10 and R13:R12.
Load and store operations that transfer bytes or halfwords, automatically zero-extends or sign-
extends the bytes or half-words as they are loaded.
Figure 2-1.
Data representation in the register file
Table 2-1.
Overview of execution modes, their priorities and privilege levels.
Type
Data Width
Byte
8 bits
Halfword
16 bits
Word
32 bits
Double Word
64 bits
S SSSSSSSS SSSSSSSS SSSSSSS
By te
S
70
8
31
00 00 00 00 000 00 00 00 00 000 00
By te
70
8
31
SSSS SSSSSSSS SSSS
15
0
16
31
Ha lfwo rd
S
00 00 000 00 00 00 00 0
15
0
16
31
Ha lfwo rd
to p
up pe r
lo w e r
b o tto m
31
0
S ign e x te nd ed b y te
U n s ign ed by te
S ign e x te nd ed h a lfw ord
U n s ign ed ha lfw o rd
Wo rd