University of Wisconsin Computer Sciences Header Map (repeated with 
textual links if page includes departmental footer) Useful Resources Research at UW-Madison CS Dept UW-Madison CS Undergraduate Program UW-Madison CS Graduate Program UW-Madison CS People Useful Information Current Seminars in the CS Department Search Our Site UW-Madison CS Computer Systems Laboratory UW-Madison Computer Sciences Department Home Page UW-Madison Home Page

Homework 2

CS/ECE 354, Fall 2003


Send e-mail questions to Eric Robinson, erobinso@cs.wisc.edu
Due Wednesday, October 1, before 5pm.


Homework (60 points total)

  1. (8 points) For each of the following 7-bit representations, identify the decimal value being represented presuming the given type of integer representation.

    A. 1010011, unsigned
    B. 1100110, sign magnitude
    C. 1101110, two's complement
    D. 1000100, biased-63

  2. (12 points) Fill in the following table with 8-bit representations, keeping the same value represented across each line of the table. If the representation cannot fit into 8 bits, place the character '*' in the table entry.
    unsigned    sign        two's        biased-127 
                magnitude   complement
    ------------------------------------------------
     01010100
    ------------------------------------------------
                10111110
    ------------------------------------------------
                            10111110
    ------------------------------------------------
                                          11001001
    ------------------------------------------------
    
  3. (6 points) For the value 0xf8780000,
    A. If this represents a two's complement integer, what decimal value is being represented?
    B. If this represents an IEEE single precision floating point number, what decimal value is being represented?

  4. (4 points) For the value 0x57286e29,
    if this represents a string of four characters, what string is being represented?

  5. PART A (4 points) Show your work in doing the following sign magnitude arithmetic. If the result cannot fit in 8 bits, write the word OVERFLOW.
              01100111
          +   10010101
          -------------
             
    
              10010111
          -   11001010
          -------------
    
    
    PART B (4 points) Show your work in doing the following two's complement arithmetic. If the result cannot fit in 8 bits, write the 8-bit result and the word OVERFLOW.
              11101011
          +   10111001
          -------------
             
    
              01010111
          -   11001010
          -------------
    
    


  6. (5 points) Do the following 8-bit two's complement multiplication, giving a 16-bit result. Show your work.
              10010101
          x   11110111
          -------------
    
    


  7. (5 points) Do the following unsigned binary division. Identify both the quotient and the remainder. Show your work.
    1010010 / 0110 
    
    
    
  8. (12 points) Give values (in hexadecimal) for variables x, y, and z, after EACH of the following instructions in the SAL code fragment is executed.
    
    .data
    x:     .word  0x01234567
    y:     .word  0xffff0000
    z:     .word  0x99995555
    .text
           sll   y, y, 12
           nand  y, y, x
           xor   z, z, x
           sra   z, z, 8
    
    

Handing In the Homework

Turn in your file containing answers by running the script:


  handinHW2 hw2file

where hw2file is an example name of a file containing the homework answers. The handinHW script submits your homework for you. No printout will be turned in. (We assume that you have put /p/course/cs354-common/public/bin in your path by now.)