Browse Source

Fixed compilation issues.

- Removed unused variable argflags.
- Fixed variable name (index_bits -> set_index_bits).
masstesting
Jacob 6 years ago
parent
commit
8d8568fce1
  1. 8
      csim.c

8
csim.c

@ -27,7 +27,7 @@ int main(int argc, char* argv[]) @@ -27,7 +27,7 @@ int main(int argc, char* argv[])
{
size_t set_index_bits = 0, lines = 0, block_bits = 0; // Useful variables.
char *filename = NULL;
int opt = 0, argflags = 0;
int opt = 0;
while ((opt=getopt(argc, argv, "hvs:E:b:t:")) != -1) {
switch (opt) {
/* TODO: maybe add checking for optarg swallowing actual arguments. */
@ -35,7 +35,7 @@ int main(int argc, char* argv[]) @@ -35,7 +35,7 @@ int main(int argc, char* argv[])
VERBOSE = 1;
break;
case 's': // 2^s = number of sets
index_bits = parse_int_arg(optarg, 's');
set_index_bits = parse_int_arg(optarg, 's');
break;
case 'E': // associativity - lines per set
lines = parse_int_arg(optarg, 'E');
@ -55,12 +55,12 @@ int main(int argc, char* argv[]) @@ -55,12 +55,12 @@ int main(int argc, char* argv[])
}
}
/* If any required arguments were not provided. (argflags != 0b1111) */
if (!index_bits || !lines || !block_bits || !filename) {
if (!set_index_bits || !lines || !block_bits || !filename) {
printf("Usage: ./csim [-hv] -s <number> -E <number> -b <number> -t <file>\n");
return 1;
}
/* End of argument parsing. */
printf("Arguments: %zd, %zd, %zd, %hd, %s\n", index_bits, lines, block_bits, VERBOSE, filename);
printf("Arguments: %zd, %zd, %zd, %hd, %s\n", set_index_bits, lines, block_bits, VERBOSE, filename);
printSummary(0, 0, 0);
return 0;