Docsity

MIPS Lab Session: Calculating Array of Sums, Study notes of Advanced Computer Architecture

Toggle sidebar
bg1
Lab session MIPS
Group A: November 6, 2009
Group B: November 3, 2009
Work in the given groups of two. Submit your solutions to the respective
assignment on Blackboard. The le name is:
s04_s0XXXXX_s0XXXXX.tar.gz
One of the group members commits your solution. Keep an eye on the deadline
(see Blackboard)!
1 Exercises
Note: for a quick reference to the MIPS assembly language, see Figure 2.1 of
Chapter 2 (page 78).
Write a MIPS program for the MARS simulator that calculates an array of
sums of subsequent integers. The following must be implemented:
•
The user is asked to enter an integer. Use a syscall (see MARS help, tab
"Syscalls");
•
The sums of the subsequent integers are calculated for each value up to
the entered value. For example, if the user entered 5, then 5 sums 1, 1+2,
1+2+3, 1+2+3+4, 1+2+3+4+5 are calculated. Save these sums as an
"array" (i.e. in subsequent words in the data memory);
•
The array is printed out (use syscalls). For example, if the user entered
5, then the following string is printed:
1 3 6 10 15
As always, document your solution well (use #).
Keep in mind that, in order to create an optimal solution, reading and
writing to memory must be minimized, because such I/O operations are very
expensive. (However, in this exercise you have to store your computed values
in memory.)
2 Project
There is no project this week. You only have to submit your solutions to the
exercises. There will be no feedback loop on this lab session.
1

Partial preview of the text

Download MIPS Lab Session: Calculating Array of Sums and more Study notes Advanced Computer Architecture in PDF only on Docsity!

Lab session MIPS

Group A: November 6, 2009

Group B: November 3, 2009

Work in the given groups of two. Submit your solutions to the respective assignment on Blackboard. The le name is: s04_s0XXXXX_s0XXXXX.tar.gz One of the group members commits your solution. Keep an eye on the deadline (see Blackboard)!

1 Exercises

Note: for a quick reference to the MIPS assembly language, see Figure 2.1 of Chapter 2 (page 78). Write a MIPS program for the MARS simulator that calculates an array of sums of subsequent integers. The following must be implemented:

  • The user is asked to enter an integer. Use a syscall (see MARS help, tab "Syscalls");
  • The sums of the subsequent integers are calculated for each value up to the entered value. For example, if the user entered 5, then 5 sums 1, 1+2, 1+2+3, 1+2+3+4, 1+2+3+4+5 are calculated. Save these sums as an "array" (i.e. in subsequent words in the data memory);
  • The array is printed out (use syscalls). For example, if the user entered 5, then the following string is printed: 1 3 6 10 15

As always, document your solution well (use #). Keep in mind that, in order to create an optimal solution, reading and writing to memory must be minimized, because such I/O operations are very expensive. (However, in this exercise you have to store your computed values in memory.)

2 Project

There is no project this week. You only have to submit your solutions to the exercises. There will be no feedback loop on this lab session.