Electronic – Why is MSP430’s Stack Poniter(SP) always alligned to even address

msp430ramstack-pointer

While I was reading through the MSP430's User's guide, I came to know that its stack pointer is alligned to even address. (Read Pg.189 of http://www.ti.com/lit/ug/slau208m/slau208m.pdf)

Why is it so ? Why is the stack pointer alligned to even address?

As per my understanding, each address location in RAM can store 16bits of data irrespective of even or off address location.

From the below image it is clear how that data can be pushed or popped in RAM.

Now it is like each address(even or odd) can store 8 bits of data. But I expected each address can store 16bits of data.

MSP430 stack operation

Best Answer

Each memory address references a single byte, but the internal data bus (and flash memory) of the processor is 16 bits wide. When accessing values in memory that will be used for data, this is irrelevant from a hardware perspective; it's something the compiler will deal with. When accessing values in memory that will be executed, i.e. are machine code instructions, the processor has to make sure that the instructions are always aligned to an even-numbered byte address. It does this by enforcing a constraint on the PC (Program Counter) register that it must always be even (bit 0 of the PC probably isn't actually implemented as a DFF at all, just hardwired to logic 0). Instructions have to be on even byte addresses because the processor has to be able to read the entire instruction in a single operation from a single 16-bit wide memory location. If the instruction was on an odd byte address, it would be half in one memory location and half in another. The processor would need to be considerably more complex to deal with that possibility; it's simpler (and, ultimately, cheaper) for the processor designer/manufacturer to accept the tradeoff of less complexity in exchange for the processor only being able to deal with even addresses for instructions.