CSE logo University of Washington Computer Science & Engineering
 CSE 410 Computer Systems - Homework 1 - Spring 2009
  CSE Home   About Us    Search    Contact Info 

Due: Thursday, April 9, at 11 pm.

The purpose of this assignment is to get some practice with binary encodings of numbers, character strings, and instructions. All numbers should be treated as positive, unsigned numbers. We'll have a chance to practice with signed (negative) numbers later.

General hint: When converting between binary and decimal, it may be faster to convert to/from hexadecimal first, rather than dealing with the individual bits one by one. However, you should know how to do the conversions either way (directly from binary, or via hex numbers).

Obviously, many of these questions can be answered trivially by typing numbers into a calculator and pushing a button. Please be sure you can do them without having to rely on that.

We suggest you show your work or partial results so if your answer isn't completely correct we can fairly assign partial credit.

  1. Convert each of the following base-10 (decimal) values to binary and hexadecimal.

    1. 1742
    2. 65535
    3. 65536
    4. 10
    5. 1011

  2. Convert the following binary numbers to hexadecimal and decimal.

    1. 0000 0000 0100 0000 1111 1101 1100 1101
    2. 0011 1111 1001 1111 0000 1000 0011 0101

  3. Convert the following hexadecimal numbers to binary and decimal

    1. 0xFACE
    2. 0x1CA2
    3. 0x1010111
    4. 0xDEADBEEF

  4. In C and C++, character strings are encoded using the ASCII character set, and an additional byte containing binary zero (all 0 bits) is stored after the characters in the string to indicate the end of the string. For example, the string "Foo" would be stored in 4 bytes with the hex value 0x466f6f00.

    Give the hex values corresponding to the following strings. (An ASCII conversion chart is located in sec. 2.9 of the textbook, and there are many copies on the web.)

    1. "Hi y'all!"
    2. "x+1=17."

  5. For each of the following MIPS assembly instructions, (i) show the binary encoding of the instruction word, and (ii) write the binary instruction word in hexadecimal. For the binary encodings, it would help if you use spaces or draw boxes to clearly show the different fields of the instructions (opcode, registers, etc.)

    1. addi $s1, $t3, 5
    2. addu $v0, $zero, $a3
    3. or $t0, $t9, $s2
    4. sw $s4, 80($fp)

Turn-in Instructions: Use the turn-in drop box link on the main course web page to submit a file containing your solutions. You can use any common file format, including plain text, word, or pdf. If you wish, you could also scan in a hand-written solution and submit that, but if you do that, please be sure your handwriting is neat and legible. Please be sure to include your name at the top of your answers.


CSE logo Computer Science & Engineering
University of Washington
Box 352350
Seattle, WA  98195-2350
(206) 543-1695 voice, (206) 543-2969 FAX
[comments to Hal Perkins]