Calculator: Booth's Algorithm

This small project was an assignment for CS 441 - 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


  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.

I 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.

One improvement we could have made was using HTML5 tags, especially for the form input options.

Here is the final result:

View on GitHub

Popular Posts