Minor usability improvements (#48)
authorneuschaefer <j.neuschaefer@gmx.net>
Fri, 3 Jun 2016 20:45:05 +0000 (22:45 +0200)
committerAndrew Waterman <waterman@eecs.berkeley.edu>
Fri, 3 Jun 2016 20:45:05 +0000 (13:45 -0700)
* spike_main/disasm.cc: Print unknown CSR numbers in hex

* interactive mode: Print "Unknown command" when appropriate

riscv/interactive.cc
spike_main/disasm.cc

index 69f2461d69be40f5f497858df583b88358085910..d24ec50714e9d707fbb1be793f09b6dc50500c5c 100644 (file)
@@ -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) {}
   }
index 9eea77ed9715aa4b6079669ec0234437496de89d..65977fc681144eb4bd933364c299b907ededb416 100644 (file)
@@ -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;