Homework 2 (48 points total)

Printable Version

Show your work for full credit.

  1. (12 points) Convert numbers from the given integer representation to fill in the following table. Use 8 bits for all answers. Identify where an integer cannot be represented with the asterisk character (*).

    Sign Magnitude One's Complement Two's Complement Biased-127
    10011010   
     01101011  
      10000000 
       10100010


  2. (4 points) What is the IEEE single precision floating point representation for the decimal value 18.7291? Show intermediate steps for partial credit.

  3. (2 points) Give a (brief) decription of what the following SAL program does.
    		           .data
    		aaa:       .word   1000
    		bbb:       .word   0
    		ccc:       .word   0
    		newline:   .byte   '\n'
    		str:       .asciiz "The answer is "
    		
    		           .text
    		__start:
    		loop_top:  beq  bbb, aaa, loop_end
    		           add  bbb, bbb, 1
    		           add  ccc, ccc, bbb
    		           b    loop_top
    		loop_end:  puts str
    		           put  ccc
    	 	           put  newline
    		done
    		
  4. (8 points) Assume that a memory read or write operation takes 12 nsec (nanoseconds), and processor operations like decode or add take 3 nsec. Show your work in computing how long it takes to execute the following SAL code sequence.
            sub  z, x, y
            add  a, z, y
    
  5. (3 points) Labels, addresses, and contents at those addresses are given by the following table.
    label   address   contents
    --------------------------
     v1       15        20
     v2       16        17
     v3       17        -2
     v4       18        -3
    
    Give this complete table, with any changes, after the following SAL code fragment is executed.
            la   v2, v4
            mov  v1, v4
    
  6. (2 points) Interpreting 0xC4FB4000 in IEEE single precision, what is the decimal value and the 32-bit binary representation (containing a sign bit, 8-bit exponent field and 23-bit significand)?
  7. (2 points) What message is contained in the following hexadecimal digits if interpreted as an ASCII string?

    48 65 6c 70 21 20 49 27 6d 20 74 72 61 70 70 65 64 20
    69 6e 73 69 64 65 20 61 20 63 6f 6d 70 75 74 65 72 21

  8. (4 points) Do the following sign magnitude arithmetic. If the result does not fit in 8 bits, write the word OVERFLOW.
     01100011
    +10001101
     --------
    
     10000111
    -11001101
     --------
    
  9. (4 points)Do the following two's complement arithmetic. If the result does not fit in 8 bits, write the word OVERFLOW.
     11110011
    +10011101
     --------
    
     10000111 
    -11001101 
     -------- 
    
  10. (3 points) Do the following 8-bit two's complement multiplication. Give a 16-bit result.
    
              10100111
          x   11101101
          -------------
    
    
  11. (4 points) Show the following unsigned binary division.
    Identify both the quotient and the remaider.
              101011 / 0100 
    

Handing In the Homework

Turn in your file containing your answers by running the handin script. For information on running the script, look at the instructions.
You can ls the directory where your files for this assignment will be stored:

~cs354-1/handin/username/HW2

where HW2 is the name of the directory where you will submit this assignment. The path information allows you to review your submissions.

Now copy your file to the handin directory.
cp hw2.txt ~cs354-1/handin/username/HW2/.

No printout will be turned in.