Fall Semester 2005: September 8, 2005 - December 12, 2005
Out on:
October 3, 2005
Due by:
October 9, 2005 by 5:59 pm for full credit (11:59 pm for 10% off, hard deadline)
Collaboration:
None
Grading:
Packaging 10%, Style 20%, Functionality 70%
The third assignment for 600.102: Foundations of Computer Science covers material from Weeks 3 and 4 and the corresponding reading. This is the first assignment involving actual programming and there are new rules about how to turn in the assignment!
Write a MIPS program odd_even.s that reads an
integer from the user and determines whether the integer is
odd or even.
It prints That's odd! for odd integers and
We're even! for even integers.
Try to find the shortest, most efficient way to determine
"oddness" or "evenness".
If you need the div instruction, you have not
found it yet.
Write a MIPS program on_average.s that reads a
sequence of positive integers from the user, stopping at the
first negative one.
Your program should print the integer average of all positive
integers that were entered.
Be very careful about the corner cases for this
one, an error message might be needed at some point...
Write a MIPS program square_root.s that reads a
positive integer from the user and prints the integer square
root of that number.
You are free to choose whatever algorithm you think is appropriate,
however I would recommend that you simply keep squaring numbers
starting from 1 until you either hit the number whose root we
want or exceed it.
Of course the details are up to you, so feel free to do something
different.
Try to sketch or otherwise explain the circuits inside the
control unit of our SCRAM machine that implement the
LDI instruction.
The answer for this problem should go into your README
file.
Please turn in a
gzip
compressed
tarball
of your assignment (the extension should be .tar.gz).
The tarball should uncompress into a directory
cs102-assignment-3-login
with login replaced by your Unix login name
(so I would use cs102-assignment-3-phf);
uncompressing should not create any other files
in the current directory.
Include a README file that briefly explains what your
programs do and contains any other notes you want us to check out
before grading (and of course your answers to "written" problems).
This file should be a plain Unix text file (not M$ Word, not PDF);
it should be formatted in a decent way and it should contain your
contact information.
For reference, here is a short explanation of the grading criteria.
Packaging refers to the proper organization of the
stuff you hand in, following the guidelines for Deliverables above.
Style refers to programming style, including
things like consistent indentation, appropriate identifiers,
useful comments, etc.
Simple, clean, readable code is what you should be aiming for.
Functionality refers to your programs being
able to do what they should according to the specification
given above; if the specification is ambiguous and you had
to make a certain choice, defend that choice in your
README file.
If your programs do not run on SPIM because of syntax errors you will get no points whatsoever. If your programs fail miserably, i.e. terminate with an exception of any kind, we will take off 10%.
If you really want to impress us, try the following. Explain in your own words why the good old 6502 processor has "undocumented opcodes"? How did they get in there? How did people find out about them? Was it (or is it) a good idea to use any of them? Note that we won't give you extra points for this, but we'll give you extra kudos. :-)