I expect you to do this lab in teams of two; please form your own team of two. If you are having trouble finding a partner, see me. Include both partners' names when you email me your submission.
Your lab write up can be short and sweet, but it should be English. Specific details I will expect to see are the two programs you are asked to write and information on your testing of each program. The testing information can consist of a careful description of the testing and/or actual test data and results.
Make sure your testing is systematic and thorough. Thorough doesn't mean using large quantities of weird numbers that still only test the same cases; rather, it means using carefully chosen tests to ensure that all cases are covered and all likely bugs exposed, while still allowing the answers to easily be hand-checked.
Be sure to write your program for human readability. That is, use easily understood labels, leave blank lines between blocks of code, and if the higher-level purpose served by a block of instructions is not clear, include an explanatory comment. Also, avoid excessive duplication of code.
If you include a procedure in your program, that procedure should follow the convention regarding what registers it must preserve. The code that calls the procedure should not rely on the values left in other registers. Also, you should use only the standard registers for conveying information into a procedure (arguments in $a registers) or out of a procedure (values in $v registers).
You will do this lab on one of the computers in OHS 326, running OS X. You will use
MARS as demonstrated in class.
You can click on the Mars.jar icon in the Applications folder; it looks like this:
Be sure that each program exits at the end by putting 10 in
register $v0
and then executing a syscall
instruction.
add
instruction, doing one addition after each input is read in.
add
instruction.
Do not add all three numbers and then subtract off the smallest, since
that might fail if the addition of all three causes an overflow but the
addition of just the largest two doesn't.
However, you may none the less find
it useful to think about identifying which one number is the
smallest, rather than about identifying which two numbers are the
largest.
$sp
and
$zero
. Any other values you observe in MARS are just
luck, and shouldn't be counted on.