COS 335 Spring 2009
Assignment 2: Assembler Exercises #1
Due Thursday Feb 5
Exercises involving hex (binary) - decimal conversions are intended to be done with paper and pencil. You can easily check your work using Windows calculator in scientific mode.
1. Manually convert the following numbers from unsigned hex to decimal. Show your work.
a) 2009 b) FEED c) B3AC d) BB
2. Assuming 16-bit numbers, convert the numbers in question 1 from signed 2's complement hex to decimal. Also, for d) convert from 8 bit-signed 2's complement hex to decimal.
3. Manually convert the following numbers from decimal to unsigned 16-bit hex:
a) 2009 b) 41777 c) 999 d) 42
4. Negate the numbers in the last question and convert to 32 bit 2's complement hex. (For example, convert -2009 to 2's complement hex) This is easiest to do using the answers from 3 (almost trivial).
5. Assuming an 8-bit representation, list 4 pairs of bit strings whose binary interpretations as unsigned and 2's complement numbers have the following properties under 8-bit addition:
a) Both signed and unsigned addition are correct.
b) Signed addition is correct, but unsigned is not.
c) Unsigned addition is correct, but signed is not.
d) Neither signed nor unsigned addition are correct.
6. Decode the following IEEE 32-bit floating point numbers and ex-press them using conventional decimal notation. Show your work. There are no infinities, denormalized numbers, or NANs in the list.
a)C8800070 b)42280000 c)BE700000 d)45000000
7. Encode the following decimal numbers as IEEE 32-bit floating point numbers. Show your work and express the results in hex.
a) 100.875 b) 16777216.25 c) -0.03 d) -72637.0
8. Explain why it is that you can encode either 67108864 or 67108872 as an IEEE 32-bit float, but not 67108868.
9. Show what the bit string 1001 0111 represents assuming a) 8-bit unsigned, b) signed magnitude, c) one's complement, d) two's complement, e) bias-127
10. Show 8-bit binary bit strings representing the number -49 in a) 8-bit signed magnitude, b) two's complement, c) bias-127 and d) one's complement