Improve verbose printing

This commit is contained in:
Adam Goldsmith 2016-04-28 01:54:49 -04:00
parent e457f4dee0
commit ca9f6ddc77

5
csim.c
View File

@ -125,14 +125,17 @@ int main(int argc, char* argv[])
char* end; char* end;
char op = buffer[1]; char op = buffer[1];
long address = strtol(buffer+3, &end, 16); long address = strtol(buffer+3, &end, 16);
long size = strtol(end+1, NULL, 16);
if (*end != ',' || !(op == 'S' || op == 'L' || op == 'M')) { if (*end != ',' || !(op == 'S' || op == 'L' || op == 'M')) {
printf("Invalid input file, last line:\n%s\n", buffer); printf("Invalid input file, last line:\n%s\n", buffer);
return -1; return -1;
} }
printf("%c %ld\n", op, address);
if(VERBOSE)
print_cache(cache, set_indices); print_cache(cache, set_indices);
char r = cache_access(cache, address, set_index_bits, block_bits, num_lines); 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); increment_result_counters(r, &score);
if (op == 'M') { //Access again if modifying if (op == 'M') { //Access again if modifying
r = cache_access(cache, address, set_index_bits, block_bits, num_lines); r = cache_access(cache, address, set_index_bits, block_bits, num_lines);