Computer Architecture and Systems Software
Question 1
The following tasks consider designing and writing computer programs using assembly
language. For each task, the program should produce valid results after loading and
executing in the pcspim or xspim simulator. You should ensure that your programs are
ecient and well commented.
A.Design and write an MIPS assembly program that accepts three input numbers and
outputs the following numbers in sequence.
The largest of 3 inputs, the median of 3 inputs, the smallest of 3 inputs,
the dierence between the largest and smallest”
You should attach the design of your program (in terms of a
ow-chart diagram)
and your MIPS codes in the submission le. [13 marks]
B.For the program in Part A., explain and demonstrate its execution in the laboratory
sessions in Weeks 8, 9 or 10, and answer relevant questions.
[17 marks]
C.GivenNas a user-entered positive number (i.e.,N >0), design and write one of
the following MIPS assembly programs that depend on the last digit of your UoB
number.
Last digit of Program specications
your UoB number
Odd Add all odd numbers between 0 andN(inclusive)
and display the result
Even Add all even numbers between 0 andN(inclusive)
and display the result
Your program shall prompt the user to enter an input numberN. If the user enters
a zero or negative number, then your program shall stop immediately.
You should attach the design of your program (in terms of a
ow-chart diagram)
and your MIPS codes in the submission le.
[13 marks]
D.For the program in Part C., explain and demonstrate its execution in the laboratory
sessions in Weeks 8, 9 or 10, and answer relevant questions.
[17 marks]
.