Date Printed: April 6, 2004 Page 2
The bits within a word are numbered from 0 (least significant) to 31 (most significant).
byte:
7 0
half (2 bytes):
15 0
|
word (4 bytes):
31 0
| | |
double (8 bytes):
63 0
| | | | | | |
Alignment
Halfword, word, and doubleword data must be aligned in memory. For example, a 4 byte word
value must be placed at an address that is divisible by 4, and a doubleword must be placed at an
address that is divisible by 8. The load and store instructions will cause error exceptions if an
attempt is made to move a halfword, word, or doubleword quantity to/from an address that is not
properly aligned.
Big Endian
The SPARC architecture is “Big Endian,”!meaning that when a word-sized quantity is stored in 4
bytes of memory, the most significant byte is stored in the first byte (i.e., lowest numbered address)
and the least significant byte is stored in the last byte (i.e., the byte with the greatest address). In
other words, if a word is stored at address x, the most significant byte will be stored in byte x and
the least significant byte will be stored in address x+3.
Some other (non-SPARC) computers use “Little Endian” order, in which the least significant byte
is stored in the lowest numbered address.
Binary, Decimal, and Hex Notation
An integer may be represented many ways. Normally, we represent integers in decimal using 10
numeral symbols (0, 1, 2, 3, 4, 5, 6, 7, 8, and 9). The position (i.e., “place”) of each digit in the
representation is significant. The place values are: ones, tens, hundreds, thousands, and so on.
Integers represented in binary use only two numeral symbols (0 and 1). The bit in each place is
multiplied by a power of 2. Thus, the place values are: 1's, 2's, 4's, 8's, 16's, and so on.
Integers represented in hex use sixteen digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F). The
hex digit in each place is multiplied by a power of 16. Thus, the place values are: 1's, 16's, 256's,
4096's, 65536's, and so on.
评论0
最新资源