CS 216 System Programming Languages

Assignment 2

Due as specified on course webpage

Your name:
  1. Here is a signed number. Is it negative? Yes No Is it odd? Yes No

    Take its 2's complement, then tell me what the original number is (in decimal.)
    	0 x f f f f f c 6 e
        
    Hexadec:
    Decimal:

  2. Add these signed numbers, then convert the answers to decimal. (Hint: should not be very large numbers.)

    	0 x f e a 7 5 3 2 a			0 x 7 8 9 5 b c 9 d
    0 x 0 1 5 8 b 1 1 c 0 x 8 7 6 a 4 1 2 5 Hex: Dec:
  3. Here is a machine instruction involving the 3 registers $t1, $t5, $t7. Convert from hex to binary, then divide it into fields of 6,5,5,5,5, and 6 bits.  Please locate the 3 registers in the binary instruction.

    			0 x 0 1 a 9 7 8 2 0
        
    Binary fields:
    Registers:

  4. Using the tables on page 61, try to determine what instruction it is.  Hint: consider the two 6-bit fields.

    Answer:    

  5. Again using page 61, convert this assembly instruction to binary, and then hex.
    Hints: $t3 is the "destination," rt. 12 will be represented as a 16-bit number.
    	lw $t3, 12($t0)
    In hexadecimal: