CSE 351: The Hardware/Software Interface

Autumn 2011 Course Website Return home »

Lab 4: Inferring Mystery Cache Geometries

Assigned Monday, November 14, 2011
Due Date Monday, November 21, 2011 at 11:59p
Files lab4.tar.gz

Overview

Chip D. Signer, Ph.D, is trying to reverse engineer a competitor's microprocessors to discover their cache geometries and has recruited you to help. Instead of running programs on these processors and inferring the cache layout from timing results, you will approximate his work by using a simulator.

This lab should be done on a 64-bit machine. Use attu, the lab computers, or your own personal 64-bit computer.

Instructions

Specifically, each of these "processors" is provided as an object file (.o file) against which you will link your code. See the file mystery-cache.h for documentation of the function interface that these object files export. Your job is to fill in the function stubs in cache-test-skel.c which, when linked with one of these cache object files, will determine and then output the cache size, associativity, and block size. Some of the provided object files are named with this information (e.g. cache_64c_2a_16b.o is a 64 KB capacity, 2-way set-associative cache with 16B blocks) to help you check your work. There are also 3 mystery cache object files, whose parameters you must discover on your own.

You can assume that the mystery caches have sizes that are powers of 2. You cannot assume anything else about the cache parameters except what you can infer from the cache size. Finally, the mystery caches are all pretty realistic in their geometries, so use this fact to sanity check your results.

You will need to complete this assignment on a Linux machine with the C standard libraries (e.g. attu). All the files you need are in lab4.tar.gz. To extract the files from this archive, simply use the command:

tar xzf lab4.tar.gz

and the files will be extracted into a new subdirectory of the current directory named lab4. The provided Makefile includes a target cache-test. To use it, set TEST_CACHE to the object file to link against on the command line - i.e. from within the hw3 directory run the command:

make cache-test TEST_CACHE=cache_64c_2a_16b.o

This will create an executable cache-test that will run your cache-inference code against the supplied cache object. Run this executable like so:

./cache-test

and it will print the results to the screen.

Your Tasks

Complete the 3 functions in cache-test-skel.c which have /* YOUR CODE GOES HERE */ comments in them.

Additionally, determine the geometry of each of the three mystery caches and list these in a comment, along with your name, at the top of your modified cache-test-skel.c.

Submitting Your Work

Submit your modified version of cache-test-skel.c to the Catalyst Drop Box for this assignment.