summaryrefslogtreecommitdiff
path: root/src/arch/riscv/utility.hh
diff options
context:
space:
mode:
authorAlec Roelke <ar4jc@virginia.edu>2017-06-15 15:33:25 -0400
committerAlec Roelke <ar4jc@virginia.edu>2017-07-11 03:37:04 +0000
commit63d4005a29dea37e0219444a3de2cdb25289fdfb (patch)
tree88bf3070e642da6594cb51b9dfc5b2cf63b93bdb /src/arch/riscv/utility.hh
parent91f965dd5708eb365f1b28d30f2c3f012519b1c2 (diff)
downloadgem5-63d4005a29dea37e0219444a3de2cdb25289fdfb.tar.xz
arch-riscv: Restructure ISA description
This patch restructures the RISC-V ISA description to use fewer classes and improve its ability to be extended with nonstandard extensions in the future. It also cleans up the disassembly for some of the CSR and system instructions by removing source and destination registers for instructions that don't have any. [Fix class UImmOp to have an "imm" member rather than "uimm".] [Update disassembly generation for new RegId class.] Change-Id: Iec1c782020126e5e8e73460b84e31c7b5a5971d9 Reviewed-on: https://gem5-review.googlesource.com/3800 Maintainer: Alec Roelke <ar4jc@virginia.edu> Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/arch/riscv/utility.hh')
-rw-r--r--src/arch/riscv/utility.hh15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/arch/riscv/utility.hh b/src/arch/riscv/utility.hh
index fc67fc806..38109a208 100644
--- a/src/arch/riscv/utility.hh
+++ b/src/arch/riscv/utility.hh
@@ -12,7 +12,7 @@
* unmodified and in its entirety in all distributions of the software,
* modified or unmodified, in source code or in binary form.
*
- * Copyright (c) 2016 The University of Virginia
+ * Copyright (c) 2016-2017 The University of Virginia
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -48,8 +48,11 @@
#include <cmath>
#include <cstdint>
+#include <string>
+#include "arch/riscv/registers.hh"
#include "base/types.hh"
+#include "cpu/reg_class.hh"
#include "cpu/static_inst.hh"
#include "cpu/thread_context.hh"
@@ -126,6 +129,16 @@ copyRegs(ThreadContext *src, ThreadContext *dest)
dest->pcState(src->pcState());
}
+inline std::string
+registerName(RegId reg)
+{
+ if (reg.isIntReg()) {
+ return IntRegNames[reg.index()];
+ } else {
+ return FloatRegNames[reg.index()];
+ }
+}
+
inline void
skipFunction(ThreadContext *tc)
{