Computer Sciences Dept.

CS/ECE 252 Introduction to Computer Engineering

Spring 2013 Section 1 & 2
Instructors Mark D. Hill and Guri Sohi
TAs Preeti Agarwal, Mona Jalal, Rebecca Lam, Pradip Vallathol

URLs: http://www.cs.wisc.edu/~markhill/cs252/Spring2013/ and http://www.cs.wisc.edu/~sohi/cs252/Spring2013/

Homework 2 [Due at lecture on Wed, Feb 6]

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)

  1. 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.
  2. 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.

  1. 00111 + 00110
    01101 = 13
    7 + 6 = 13
    No overflow
  2. 10111 - 11110
    11001 = -7
    (-9) - (-2) = -7
    No overflow
  3. 11000 - 00011
    10101 = -11
    (-8) - 3 = -11
    No overflow
  4. 10110 + 10011
    01001 = 9
    (-10) + (-13) = -23
    Overflow

Problem 4 (2 points)

Compute the followings:

  1. (10100 OR 01101) AND (NOT(10101))
    = 11101 AND 01010 = 01000
  2. (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.

  1. 23
    01 0111
  2. -33
    -33 < -32 (largest negative integer that can be represented 2's complement form using 6 bits)
    Therefore, cannot be represented.
  3. 32
    32 > 31 (largest positive integer that can be represented 2's complement form using 6 bits)
    Therefore, cannot be represented.
  4. -32
    10 0000

Problem 6 (2 points)

Perform the specified arithmentic operation for the following 2's complement binary numbers:

  1. 11001 + 1011
    11001 + 11011 = 10100
  2. 00111 - 010
    00111 - 00010 = 00111 + 11110 = 00101
Note:
  1. All numbers beginning with 1 are negative.
  2. Don't forget to sign-extend when required.

Problem 7 (4 points)

Write the decimal equivalents for the following IEEE floating point numbers.

  1. 1 01111110 01000000000000000000000
    (-1)1 x 2126-127 x (1.01)2 = -0.625
  2. 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

 
Computer Sciences | UW Home