3 Architecture
be half-word-aligned if it is at an address with an even byte selector, i.e. the full
address of the object is divisible by 2.
Word objects, including addresses, are normally stored word-aligned in memory. This
is usually desirable to make the best use of any 32-bit wide memory. Also most
instructions that involve fetching data from or storing data into memory, use word
aligned addresses and load or store four contiguous bytes.
However, there are some instructions that can manipulate part of a word. A half-word
object is normally half-word-aligned, so it can be stored either in the least significant
16 bits of a word or in the most significant 16 bits. A data item that is represented in
two contiguous words is called a double word object and is normally word-aligned.
3.2.3 Ordering of information in memory
Data is stored in memory using the little-endian rule. Objects consisting of more than
one byte are stored in consecutive bytes, with the least significant byte at the lowest
address and the most significant at the highest address .
Figure 3.3 shows the ordering of bytes in words in memory. If X is a word-aligned
address then the word at X consists of the bytes at addresses X to X+3, where the
byte at X is the least significant b yte and the byte at X+3 is the most significant byte of
the word.
Memory
(bytes)
X+7
X+6
X+5
X+4
X+3
X+2
X+1
X+0
MSB
32-bit words
LSB
X+7
X+6
X+5
X+4
31
24 23
16 15
87
0
MSB
LSB
X+3
X+2
X+1
X+0
31
24 23
16 15
87
0
X is a word-aligned byte address
X+n is the byte n bytes past X
Figure 3.3 Bytes in words in memory
3.2.4 Work space
The ST20-C1 uses a stack-based data structure in memory to hold the local working
data of a program, called the work space. The work space is a word-aligned collection
of 32-bit words pointed to by the work space pointer register (Wptr).
The programmer’s model is that all local data is held in the work space, i.e. in memory,
and must be brought into the evaluation stack to be operated on, and then written
back from the evaluation stack to the work space.
19/205
®