Vous êtes sur la page 1sur 2

ECE

171 Winter 2011 Homework 2 Solutions


1. [10] Assume each of the following binary numbers is a twos complement (radix complement) representation. Convert each to its decimal equivalent. a) 00011011 a) 2710 b) 11001101 b) 5110 c) 00101.011 c) 5.37510 d) 11011.011 d) 4.62510 e) 10001.101 e) 14.37510 2. [15] Write each of the following decimal numbers in binary signed magnitude (SM),ones complement (DRC diminished radix complement), and twos complement (RC radix complement) using a word size of 8 bits. a) 28 a) 00011100SM = 00011100DRC = 00011100RC b) 37 b) 00100101SM = 00100101DRC = 00100101RC c) 28 c) 10011100SM = 11100011DRC = 11100100RC d) 17 d) 10010001SM = 11101110DRC = 11101111RC e) 35 e) 10100011SM = 11011100DRC = 11011101RC 3. [10] Perform each of the following arithmetic operations in both decimal and twos complement. Use a word size of 8 bits for the twos complement representations. Use indirect subtraction by addition rather than subtraction for the subtraction problems. a) 12 + 7 a) 00001100 + 00000111 = 00010011 b) 11 + ( 3) b) 00001011 + 11111101 = 00001000 c) 20 (6) c) 11101100 + 00000110 = 11110010 4. [5] What is overflow? Its a condition that occurs when the result of an arithmetic operation cannot be represented in the number scheme begin used. 5. [5] How do you detect overflow when adding unsigned binary (UB) numbers? Theres a carry out of the MSB. 6. [5] How do you detect overflow when adding twos complement (radix complement) numbers? Two (equal) alternatives, only one required: (a) No overflow when adding positive and negative addends. Overflow when adding two positive or two negative numbers when the sign of the result doesnt agree with the sign of the addends. (b) Overflow when the carry into the MSB and the carry out of the MSB do not agree

7. [5] A 16-bit counter is used to keep track of seconds in a real-time control system. If the counter is used to hold the number of elapsed seconds since an event has occurred, how much time can be represented before the counter overflows and the result is erroneous? The largest unsigned 16-bit binary number is 216 1 = 65,535 seconds, or about 45.5 hours. 8. [5] Write the binary code and hexadecimal equivalent for the ASCII character M. 01001101 = 4D16. 9. [5] A block diagram for an analog to digital converter is shown below. The device converts an analog signal (a voltage) on its input into a binary number on its outputs. The resolution of the LSB, the full scale range of the input voltage (VFSR), and the number of bits (n) are related as follows: Resolution of LSB = VFSR/2n. How many bits are required if the full scale voltage range is 16V and the resolution of the LSB is 12mV?

12mV = 16V/2n 2n = 16V/12mV n = log2 1333.3 = 11 10. [15] What decimal number is represented by C251000016 assuming it represents a number in IEEE 754 floating point format? Show your work. C251000016 = 1100 0010 0101 0001 0000 0000 0000 0000 Separating into fields for Sign, Exponent, and Fractional Part 1 10000100 10100010000000000000000 Sign is 1, therefore number is negative Biased exponent (10000100) is 132, so exponent is 132 127 = 5

Adding J-bit, significand is 1.1010001 So number is 1.10100012 x 25 = 110100.012 = 52.2510 52.25 15 points:

3 points for correct conversion to binary 2 points for correct partition into IEEE 754 fields 1 point for correct interpretation of sign bit 3 points for correct interpretation of exponent (with bias) 3 points for correct interpretation of significand with J-bit 3 points for correct conversion to decimal number

Vous aimerez peut-être aussi