The big endian and little endian mappings of the structure
5,
shown
in
"Structure Mapping Examples"
on page 3-29, demonstrate how the size of an item determines its byte ordering. For example:
โข
The word a has its four bytes reversed within the word spanning addresses
OxOO-Ox03.
โข The halfword e has its two bytes reversed within the halfword spanning addresses
Ox1
C-Ox1
D.
Note that the array of bytes
d,
where each data item is a byte, is not reversed when the big end ian and
little end ian mappings are compared. For example, the character 'A' is located at address 14
in
both
the big end ian and
little endian mappings.
In
little endian storage regions, the alignment of data is treated as it is
in
big endian storage regions.
Unlike PowerPC little endian mode, no special alignment exceptions occur when accessing data in
little endian storage regions.
3.5.3.3 PowerPC Byte-Reverse Instructions
For big endian storage regions, normal load/store instructions move the more significant bytes of a
register to and from the lower-numbered memory addresses. The
load/store with byte-reverse
instructions"move the more significant bytes of the register to and from the higher numbered memory
addresses.
As Figure
3-11
through Figure 3-14 illustrate, a normal store to a big endian storage region is the
same as a byte-reverse store to a
little endian storage region. Conversely, a normal store to a little
end ian storage region is the same as a byte-reverse store to a big endian storage region.
Figure 3-11 illustrates the contents of a GPR and memory (starting at address
00) after a normal
load/store
in
a big endian storage region.
MSB
11
11
OxOO
12
12
Ox01
13
13
Ox02
LSB
14
GPR
14
Memory
Ox03
Figure 3-11. Normal Word Load
or
Store (Big Endian Storage Region)
Note that the results are identical to the results of a load/store with byte-reverse
in
a little end ian
storage region, as
illustrated
in
Figure 3-12.
MSB
LSB
11
12
13
14
GPR
11
12
13
14
Memory
OxOO
Ox01
Ox02 Ox03
Figure 3-12. Byte-Reverse Word Load
or
Store (Little Endian Storage Region)
3-32 PPC405GP User's Manual Preliminary