Booth%27s Algorithm Calculator

This small project was an assignment for

  • Efficient Multiplication: Booth’s Algorithm Take advantage of circuits where shifting is cheaper than adding, or where space is at a premium. When multiplying by certain values (e.g. 99), it can be easier to think of this operation as a difference between two products.
  • Booth's Multiplication Algorithm. GitHub Gist: instantly share code, notes, and snippets.
CS 441 - Computer Architecture

Booth’s algorithm is a multiplication algorithm that multiplies two signed binary numbers in 2’s compliment notation.Booth used desk calculators that were faster at shifting than adding and created the algorithm to increase their speed. Booth’s algorithm is of interest in the study of computer architecture.

during Fall 2016 at UW Stout. I completed this project with Abby Peterson. We were allowed to use any programming language we wanted. Abby and I chose to use JavaScript and HTML/CSS because we wanted to get experience in a language we hadn't used in class.

Project Details

Booth 27s algorithm calculator online
  1. Write program to calculate 8-bit Booth's Multiplier
  2. Input in decimal
  3. Output in both binary and decimal
  4. Show all steps
  5. Choose any programming language you're comfortable with

The Process


Writing the actual Booth's algorithm was quick and easy. The vast majority of the code was formatting. I had some HTML/CSS experience from middle school, but neither Abby nor I had ever used JavaScript. Luckily, it's pretty easy to learn. CSS was pretty frustrating. I had forgotten how finicky it can seem when you aren't fluent in it.
Booth%27s Algorithm CalculatorBoothAlgorithmI planned on adding the ability to customize the number of bits (and I hate hard-coding data), so I made the number of bits a global variable and set it in cs441p1_submit(). This ended up being a life saver. I found out that the homework required a different number of bits than I had originally set. Rather than changing countless lines of code, I only changed the 'bit' variable.
We used the toString() and parseInt() functions a lot, because the made it super easy to translate from binary to decimal and vice versa.
Booth%27sOne improvement we could have made was using HTML5 tags, especially for the form input options.
Here is the final result:

Booth's Algorithm Calculator


Booth 27s Algorithm Calculator Free

View on GitHub