From fcc557da9d7a49ef6f367f9d5158d03f2fae443f Mon Sep 17 00:00:00 2001 From: Scott Beamer Date: Thu, 24 Jul 2014 17:05:53 -0700 Subject: added support for register convention names in debug mode --- riscv/interactive.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'riscv/interactive.cc') 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 @@ -14,6 +16,7 @@ #include #include #include +#include static std::string readline(int fd) { @@ -130,7 +133,9 @@ reg_t sim_t::get_reg(const std::vector& 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& 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(); -- cgit v1.1