HW2 (due 10/14)

advertisement
INFS465, Homework 2
DUE 10/14/09. In class. No late submissions!
1) In this exercise you have to obtain the CPI for the program sort.s
from Assignment 1. The first step is to obtain a count of how often
each instruction in this program is executed. To do that, you need to
instrument the program, adding counters to blocks of code to count the
number of times they get executed. Then, based on your analysis,
complete the table shown below:
Instruction category MIPS examples
CPI Instruction Count
Arithmetic 1
Add,sub,addi
1.0
Arithmetic 2
mult, multu
5.0
Arithmetic 3
div, divu
7.0
Data Transfer
lw, sw, lui
2.0
Conditional Branch beq, bne, slt, slti
1.5
Jump
j, jr, jal
1.2
Others
syscall, mflo, mfhi 1.0
Based on the CPI and the frequencies for each category in the table above, compute the
CPI for the program sort.s. What would be its execution time in a 2.8GHz processor?
2) Implement QuickSort in MIPS. Start by writing a program either in C or pseudo-code
that implements QuickSort and then translate it to MIPS. Run this program under
SPIM for the same dataset you used for sort. Do the CPI analysis of problem 1 for
your code as well. Compare the total number of instructions used by sort and
Quicksort using SPIM for this data. What is the execution time of QuickSort for the
same 2.8 GHz processor you used in problem 1?
3) Exercise 3.3 of the book
4) Exercises 3.6.1-3.6.3
5) Exercise 3.13
Download