Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

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

A lab session for students using the mips assembly language on the mars simulator. The session involves writing a program to calculate the sum of subsequent integers entered by the user and saving the results in an array. The array is then printed out using syscalls. Students are encouraged to document their solutions and minimize memory i/o operations.

What you will learn

  • How are the sums saved and printed out in the MIPS program?
  • What is the purpose of calculating the sums of subsequent integers?
  • How do students input an integer in the MIPS program?

Typology: Study notes

2021/2022

Uploaded on 08/05/2022

nguyen_99
nguyen_99 🇻🇳

4.2

(80)

1K documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

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.