summaryrefslogtreecommitdiff
path: root/src/arch/riscv/faults.hh
diff options
context:
space:
mode:
authorAlec Roelke <ar4jc@virginia.edu>2016-11-30 17:10:28 -0500
committerAlec Roelke <ar4jc@virginia.edu>2016-11-30 17:10:28 -0500
commit1229b3b62303e00693cfb052fca6e4f7879cf0af (patch)
tree39cf4ee7cbc80de16ca9c748f6852afdf3a9b3df /src/arch/riscv/faults.hh
parent070da984936ea3f1bc0d3ae7d581b59b6733e4fe (diff)
downloadgem5-1229b3b62303e00693cfb052fca6e4f7879cf0af.tar.xz
riscv: [Patch 3/5] Added RISCV floating point extensions RV64FD
Third of five patches adding RISC-V to GEM5. This patch adds the RV64FD extensions, which include single- and double-precision floating point instructions. Patch 1 introduced RISC-V and implemented the base instruction set, RV64I and patch 2 implemented the integer multiply extension, RV64M. Patch 4 will implement the atomic memory instructions, RV64A, and patch 5 will add support for timing, minor, and detailed CPU models that is missing from the first four patches. [Fixed exception handling in floating-point instructions to conform better to IEEE-754 2008 standard and behavior of the Chisel-generated RISC-V simulator.] [Fixed style errors in decoder.isa.] [Fixed some fuzz caused by modifying a previous patch.] Signed-off by: Alec Roelke Signed-off by: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/arch/riscv/faults.hh')
-rw-r--r--src/arch/riscv/faults.hh20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/arch/riscv/faults.hh b/src/arch/riscv/faults.hh
index cd073235c..d0d7988c5 100644
--- a/src/arch/riscv/faults.hh
+++ b/src/arch/riscv/faults.hh
@@ -40,6 +40,12 @@
namespace RiscvISA
{
+const uint32_t FloatInexact = 1 << 0;
+const uint32_t FloatUnderflow = 1 << 1;
+const uint32_t FloatOverflow = 1 << 2;
+const uint32_t FloatDivZero = 1 << 3;
+const uint32_t FloatInvalid = 1 << 4;
+
enum ExceptionCode {
INST_ADDR_MISALIGNED = 0,
INST_ACCESS = 1,
@@ -124,6 +130,20 @@ class UnimplementedFault : public RiscvFault
invoke_se(ThreadContext *tc, const StaticInstPtr &inst);
};
+class IllegalFrmFault: public RiscvFault
+{
+ private:
+ const uint8_t frm;
+ public:
+ IllegalFrmFault(uint8_t r)
+ : RiscvFault("Illegal floating-point rounding mode", INST_ILLEGAL,
+ SOFTWARE),
+ frm(r)
+ {}
+
+ void invoke_se(ThreadContext *tc, const StaticInstPtr &inst);
+};
+
class BreakpointFault : public RiscvFault
{
public: