Primary contact for this homework: Pradip Vallathol [pradip16 at cs dot wisc dot edu]
You must do this homework in groups of two. Please write the full name and the student id of each member on every page and staple multiple pages together.
Problem 1 (4 points)
-
Assume that 453 scientists have been invited to attend a conference. If every scientist is to be assigned
a unique bit pattern, what is the minimum number of bits required to do this?
453 < 512 (29). So 9 bits.
-
How many more scientists can be invited to the conference, without requiring additional bits for each
person's unique id?
512 - 453 = 59
Problem 2 (8 points)
Using 7 bits to represent each number, write the representations of 25, -25 and 0 in signed magnitude,
1's complement and 2's complement notations.
Number | Sign-Magnitude | 1's Complement | 2's Complement |
25 | 001 1001 | 001 1001 | 001 1001 |
-25 | 101 1001 | 110 0110 | 110 0111 |
0 | 000 0000 OR 100 0000 | 000 0000 OR 111 1111 | 000 0000 |
Problem 3 (4 points)
The following binary numbers are 5-bit 2's complement binary numbers. Which of the
following operations generate overflow? Justify your answers by translating the operands
and results into decimal.
-
00111 + 00110
01101 = 13
7 + 6 = 13
No overflow
-
10111 - 11110
11001 = -7
(-9) - (-2) = -7
No overflow
-
11000 - 00011
10101 = -11
(-8) - 3 = -11
No overflow
-
10110 + 10011
01001 = 9
(-10) + (-13) = -23
Overflow
Problem 4 (2 points)
Compute the followings:
-
(10100 OR 01101) AND (NOT(10101))
= 11101 AND 01010 = 01000
-
(10101 OR 00100) AND (NOT(00101) OR 01010)
= 10101 AND 11010 = 10000
Problem 5 (4 points)
Convert the following decimal numbers into 6-bit 2's complement binary numbers. Explain any
problem that you encounter for these conversions.
-
23
01 0111
-
-33
-33 < -32 (largest negative integer that can be represented 2's complement form using 6 bits)
Therefore, cannot be represented.
-
32
32 > 31 (largest positive integer that can be represented 2's complement form using 6 bits)
Therefore, cannot be represented.
-
-32
10 0000
Problem 6 (2 points)
Perform the specified arithmentic operation for the following 2's complement binary numbers:
-
11001 + 1011
11001 + 11011 = 10100
-
00111 - 010
00111 - 00010 = 00111 + 11110 = 00101
Note:
- All numbers beginning with 1 are negative.
- Don't forget to sign-extend when required.
Problem 7 (4 points)
Write the decimal equivalents for the following IEEE floating point numbers.
-
1 01111110 01000000000000000000000
(-1)1 x 2126-127 x (1.01)2 = -0.625
-
0 10000001 10100000000000000000000
(-1)0 x 2129-127 x (1.101)2 = 6.5
Problem 8 (2 points)
Write the IEEE floating point representation of the decimal number 2.50.
(2.5)10 = (10.1)2 = (1.01)2 x 21 = (-1)0 x 2(128-127) x (1.01)2
0 10000000 01000000000000000000000