From: Prashanth Mundkur Date: Thu, 6 Aug 2015 21:57:07 +0000 (-0700) Subject: Add an option (-l) to display a log of execution in non-interactive mode. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b16ef94394e8f04f11241c2acfe442b4ddbc6853;p=riscv-isa-sim.git Add an option (-l) to display a log of execution in non-interactive mode. Interactive (-d) mode overrides this option when both are specified. --- diff --git a/riscv/sim.cc b/riscv/sim.cc index eb31f12..66bebb3 100644 --- a/riscv/sim.cc +++ b/riscv/sim.cc @@ -71,6 +71,8 @@ reg_t sim_t::get_scr(int which) int sim_t::run() { + if (!debug && log) + set_procs_debug(true); while (htif->tick()) { if (debug || ctrlc_pressed) @@ -123,6 +125,11 @@ void sim_t::set_debug(bool value) debug = value; } +void sim_t::set_log(bool value) +{ + log = value; +} + void sim_t::set_histogram(bool value) { histogram_enabled = value; diff --git a/riscv/sim.h b/riscv/sim.h index 0c7b0df..1f43cee 100644 --- a/riscv/sim.h +++ b/riscv/sim.h @@ -24,6 +24,7 @@ public: bool running(); void stop(); void set_debug(bool value); + void set_log(bool value); void set_histogram(bool value); void set_procs_debug(bool value); htif_isasim_t* get_htif() { return htif.get(); } @@ -53,6 +54,7 @@ private: size_t current_step; size_t current_proc; bool debug; + bool log; bool histogram_enabled; // provide a histogram of PCs // presents a prompt for introspection into the simulation diff --git a/spike_main/spike.cc b/spike_main/spike.cc index 7a85bd1..13983a0 100644 --- a/spike_main/spike.cc +++ b/spike_main/spike.cc @@ -21,6 +21,7 @@ static void help() fprintf(stderr, " -m Provide MiB of target memory [default 4096]\n"); fprintf(stderr, " -d Interactive debug mode\n"); fprintf(stderr, " -g Track histogram of PCs\n"); + fprintf(stderr, " -l Generate a log of execution\n"); fprintf(stderr, " -h Print this help message\n"); fprintf(stderr, " --isa= RISC-V ISA string [default RV64IMAFDC]\n"); fprintf(stderr, " --ic=:: Instantiate a cache model with S sets,\n"); @@ -35,6 +36,7 @@ int main(int argc, char** argv) { bool debug = false; bool histogram = false; + bool log = false; size_t nprocs = 1; size_t mem_mb = 0; std::unique_ptr ic; @@ -48,6 +50,7 @@ int main(int argc, char** argv) parser.option('h', 0, 0, [&](const char* s){help();}); parser.option('d', 0, 0, [&](const char* s){debug = true;}); parser.option('g', 0, 0, [&](const char* s){histogram = true;}); + parser.option('l', 0, 0, [&](const char* s){log = true;}); parser.option('p', 0, 1, [&](const char* s){nprocs = atoi(s);}); parser.option('m', 0, 1, [&](const char* s){mem_mb = atoi(s);}); parser.option(0, "ic", 1, [&](const char* s){ic.reset(new icache_sim_t(s));}); @@ -79,6 +82,7 @@ int main(int argc, char** argv) } s.set_debug(debug); + s.set_log(log); s.set_histogram(histogram); return s.run(); }