### Before you start

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.

### ALU Logic Design

You will receive an invitation for CircuitVerse, a site that allows you to build and test digital logic circuits. You can log in using your UMBC google account. After you have logged into the site, under your name, choose "My groups" to find the "UMBC-CMSC411-03" group. In that group, you will find the Ripple Carry ALU assignment.

You will be implementing a 4-bit ALU capable of addition, subtraction, and, or, or xor, depending on control signals that you will define. The circuit will be submitted through CircuitVerse, but tell us in the readme in your hw2 repository directory what control signal values are necessary for each of those five modes.

Start by creating a "New Circuit" named ALU. In this tab, implement a 1-bit ripple-carry ALU with data inputs A, B, and C, any necessary control inputs, and outputs Cout and Rout. You can use as many digital logic gates (and/or/xor/nand/nor/not) or multiplexers as you want, but no other logic elements. Use the 1-bit "Input" node for inputs and "Output" node for outputs.

In the main tab, create a 4-bit ALU from four of your 1-bit ALU blocks. For input, use 4-bit "ConstantVal" nodes for A and B, and "Input" nodes for any control signals. You can split a 4-bit value into its four component bits with the "Splitter" node in the "Misc" category, using 4 for the bitWidth and "1 1 1 1" for the split. For output, re-combine the four output bits back into a 4-bit number with another Splitter (configured the same way, though you may want to flip the direction in the node properties), then feed the 4-bit result into a HexDisplay node.

### Floating point multiply

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. In the table, + means some finite positive number, - means some finite negative number, inf and -inf are positive or negative infinity, and NaN is not a number. The interior of the table gives possible results. So the first table cell says that multiplying a finite positive number by a finite positive number could result in another finite positive number, or could result in positive infinity (if it overflows the representable range for floats)

+ | – | 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 |

### Floating point add

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 |

### Submitting

To get full credit for your submission, you should (1) pull changes to your local repository before you start, (2) do your work in the hw2 directory, (3) submit several intermediate commits with short but useful messages, and (4) commit and push 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 programs, 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.