Homework I Solutions: 1.1 List the octal and hexadecimal numbers from 16 to 32. Using A, B, and C for the last three digits, list the numbers from 8 to 28 in base 13. Decimal 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 Octal 20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37 40 Hexadecimal 10 11 12 13 14 15 16 17 18 19 1A 1A 1C 1D 1E 1F 20 Decimal Base 13 1.4 8 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 9 A B C 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 20 21 22 What is the largest binary number that can be expressed with 14 bits? What are the equivalent decimal and hexadecimal numbers? 14-bit binary: 11 1111 1111 1111 Decimal: 214 -1 = (16,383)10 Hexadecimal: (3FFF)16 1.8 Convert the decimal number 431 to binary in two ways: (a) Convert directly to binary; (b) convert first to hexadecimal and then from hexadecimal to binary. Which method is faster? (431)10 = (110101111)2 = (1AF)16 Conversion from decimal to hexadecimal is faster than conversion from decimal to binary. Quotients Remainders 431/2 215 1 LSB 215/2 107 1 107/2 53 1 53/2 26 1 26/2 13 0 13/2 6 1 6/2 3 0 3/2 1 1 1/2 0 1 MSB 431/16 26 15 (F) LSD 26/16 1 10 (A) 1/16 0 1 MSD 1.10 Convert the following binary numbers to hexadecimal and to decimal: (a) 1.10010, (b) 110.010. Explain why the decimal answer in (b) is 4 times that in (a). (a) 1.100102 = 0001.10012 = 1.916 = 1 + 9/16 = 1.56310 (b) 110.0102 = 0110.01002 = 6.416 = 6 + 4/16 = 6.2510 Reason: 110.0102 is the same as 1.100102 shifted to the left by two places. 1.11 Perform the following division in binary: 111011 ÷ 10l. 111011.0000 101 101 1011.110011 01001 101 1001 101 1000 101 0110 101 001000 101 0110 101 1 1.15 Find the 9's and the 10's complement of the following decimal numbers: (a) 52,784,630 (c) 25,000,000 (b) 63,325,000 (d) 00,00,000 (a) 52,784,630 9’s comp: 47,215,369 10’s comp: 47,215,370 (b) 63,325,600 9s comp: 36,674,399 10s comp: 36,674,400 (c) 25,000,000 9’s comp: 74,999,999 10s comp: 75,000,000 (d) 00,000,000 9s comp: 99,999,999 10s comp: 00,000,000 1.18 Perform subtraction on the given unsigned binary numbers using the 2's complement of the subtrahend. Where the result should be negative, find its 2's complement and affix a minus sign. (a) 10011 - 10001 (b) 100010 - 100011 (c) 1001 - 101000 (a) 10011 -10001 ------- (d) 110000 – 10101 (b) 10011 2’s comp. 01111 ----Result 100010 100010 100010 -100011 2’s comp. 011101 ------------111111 Æ-(000001) (c) 001001 001001 -101000 2’s comp: 011000 -----------100001 Æ -(011111) (d) 110000 110000 -010101 2’s comp: 101011 -----------1011011 1.25 Represent the decimal number 5,137 in (a) BCD, (b) excess-3 code, (c) 2421 code, and (d) a 6311 code. (a) 5,13710 (b) (c) (d) BCD: 0101_0001_0011_0111 Excess-3: 1000_0100_0110_1010 2421: 1011_0001_0011_0111 6311: 0111_0001_0100_1001 1.30 The following is a string of ASCII characters whose bit patterns have been converted into hexadecimal for compactness; 73 F4 E5 76 E5 4A EF 62 73. Of the eight bits in each pair of digits, the leftmost is a parity bit. The remaining bits are the ASCII code. (a) Convert the string to bit form and decode the ASCII. (b) Determine the parity used: odd or even. 73 F4 E5 76 E5 4A EF 62 73 73: 0_111_0011 s F4: 1_111_0100 t E5: 1_110_0101 e 76: 0_111_0110 v E5: 1_110_0101 e 4A: 0_100_1010 j EF: 1_110_1111 o 62: 0_110_0010 b 73: 0_111_0011 s Odd parity is used. 1.35 By means of a timing diagram similar to Fig. 1.5, show the signals of the outputs f and g in Fig.P1.35 as functions of the three inputs a, b, and c. Use all eight possible combinations of a, b, and c. a b c f g a 0 1 0 1 0 1 0 1 0 1 0 1 b 0 0 1 1 0 0 1 1 0 0 1 1 c 0 0 0 0 1 1 1 1 0 0 0 0 f 1 1 1 1 1 1 1 0 1 1 1 1 g 1 0 0 0 0 0 0 0 1 0 0 0