This is a diagram in a class of mine and only instruction 0 has executed. In the stack on the lower right of that digram, it stores $ra at an address 4 less than the $sp
which is at 128.
In my book, however, they use offsets to mean higher than the $sp
. here are the diagrams:
and
What’s strange to me is that in the first image, the lw and sw offsets are positive numbers but cause the values to be stored negative to the $sp
at lower addresses.
However, the last two images use offsets to store or load values at higher addresses relative to $sp
. The book makes room by subtracting from the $sp
first and then storing register values in the freed up stack using positive offset numbers which go to higher addresses.
Are these two inconsistent?