CS316 Programming Assignment 4: FAQ

Instructor: Kavita Bala



Sunday November 11th, 3:30PM: Many students have been asking for two clarifications of the assignment:
  1. Remember that the memory is byte addressed, i.e. a memory address cooresponds to a single byte in the memory.
  2. Three of the requested statistics, hits, misses and hit rate, are computed only for cache reads. Writes should only contribute to the write count.
Tuesday November 6th, 5:50PM: In cache.c, you should not be #including any files beyond what is already there in the template you received.

In particular, you should not be using math.h. Remember that you will be taking the logarithms of perfect powers of 2.

Tuesday November 6th, 4:45PM: To help you debug your code here approximate ranges for the hit and miss counts of the solution on the test programs supplied with the assignment.  These counts are for the default cache size and set associativity.

14-15 million
1-2 million

Tuesday November 6th, 4:45PM: We have made a minor change to the PA4 framework.  The cache.c API asks you to calculate the hit rate but the API function is expecting, incorrectly, an integer return value instead of, correctly, a float value.  We have issued a patch to the framework code that corrects the API.  The total change amounts to 4 lines of code.  You can either download new versions of the framework, now posted both on the CSUG lab machines and in CMS, or make the changes yourself.   Following either set of instructions and then remaking your simulator with the make command will install the changes.

Instructions to copy the new framework code:

1.  On a CSUG machine, change to the directory containing your version of the PA4 source (the directory where you issue the make command typically <PA4 root directory>/cache) and issue the command:

cp /usr/local/cs316/pa4/cache/main.* .

2. In cache.c, change the return value of the function cache_read_hit_rate() from unsigned int to float.

Instructions for making the change yourself:

A total of four lines changed in the entire simulator source code.  The changes are:

1. In main.h, change line 50 from

unsigned int cache_read_hit_rate(); 


float cache_read_hit_rate();

2. In main.c, change line 26 from 

unsigned int rate = cache_read_hit_rate();


float rate = cache_read_hit_rate(); 

3. In main.c, chance line 34 from

printf(“Hit Rate: %10i\n”,rate);


printf(“Hit Rate: %10.3f\n”,rate);

4. In cache.c, change the return value of the function cache_read_hit_rate() from unsigned int to float.

Page maintained by Kavita Bala