1、( 选自M.MORRIS MANO COMPUTER SYSTEM ARCHITECTURETHIRD EDITION )IN THIS CHAPTER2-1 Data Types2-2 Complements2-3 Fixed-Point Representation2-4 Floating-Point Representation2-5 Other Binary Codes2-6 Error Detection CodesBinary information in digital computers is stored in memory or processor registers. R
2、egisters contain either data or control information. Control information is a bit or a group of bits used to specify the sequence of command signals needed for manipulation of the data in other registers. Data are numbers and other binary-coded information that are operated on to achieve required co
3、mputational results. In this chapter we present the most common types of data found in digital computers and show how the various data types are represented in binary-coded form in computer registers.The data types found in the registers of digital computers may be classified as being one of the fol
4、lowing categories: (1)numbers used in arithmeticcomputations,(2)letters of the alphabet used in data processing, and (3)otherdiscrete symbols used for specific purposed. All types of data, except binary numbers, are represented in computer registers in binary-coded form. This is because registers ar
5、e made up of flip-flops and flip-flops are two-state devices that can store only 1s and 0s. The binary number system is the most natural system to use in a digital computer. But sometimes it is convenient to employ different number systems, especially the decimal number system, since it is used by p
6、eople to perform arithmetic computations.Number SystemsA numbersystem of base, or radix, r is a system that uses distinct symbols for r digits. Numbers are representeed by a string of digit symbols. To determine the quantity that the number represents, it is necessary to multiply each digit by an in
7、teger power of r and then form the sum of all weighted digits. For example, the decimal number system in everyday use employs the radix 10system. The 10 symbols are 0,1,2,3,4,5,6,7,8,and 9. The string of digits 724.5 is interpreted to represent the quantity. 7102+2101+4100+510-1that is, 7 hundreds,
8、plus 2 tens, plus 4 units, plus 5 tenths. Every decimal number can be similarly interpreted to find the quantity it represents.The binary number system uses the radix 2. The two digit symbols used are 0 and 1. The string of digits 101101 is interpreted to represent the quantity 125+024+123+122+021+1
9、20 = 45To distinguish between different radix numbers, the digits will be enclosed in parentheses and the radix of the number inserted as a subscript. For example, to show the equality between decimal and binary forty-five we will write (101101)2 =(45)10Besides the decimal and binary number systems,
10、 the octal (radix 8) and hexadecimal (radix 16) are important in digital computer work. The eight symbols of the octal system are 0,1,2,3,4,5,6, and 7. The 16 symbols of the hexadecimal system are 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E, and F. The last six symbols are, unfortunately, identical to the letters
11、 of the alphabet and can cause confusion at times. However, this is the convention that has been adopted. When used to represent hexadecimal digits, the symbols A,B,C,D,E,F correspond to the decimal numbers 10,11,12,13,14,15,respectively.A number in radix r can be converted to the familiar decimal s
12、ystem by forming the sum of the weighted digits. For example, octal 736.4 is converted to decimal as follows: (736.4)8 =782+381+680+48-1 =764+38+61+4/8 = (478.5)10The equivalent decimal number of hexadecimal F3 is obtained from the following calculation: (F3)16 = F16+3 = 1516+3 = (243)10Conversion f
13、rom decimal to its equivalent representation in the radix r system is carried out by separating the number into its integer and fraction parts and converting each part separately. The conversion of a decimal integer into a base r representation is done by successive divisions by r and accumulation o
14、f the remainders. The conversion of a decimal fraction to radix r representation is accomplished by successive multiplications by r and accumulation of the integer digits so obtained. Figure 2-1 demonstrates these procedures.The conversion of decimal 41.6875 into binary is done by first separating t
15、he number into its integer part 41 and fraction part .6875. The integer part is converted by dividing 41 by r=2 to give an integer quotient of 20 and a remainder of 1. The quotient is again divided by 2 to give a new quotient and remainder. This process is repeated until the integer quotient becomes
16、 0. The coefficients of the binary number are obtained from the remainders with the first remainder giving the low-order bit of the converted binary number.The fraction part is converted by multiplying it by r=2 to give an integer and a fraction. The new fraction (without the integer) is multiplied
17、again by 2 to give a new integer and a new fraction. This process is repeated until the fraction part becomes zero or until the number of digits obtained gives the required accuracy. The coefficients of the binary fraction are obtained from the integer digits with the first integer computed being th
18、e digit to be placed next to the binary point. Finally, the two parts are combined to give the total required conversion.Octal and Hexadecimal NumbersThe conversion from and to binary, octal, and hexadecimal representation plays and important part in digital computers. Since 23=8 and 24=16, each oct
19、al digit corresponds to three binary digits and each hexadecimal digit corresponds to four binary digits. The conversion from binary to octal is easily accomplished by partitioning the binary number into groups of three bits each. The corresponding octal digit is then assigned to each group of bits
20、and the string of digits so obtained gives the octal equivalent of the binary number. Consider, for example, a 16-bit register. Physically, one may think of the register as composed of 16 binary storage cells, with each cell capable of holding either a 1 or a 0. Suppose that the bit configuration st
21、ored in the register is as shown in fig. 2-2. Since a binary number consists of a string of 1s and 0s, the 16-bit register can be used to store any binary number from 0 to 216-1. For the particular example shown, the binary number stored in the register is the equivalent of decimal 44899. Starting f
22、rom the low-order bit, we partition the register into groups of three bits each (the sixteenth bit remains in a group by itself). Each group of three bits is assigned its octal equivalent and placed on top of the register. The string of octal digits so obtained represents the octal equivalent of the
23、 binary number.Conversion from binary to hexadecimal is similar except that the bits are divided into groups of four. The corresponding hexadecimal digit for each group of four bits is written as shown below the register of Fig. 2-2. The string of hexadecimal digits so obtained represents the hexade
24、cimal equivalent of the binary number. The corresponding octal digit for each group of three bits is easily remembered after studying the first eight entries listed in table 2-1. The correspondence between a hexadecimal digit and its equivalent 4-bit code can be found in the first 16 entries of Tabl
25、e 2-2.Table 2-1 lists a few octal numbers and their representation in registers in binary-coded form. The binary code is obtained by the procedure explained above. Each octal digit is assigned a 3-bit code as specified by the entries of the first eight digits in the table. Similarly, Table 2-2 lists
26、 a few hexadecimal numbers and their representation in registers in binary-coded form. Here the binary code is obtained by assigning to each hexadecimal digit the 4-bit code listed in the first 16 entries of the table.Comparing the binary-coded octal and hexadecimal numbers with their binary number
27、equivalent we find that the bit combination in all three representations is exactly the same. For example, decimal 99, when converted to binary, becomes 1100011. The binary-coded octal equivalent of decimal 99 is 001 100 011 and the binary-coded hexadecimal of decimal 99 is 0110 0011. If we neglect
28、the leading zeros in these three binary representations, we find that their bit combination is identical. This should be so because of the straightforward conversion that exists between binary numbers and octal or hexadecimal. The point of all this is that a string of 1s and 0s stored in a register
29、could represent a binary number, but this same string of bits may be interpreted as holding an octal number in binary-coded form (if we divide the bits in groups of three) or as holding a hexadecimal number in binary-coded form (if we divide the bits in groups of four).The registers in a digital com
30、puter contain many bits. Specifying the content of registers by their binary values will require a long string of binary digits. It is more convenient to specify content of registers by their octal or hexadecimal equivalent. The number of digits is reduced by one-third in the octal designation and b
31、y one-fourth in the hexadecimal designation. For example, the binary number 1111 1111 1111 has 12 digits. It can be expressed in octals as 7777(four digits) or in hexadecimal as FFF (three digits). Computer manuals invariably choose either the octal or the hexadecimal designation for specifying cont
32、ents of registers.Decimal representationThe binary number system is the most natural system for a computer, but people are accustomed to the decimal system. One way to solve this conflict is to convert all input decimal numbers into binary numbers, let the computer perform all arithmetic operations in binary and then convert the binary results back to decimal for the human user to understand. However, it is also possible for the computer to perform arithmetic operations directly with decimal numbers provided they are placed in registers in a coded form
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1