Binary Multiplier Applet

The nature of binary multiplication enables the use of a hardware device called a binary multiplier to produce the product of two binary numbers. When two binary digits are multiplied, if both digits are ones, the result is one. If one or both of the digits are zero, the result is zero. This result happens to be the same as the result of an AND operation or the output of an AND gate. AND gates can be combined with half-adders and full-adders to produce the product of two binary numbers.

This project is a Java applet which simulates a binary multiplier. Two binary numbers of selectable width are multiplied by the applet and the partial products and final result are displayed.

To use the applet, the desired width of the numbers to be multiplied is selected from a dropdown list. After the bit width is chosen, a flag is set enabling squares representing the bits of the multiplier and multiplicand to be drawn. When a user clicks on the squares, the corresponding elements of two arrays of boolean values are set to be either true or false. After the desired numbers have been set, the user clicks a button labeled multiply which causes the applet to call the multiply( ) method. In the multiply( ) method, each bit of the multiplier is ANDed with every bit of the multiplicand in a nested loop to find the partial products which are stored in a two dimensional array so they can be displayed after the final product is found. Each time a partial product is computed, it is added to the final product. After the final product is computed, a flag is set enabling the products to be drawn and the applet is repainted displaying the products. If the reset button is clicked, the reset( ) method is called and all of the elements of the multiplier and multiplicand, partial and final product and carry arrays are set to false. The flags which enable the multiply( ) method and disable the drawing of the products are set and the process may be repeated. The flags may also be reset by choosing the bit width again from the dropdown list.

Advisor: J. Dean Brock

Student Name: 
Richard Preston