CS 220 - MIPS Homework 1

Write a MIPS program that adds all of the positive integers below 1000 that are multiples of 3 or 5. The answer should be in register $t0 when the program completes. For example, if I asked to add up the numbers below 10 that are multiples of 3 or 5 the answer would be $3 + 5 + 6 + 9 = 23$ with $23$ being the value in $t0. Remember, the value will display in SPIM in hexadecimal.

Write the Java or Python version of this program first and then translate that to the MIPS.

Your program will be graded out of ten points based on the following requirements.

Requirements

  1. Turn in a printout of your program at the start of class on Thursday, February 9.
  2. Email me a copy of your program as an attachment and make sure that the name of the file is username_hw1.s where username is your user name. Make sure the subject heading says CS220 HW 1
  3. Your program should compute the correct answer in $t0. The correct answer is 233,168ten
  4. Your program should be neat and tidy. Make sure that there are no bad line breaks, lines that wrap around, etc. Make sure that indentation is consistent and that tab characters don't make the printout look messy.
  5. There should be a nice block comment at the top that has you name, the date, the homework assignment number (this is HW1). For example
          #--------------------------------------------------------
          # Name: Ed Harcourt
          # Date: 2/1/12
          # Assignment: HW 1
          #
          #    This program computes the sum of the numbers below
          #    1000 that are divisible by 3 or 5 and leaves the
          #    result in register $t0.
          #--------------------------------------------------------
        
  6. As a comment at the top of your program copy the Python or Java program that you wrote first that solves the problem.