| Word alignment | ||||||||||||||
| 32-bit word: 4 bytes | ||||||||||||||
| Suppose we want to store the word 0123ABCDhex | ||||||||||||||
| Start at address 1000 | ||||||||||||||
| big-endian | data | 01 | 23 | AB | CD | |||||||||
| address | 1000 | 1001 | 1002 | 1003 | ||||||||||
| little-endian | data | CD | AB | 23 | 01 | |||||||||
| address | 1000 | 1001 | 1002 | 1003 | ||||||||||
| We say the word is stored at address 1000, meaning it's stored beginning at address 1000 | ||||||||||||||
| Could we store these same 4 bytes starting at address 1001, for example? | ||||||||||||||
| Yes, but the hardware for accessing the data in memory is simpler if the data is aligned | ||||||||||||||
| A word begins on a word boundary (address divisible by 4) | ||||||||||||||
| What's a good way to tell if an address is a word boundary? | ||||||||||||||
| If its address in binary ends in 00 | ||||||||||||||
| A halfword is aligned on an address divisible by 2 | ||||||||||||||