From: neuschaefer Date: Fri, 3 Jun 2016 20:45:05 +0000 (+0200) Subject: Minor usability improvements (#48) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=906bbfae48713b9d7256eab37613e5b0ddc08133;p=riscv-isa-sim.git Minor usability improvements (#48) * spike_main/disasm.cc: Print unknown CSR numbers in hex * interactive mode: Print "Unknown command" when appropriate --- diff --git a/riscv/interactive.cc b/riscv/interactive.cc index 69f2461..d24ec50 100644 --- a/riscv/interactive.cc +++ b/riscv/interactive.cc @@ -100,6 +100,8 @@ void sim_t::interactive() { if(funcs.count(cmd)) (this->*funcs[cmd])(cmd, args); + else + fprintf(stderr, "Unknown command %s\n", cmd.c_str()); } catch(trap_t t) {} } diff --git a/spike_main/disasm.cc b/spike_main/disasm.cc index 9eea77e..65977fc 100644 --- a/spike_main/disasm.cc +++ b/spike_main/disasm.cc @@ -74,7 +74,12 @@ struct : public arg_t { #define DECLARE_CSR(name, num) case num: return #name; #include "encoding.h" #undef DECLARE_CSR - default: return "unknown"; + default: + { + char buf[16]; + snprintf(buf, sizeof buf, "unknown_%03" PRIx64, insn.csr()); + return std::string(buf); + } } } } csr;