The solutions are now available here.

The exam is on Tuesday, 10/16, so you need some practice.

You will write your answers in a PLAIN TEXT file (.txt). Please do not submit a Word document, or PDF, or anything like that. Just a text file.


Numeric Representation

Try to do these without a calculator first. But you can use a calculator to check. Then, if you don’t get the right answer, try to figure out what you did wrong, or ask for help.

  1. Write the ranges of unsigned binary numbers with the following numbers of bits:
    • 4 bits
    • 8 bits
    • 11 bits
  2. Write the ranges of signed two’s complement binary numbers with the following numbers of bits:
    • 4 bits
    • 8 bits
    • 11 bits
  3. Convert these decimal numbers to binary.
    • 13
    • 58
    • 141
  4. Convert these unsigned binary numbers to decimal.
    • 01001001
    • 00011001
    • 10000000
  5. Convert these signed two’s complement binary numbers to decimal.
    • 01001001
    • 11111001
    • 10000000
  6. Write the binary representation of these signed two’s complement binary numbers, but extended to 16 bits.
    • 01001001
    • 11111001
    • 10000000
  7. Compute the following bitwise operations.
    • ~00111001
    • 11100110 & 01110001
    • 11100110 | 01110001
  8. I have a register which contains the value 0xE315DEAD. I use sw to store it to memory. Write the sequence of bytes that would be placed in memory if our computer is using:
    • Little-endian integers
    • Big-endian integers
  9. I have an array where each item is 16 bytes long. If I want to access the 7th item (that is, array[6]), how many bytes do I have to move forward from the beginning of the array?
  10. Let’s say t3 contains 44 and a1 contains 1054. For the instruction sb t3, (a1), explain what data is copied into what location.
  11. In MIPS, when you load a byte from memory into a register:
    • What happens to its value? (There are two options.)
    • Why do we do this?
  12. Encode the following integers as single-precision IEEE 754 floats, and write your answer as an 8-digit hexadecimal number. Do not treat them as 2’s complement, just use the sign given.
    • +1000111010
    • -1000111010
    • +1

Submitting

Make sure your file is named username_lab5.txt, like jfb42_lab5.txt.

Submit here.

Drag your asm file into your browser to upload. If you can see your file, you uploaded it correctly!

You can also re-upload if you made a mistake and need to fix it.