Reminders:

- 0x23 means hexadecimal 23 (= 2 * 16 + 3 = 35 decimal).
- hex A = decimal 10; B = 11; C = 12; D = 13; E = 14; F = 15
- hex A + 3 = decimal 10 + 3 = decimal 13 = hex D
- The range of unsigned integers that can be represented in 8 bits is 0 ... 255.
- The range of signed two's complement integers that can be represented in 8 bits is -128 ... 127.

Complete the following exercises:

- Calculate the following sums in hexadecimal and binary. Assume
the numbers represent
**8-bit unsigned integers**. Circle any result that has an overflow. Note whether the hex and binary sums represent the same number.

1 pt for each hex value; 1 pt for each binary value; 1 pt for identifying whether or not there was an overflow for each sum (12 pts total). - For the 4 numbers above (0x46, 0x74, 0x87, 0xE9):
4 pts each (12 pts total)
- Look at the binary representations and determine which represent different numbers when considered as 8-bit two's complement signed integers rather than unsigned integers? (How can you recognize them?)
- For each of the numbers whose value is different when considered as unsigned vs. 2's complement, calculate both decimal values.
- Which of the calculations above have operands or sums whose values depend on whether they represent unsigned or 2's complement numbers? Would you expect the results of the sums to be different if the numbers were treated as 2's complement?

- For all of the sums above that would be different if calculated
as 2's complement signed integers, re-calculate
assuming that notation. (You may do this in binary or hexadecimal.)
When does overflow occur? Is this the same as in problem (1) above?
Why or why not?

6 pts - Recalculate 1b (0x46+0xE9) using subtraction, treating 0x46 and 0xE9 as 2's
complement binary integers. In other words, calculate 0x46 - (-0xE9), in
binary. Then do the same calculation in hex. Both answers should match
your answer in 1b. (Tip: -0xE9 = 0x17. Verify this by comparing
it to the binary 2's complement value you calculated.)

2 pts

1a | Hex | Binary | |
---|---|---|---|

0x46 | 0100 0110 | ||

+ 0x74 | 0111 0100 | ||

1b | Hex | Binary | |

0x46 | |||

+ 0xE9 | |||

1c | Hex | Binary | |

0x87 | |||

+ 0x74 | |||

1d | Hex | Binary | |

0x87 | |||

+ 0xE9 | |||

1b as sub | Binary | Hex | |||
---|---|---|---|---|---|

binary for 0x46 | 0x46 | ||||

binary for - (-0xE9) | - 0x17 |
||||

- What is the floating point decimal value for 0xC1740000 if it represents a 32-bit floating point number? 3 pts
- What is the binary 32-bit floating point representation for -1609.5? 3 pts
- What is the 64-bit floating point representation for the same number (-1609.5)? 2 pts

- What is the decimal value for 0x24A60004 if it represents an unsigned integer? 3 pts
- What is the decimal value for 0x24A60004 if it represents a two's complement integer? 2 pts
- What is the floating point decimal value for 0x24A60004 if it represents a 32-bit floating point number? (You may leave your answer in decimal scientific notation and you may round it to 6 or so significant digits (i.e., you can ignore the rightmost 4 and treat it as 0x24A60000).) 3 pts
- What MIPS instruction is represented by the 32-bit number 0x24A60004? 4 pts