Browse Source

Make verbose printing closer to reference simulator

master
Adam Goldsmith 6 years ago
parent
commit
bd06a5c208
  1. 8
      csim.c

8
csim.c

@ -150,13 +150,16 @@ int main(int argc, char* argv[]) @@ -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) @@ -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");
}