CS351 Assembler and Architecture Homework 1 (Due 11AM, 1/27/2005)

Justify your answers (i.e., show how you derived the answers) and submit your justification as well - you will not get credits by giving answers only.

(50 points)

  1. (3pts) Problem 3.b of Chapter 1
  2. (3pts) Problem 4.c of Chapter 1
  3. (12pts) Problem 7 of Chapter 1.
  4. (6pts) (a) Problem 11.e of Chapter 1.
    (b) Repeat 11.h in signed and magnitude form, instead of in 2's compliment form.
  5. (6pts) Convert the following binary number to its decimal, hexadecimal and octal equivalents, respectively.

  6. 1011001.01101
  7. (6pts) Convert the following hexadecimal number to its binary, octal, and decimal equivalents, respectively.

  8. 1FC.B
  9. (4pts) Perform binary subtractions in 8-bit 2's complement arithmetic using addition.  That is, you have to negate the second number, and then add the two numbers.  Indicate whether arithmetic overflow occurs or not and explain why.

  10. (-66) - (+41)
  11. (4pts) Convert the decimal number -50.625 into the IEEE format for floating point numbers. Give your answer in the hexadecimal representation.
  12. (6pts) If I tell you that I can obtain a negative number by adding 1 to a positive number.  You probably don't buy it.  So, I am showing you the following code segment 
    and asking you to write a program in Java that includes the code segment and then prints out j's value.  Implement and run the program to answer the following questions:
    1. What value is printed out?
    2. Mathematically show how the answer is obtained.
    3. After figuring out what's going on, show me that you can obtain a positive number by subtracting 2 from a negative number.
    4.  

Extra credits (5pts)

Investigate how NaN, +infinity, and -infinity are respectively represented in Java.  That is, find the bit patterns that represent those values respectively.  Compare your result to what's studied in the class.