1
0

add a flag to only log and dump after a certain number of cycles

This commit is contained in:
Howard Mao 2015-09-18 18:02:03 -07:00
parent 4496e8d4e2
commit 38a9b23ce7

View File

@ -21,6 +21,7 @@ int main(int argc, char** argv)
unsigned random_seed = (unsigned)time(NULL) ^ (unsigned)getpid(); unsigned random_seed = (unsigned)time(NULL) ^ (unsigned)getpid();
uint64_t max_cycles = -1; uint64_t max_cycles = -1;
uint64_t trace_count = 0; uint64_t trace_count = 0;
uint64_t start = 0;
int ret = 0; int ret = 0;
const char* vcd = NULL; const char* vcd = NULL;
const char* loadmem = NULL; const char* loadmem = NULL;
@ -46,6 +47,8 @@ int main(int argc, char** argv)
max_cycles = atoll(argv[i]+12); max_cycles = atoll(argv[i]+12);
else if (arg.substr(0, 9) == "+loadmem=") else if (arg.substr(0, 9) == "+loadmem=")
loadmem = argv[i]+9; loadmem = argv[i]+9;
else if (arg.substr(0, 7) == "+start=")
start = atoll(argv[i]+7);
} }
const int disasm_len = 24; const int disasm_len = 24;
@ -141,10 +144,11 @@ int main(int argc, char** argv)
tile.Top__io_host_out_ready = LIT<1>(1); tile.Top__io_host_out_ready = LIT<1>(1);
} }
if (log) if (log && trace_count >= start)
tile.print(stderr); tile.print(stderr);
if (vcd) // make sure we dump on cycle 0 to get dump_init
if (vcd && (trace_count == 0 || trace_count >= start))
tile.dump(vcdfile, trace_count); tile.dump(vcdfile, trace_count);
tile.clock_hi(LIT<1>(0)); tile.clock_hi(LIT<1>(0));
@ -156,14 +160,18 @@ int main(int argc, char** argv)
if (htif->exit_code()) if (htif->exit_code())
{ {
fprintf(stderr, "*** FAILED *** (code = %d, seed %d) after %lld cycles\n", htif->exit_code(), random_seed, (long long)trace_count); fprintf(stderr, "*** FAILED *** (code = %d, seed %d) after %ld cycles\n", htif->exit_code(), random_seed, trace_count);
ret = htif->exit_code(); ret = htif->exit_code();
} }
else if (trace_count == max_cycles) else if (trace_count == max_cycles)
{ {
fprintf(stderr, "*** FAILED *** (timeout, seed %d) after %lld cycles\n", random_seed, (long long)trace_count); fprintf(stderr, "*** FAILED *** (timeout, seed %d) after %ld cycles\n", random_seed, trace_count);
ret = 2; ret = 2;
} }
else if (log)
{
fprintf(stderr, "Completed after %ld cycles\n", trace_count);
}
delete htif; delete htif;