diff options
author | Scott Beamer <sbeamer@eecs.berkeley.edu> | 2014-07-24 17:05:53 -0700 |
---|---|---|
committer | Scott Beamer <sbeamer@eecs.berkeley.edu> | 2014-07-24 17:05:53 -0700 |
commit | fcc557da9d7a49ef6f367f9d5158d03f2fae443f (patch) | |
tree | 665e9754bee8f5a214e2c47329ef6af443035f69 /riscv/interactive.cc | |
parent | 7812ee06e6e1d3ffd0195b010cb095ef36b0a4eb (diff) | |
download | spike-fcc557da9d7a49ef6f367f9d5158d03f2fae443f.zip spike-fcc557da9d7a49ef6f367f9d5158d03f2fae443f.tar.gz spike-fcc557da9d7a49ef6f367f9d5158d03f2fae443f.tar.bz2 |
added support for register convention names in debug mode
Diffstat (limited to 'riscv/interactive.cc')
-rw-r--r-- | riscv/interactive.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/riscv/interactive.cc b/riscv/interactive.cc index 9014aa0..27e9ee0 100644 --- a/riscv/interactive.cc +++ b/riscv/interactive.cc @@ -1,5 +1,7 @@ // See LICENSE for license details. +#include "decode.h" +#include "disasm.h" #include "sim.h" #include "htif.h" #include <sys/mman.h> @@ -14,6 +16,7 @@ #include <sstream> #include <string> #include <vector> +#include <algorithm> static std::string readline(int fd) { @@ -130,7 +133,9 @@ reg_t sim_t::get_reg(const std::vector<std::string>& args) throw trap_illegal_instruction(); int p = atoi(args[0].c_str()); - int r = atoi(args[1].c_str()); + int r = std::find(xpr_name, xpr_name + NXPR, args[1]) - xpr_name; + if (r == NXPR) + r = atoi(args[1].c_str()); if(p >= (int)num_cores() || r >= NXPR) throw trap_illegal_instruction(); @@ -143,7 +148,9 @@ reg_t sim_t::get_freg(const std::vector<std::string>& args) throw trap_illegal_instruction(); int p = atoi(args[0].c_str()); - int r = atoi(args[1].c_str()); + int r = std::find(fpr_name, fpr_name + NFPR, args[1]) - fpr_name; + if (r == NFPR) + r = atoi(args[1].c_str()); if(p >= (int)num_cores() || r >= NFPR) throw trap_illegal_instruction(); |