| CompOrg Fall 2001 |
|   Assignment   |   Stuff you need to know   |   What and How to submit   |   Grading   |   Notes and Hints |
You must provide a MIPS subroutine that implements Booth's
Algorithm for multiplication of two 8-bit signed numbers. Your
subroutine cannot use any mult instructions, and it must
implement Booth's algorithm (multiplication via simple repeated
addition is not Booth's algorithm!).
Your subroutine must be named booth and will be passed
two 32-bit, signed integers, one in each of $a0 and
$a1. Your subroutine can assume that the numbers are in the
range -128 to +127 (you only need to do 8 bit multiplication).
You must return two values:
$v0: return the product (as a 32 bit signed
integer).$v1: return the number of addition or subtraction
operations that were necessary to compute the product. These
should only include the addition or subtraction operations that
operate on the multiplicand and partial product (don't include
any adds or subtracts you use for loop control).Your subroutine may not change any of the S registers
($S0, $S1, ...). Of course you may use
these, the idea is that when your subroutine returns,
the original values must be restored...
The MIPS instruction set, including the pseudoinstructions supported by SPIM. Appendix A of the text includes a reference.
Booth's Algorithm. Check out the course text and/or lecture notes.
How to write a MIPS subroutine. Your booth code
must be in a subroutine for us to test it.
You should submit your subroutine in a file by itself, do
not submit a main or any other test code! We will add our own main
(and it will test all possible combinations of inputs!) - all you need
to supply is a file that contains your booth
subroutine. Important!: Name your file booth.asm
Email your submission to comporg-submit@cs.rpi.edu with the subject line "HW5".
Assembly language is very hard to read! Make sure you provide lots of comments to help us.
Grades will be determine by:
Here is some code you can use to test your subroutine. Paste your booth subroutine at the bottom of this file and run it using SPIM.
|
Here is what the above program looks like when run (twice):