Programmer’s Guide BCM5722
10/15/07
Broadcom Corporation
Document 5722-PG101-R Endian Control (Byte and Word Swapping) Page 142
ENDIAN CONTROL (BYTE AND WORD SWAPPING)
BACKGROUND
There are two basic formats for storing data in memory—little-endian and big-endian. The endianess of a system is
determined by how multibyte quantities are stored in memory. A big-endian architecture stores the most significant byte at
the lowest address offset while little-endian architecture stores the least significant byte at the lowest address offset.
For example, the 32-bit hex value 0x12345678 would be stored in memory as shown in the following table.
Another way of viewing how this data would be stored is shown in the following tables.
Examples of big-endian platforms include SGI Irix, IBM RS6000, and SUN.
Examples of little-endian platforms include Intel x86 and DEC Alpha.
PCI assumes a little-endian memory model. PCI configuration registers are organized so that the least significant portion of
the data is assigned to the lower address.
Table 56: Endian Example
Address 00 01 02 03
Big Endian 12 34 56 78
Little Endian 78 56 34 12
Table 57: Storage of Big-Endian Data
Storage Byte 00 01 02 03
Data Contents12345678
Table 58: Storage of Little-Endian Data
Storage Byte 03 02 01 00
Data Contents12345678