This assignment uses several files that I have checked into your assn2 git respository. Do a "`git pull`" in your work directory to get a copy of these files.

In the unsigned-multiply.cpp file in your assn2 directory, implement the standard algorithm for multiplication of two 32-bit unsigned integers, as described by the diagram. You can use 32 or 64-bit intermediate values as indicated in the figure, but can only use basic ALU operations (addition, logic operations and shifts), and one loop over the bits of the multiplier. To use force a 64-bit addition, convert both operands to uint64_t using static_cast

For up to 10 points of extra credit, implement the enhanced version of this algorithm, using just one combined 64-bit product/multiplier register and only a 32-bit add (in C/C++, you ensure this by making sure both operands and the result of your add are uint32_t

In the signed-multiply.cpp file in your assn2 directory, implement Booth's algorithm for multiplication of two signed 32-bit integers, as described by the diagram. You can use 32 or 64-bit intermediate values as indicated in the figure, but can only use basic ALU operations (addition, subtraction, logic operations and shifts), and one loop over the bits of the multiplier. To force a 32-bit on just the top 32 bits of a 64-bit number, you can use the intComponents union defined in the included `bittypes.h`. This union allows access to the same data, either as a 64-bit int, or as two 32-bit ints. It is OK to assume a little-endian Inel processor.

In the float-multiply.cpp file in your assn2 directory, implement the multiplication of two floating point numbers using only integer operations. In the simple case, you will need to extract the sign bit, reconstruct the exponent and mantissa. Then multiply the mantissas and add the exponents. Finally, pack back into binary single precision floating point form. Be sure to handle, as input or output, denormalized numbers, infinity, and NaN. You can enter infinity by typing "`inf`" for one of the numbers, and NaN by tying "`nan`". This table may help for infinity and not a number handling:

+ | – | inf | -inf | NaN | |

+ | +/inf | –/-inf | inf | -inf | NaN |

– | –/-inf | +/inf | -inf | inf | NaN |

inf | inf | -inf | inf | -inf | NaN |

-inf | -inf | inf | -inf | inf | NaN |

NaN | NaN | NaN | NaN | NaN | NaN |

In the float-add.cpp file in your assn2 directory, implement the addition of two floating point numbers using only integer operations. Much of this code will be similar to that for the floating point multiply, but for the actual addition, you will need to align to the larger exponent before you add. Infinity and not a number behavior is as follows:

+ | – | inf | -inf | NaN | |

+ | +/inf | +/– | inf | -inf | NaN |

– | +/– | –/-inf | inf | -inf | NaN |

inf | inf | inf | inf | NaN | NaN |

-inf | -inf | -inf | NaN | -inf | NaN |

NaN | NaN | NaN | NaN | NaN | NaN |

All electronic submissions in this class will be done using the git version control system. You should look at the class git instructions **before** you start work. To get full credit for your submission, you should (1) check out a copy of the empty hw1 directory before you start, (2) do your work in that checked out copy, (3) submit several intermediate checkins with short but useful messages, and (4) check in your final submission before class starts on the day of the deadline.

Include a short file named "readme.txt" that describes how to build and run your program, as well as a description of any known problems or bugs. Bugs you identify in your readme will lose only half points. Bugs you don't identify that are found during grading will lose full points.