CSE 378 - Spring 1999

Machine Organization and Assembly Language Programming

Problem Set #8

Due Friday, June 4, 1999
For this assignment, you will be using SPIM and MIPS assembly language to write a simple trace-driven simulator for assessing cache performance.  Trace-driven simulation is commonly used to assess performance of memory hierarchy designs.

A general simulator works as follows.


Process each memory reference, decomposing it into tag, index, and offset components.   Check if the reference hits in the appropriate cache (note that the simulator does not actually bring data in or out of its simulated cache; rather, it pretends that it has the data there).  Take the appropriate action (change valid/dirty bits, replace blocks, etc.) and record the statistics.

The output will be a set of statistics, including read hit ratio, write hit ratio, average memory access time, and so forth.

Your assignment will simulate a D-cache only, and will do the following:

Given as Input:

You will output to the SPIM console: For the purposes of debugging, you are encouraged to test your program on smaller cache sizes and smaller input traces first.

Input specification:

Input will be given as a series of integer pairs (at most 1024 pairs), where each pair will correspond to <load/store> <address>. For example,

 1 20 1 40 1 32 2 23 1 34 1 20 1 22 0 0
 <lb 20> <lb 40> <lb 32> <sb 23> <lb 34> ...
You have to read this as a series of integers (using system call for read_int). Note that you can now disregard the line in the original assignment that says "operation is a byte... address is a word" because everything will (by default) be read as a word.