ST20-C1 STMICROELECTRONICS [STMicroelectronics], ST20-C1 Datasheet - Page 17

no-image

ST20-C1

Manufacturer Part Number
ST20-C1
Description
Instruction Set Reference Manual
Manufacturer
STMICROELECTRONICS [STMicroelectronics]
Datasheet
For example, the most significant bit of a word is bit 31, and the most significant byte is
byte 3, consisting of bits 24 to 31. This ordering is compatible with Intel processors,
but not Motorola or SPARC.
For compatibility with other devices, a swap32 instruction is provided to reverse the
order of bytes within a word.
3.1.2
A signed object is stored in twos-complement format. A signed value may be repre-
sented by an object of any size. Most commonly a signed integer is represented by a
single word, 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.
The length of the object that stores a signed value can be increased, so that the object
size is increased without changing the value that is represented. This operation is
known as sign extension . All the extra bits that are allocated for the larger object, are
meaningful to the value of the signed integer; they must therefore be set to the appro-
priate value. The value for all these extra bits is the same as the value of the most
significant bit - i.e. the sign bit - of the smaller object. The ST20-C1 provides instruc-
tions that sign extend byte and half-word objects to words.
The example shown in Figure 3.2 shows how the value -10 is stored in a 32-bit
register, either as an 8-bit object or as a 32-bit object. In this case, bits 31 to 8 are
meaningful for the 32-bit object but not for the 8-bit object. These bits are set to 1 in
the 32-bit object.
Most
significant
Most
significant
Signed integers and sign extension
31
3
Figure 3.1 Bytes and bits in words
2
Bytes in a word
Bits in a word
1
0
significant
significant
3 Architecture
Least
Least
0
17/205

Related parts for ST20-C1