Hardware Reference
In-Depth Information
a hardware store has in stock), identify things (e.g., bank account numbers), and
much more. Most modern computers store integers in two's complement binary
notation, although other systems have also been used in the past. Binary numbers
are discussed in Appendix A.
Some computers support unsigned as well as signed integers. For an unsigned
integer, there is no sign bit and all the bits contain data. This data type has the ad-
vantage of an extra bit, so for example, a 32-bit word can hold a single unsigned
integer in the range from 0 to 2 32
1, inclusive. In contrast, a two's complement
signed 32-bit integer can handle only numbers up to 2 31
1, but, of course, it can
also handle negative numbers.
For numbers that cannot be expressed as an integer, such as 3.5, floating-point
numbers are used. These are discussed in Appendix B. They have lengths of 32,
64, or 128 bits. Most computers have instructions for doing floating-point arith-
metic. Many computers have separate registers for holding integer operands and
for holding floating-point operands.
Some programming languages, notably COBOL, allow decimal numbers as a
data type. Machines that wish to be COBOL-friendly often support decimal num-
bers in hardware, typically by encoding a decimal digit in 4 bits and then packing
two decimal digits per byte (binary code decimal format). However, binary arith-
metic does not work correctly on packed decimal numbers, so special decimal-
arithmetic-correction instructions are needed. These instructions need to know the
carry out of bit 3. This is why the condition code often holds an auxiliary carry bit.
As an aside, the infamous Y2K (Year 2000) problem was caused by COBOL pro-
grammers who decided that they could represent the year in two decimal digits (8
bits) rather than four decimal digits (or an 8-bit binary number), which can hold
even more values (256) than two decimal digits (100). Some optimization!
5.2.2 Nonnumeric Data Types
Although most early computers earned their living crunching numbers, modern
computers are often used for nonnumerical applications, such as email, surfing the
Web, digital photography, and multimedia creation and playback. For these appli-
cations, other data types are needed and are frequently supported by ISA-level in-
structions. Characters are clearly important here, although not every computer pro-
vides hardware support for them. The most common character codes are ASCII
and Unicode. These support 7-bit characters and 16-bit characters, respectively.
Both were discussed in Chap. 2.
It is not uncommon for the ISA level to have special instructions intended for
handling character strings, that is, consecutive runs of characters. These strings are
sometimes delimited by a special character at the end. Alternatively a string-length
field can be used to keep track of the end. The instructions can perform copy,
search, edit, and other functions on the strings.
 
 
Search WWH ::




Custom Search