Data alignment and zero-bits relation?
Reading through a paper for the ARM Cortex-M3 CPU I found this line confusing:
The lowest 2 开发者_如何学JAVAbits of the stack pointers are always 0, which means they are always word aligned
I have seen similar statements elsewhere. What is the logic behind some zero bits => some alignment?
If the 2 LS bits are always zero then addresses can only be multiples of 4, i.e. addresses can only be:
Hex Binary
xxxxxxx0 bbbbbbbbbbbbbbbbbbbbbbbbbbbb0000
xxxxxxx4 bbbbbbbbbbbbbbbbbbbbbbbbbbbb0100
xxxxxxx8 bbbbbbbbbbbbbbbbbbbbbbbbbbbb1000
xxxxxxxc bbbbbbbbbbbbbbbbbbbbbbbbbbbb1100
(If it helps, think of the equivalent in decimal - any number that ends in 00 is a multiple of 10^2 = 100).
精彩评论