
18/212
Most instructions that involve fetching data from or storing data into memory, use word
aligned addresses (i.e. bits 1 and 0 are set to 0) and load or store four contiguous
bytes. However, there are some instructions that can manipulate part of the bit pattern
in a word, and a few that use double words.
A data item that is represented in two contiguous bytes, is referred to as a 16-bit
object. This can be stored, either in the least significant 16-bits of a word location or in
the most significant 16 bits , hence addresses of such locations are 16-bit aligned (i.e.
bit 0 is set to 0).
A data item that is represented in two contiguous words is referred to as a 64-bit
object or a double word.
Similarly, a data item represented in a single byte is sometimes referred to as an 8-bit
object.
2.3
Signed integers and sign extension
A signed integer is stored in twos-complement format and may be represented by an
N-bit object. Most commonly a signed integer is represented by a single word (32-bit
object), but as explained, it may be stored, for example, in a 64-bit object, a 16-bit
object, or an 8-bit object. In each of these formats, all the bits within the object contain
useful information.
Consider the example shown in Figure 2.2, which shows how the value -10 is stored in
a 32-bit register, firstly as an 8-bit object and secondly as a 32-bit object. Obser ve that
bits 31 to 8 are meaningful for a 32-bit object but not for an 8-bit object. These bits are
set to 1 in the 32-bit object to preserve the negative sign of the integer being
represented.
Figure 2.2 Storing a signed integer in different length objects
11 11 0110
these bit values not related to integer value
0
7
8
31
bit position
11 11 0110
0
7
8
31
bit position
11
1
...
signed integer value (-10) stored as an 8-bit object (byte)
signed integer value (-10) stored as a 32-bit object (word)