CS 2734
Computer Organization II
Laboratory 4 [2/8; 2/10; 2/15] Loops and Arrays in Mips
-
Prior to the laboratory, you should do the following:
- Make a separate directory for laboratory 4 and put all of
the code that you develop for this lab in that directory.
- Write a MIPS program that allocates space for two integer
arrays (A and B) of size 10. The program should do that following:
- Read in the value of N (a number between 1 and 10).
- Read in the first N values of the array A.
- Compute the first N values of B as the accumulation of the
array A (e.g. B[i] is A[0] + A[1] + ... + A[i]).
Note: You must use a loop to implement this.
- Output the first N values of the arrays A and B.
- Be sure to thoroughly document your programs following the style
of the programs discussed in class. (Insufficient documentation will
bump an otherwise working program down to 8.)
- Implementation Notes:
- Write a C version of this program first to make sure you understand it.
- An example is:
N = 8, A = [2, 4, 6, 8, 10, 12, 14, 16]
B = [2, 6, 12, 20, 30, 42, 56, 72]
- For Checkoff:
- Get a printout of your program using
prtext. Give the
program to the lab instructor before he starts your check-off procedure.
- He will give you a card with the numbers you should enter for N and A.
- Run your program for those values.
Revision Date: 2/5/99