From 906bbfae48713b9d7256eab37613e5b0ddc08133 Mon Sep 17 00:00:00 2001 From: neuschaefer Date: Fri, 3 Jun 2016 22:45:05 +0200 Subject: [PATCH] Minor usability improvements (#48) * spike_main/disasm.cc: Print unknown CSR numbers in hex * interactive mode: Print "Unknown command" when appropriate --- riscv/interactive.cc | 2 ++ spike_main/disasm.cc | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) 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; -- 2.30.2