Make verbose printing closer to reference simulator

This commit is contained in:
Adam Goldsmith 2016-04-28 20:53:59 -04:00
parent 189807e834
commit bd06a5c208

8
csim.c
View File

@ -150,13 +150,16 @@ int main(int argc, char* argv[])
/* if(VERBOSE) */
/* print_cache(cache, num_sets); */
mprintf(" %c %lx,%lx", op, address, size);
char r = cache_access(cache, address, set_index_bits, block_bits, num_lines);
mprintf(" %c %lx,%lx %c\n", op, address, size, r);
increment_result_counters(r, &score);
if (op == 'M') { //Access again if modifying
r = cache_access(cache, address, set_index_bits, block_bits, num_lines);
increment_result_counters(r, &score);
}
mprintf("\n");
}
printSummary(score.hits, score.misses, score.evictions);
@ -238,6 +241,9 @@ void increment_result_counters(char result, results* score)
score->hits += (result == 'H');
score->misses += (result == 'M' || result == 'E');
score->evictions += (result == 'E');
if (result == 'H') mprintf(" hit");
if (result == 'M') mprintf(" miss");
if (result == 'E') mprintf(" miss eviction");
}