Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/45526 )

Change subject: arch-riscv: Use operands instead of (read|set)MiscReg for FP insts.
......................................................................

arch-riscv: Use operands instead of (read|set)MiscReg for FP insts.

Change-Id: I9f614225cedcd88a06737797e91f892f2f104f8d
---
M src/arch/riscv/isa/formats/fp.isa
1 file changed, 17 insertions(+), 10 deletions(-)



diff --git a/src/arch/riscv/isa/formats/fp.isa b/src/arch/riscv/isa/formats/fp.isa
index d015239..9f0ad20 100644
--- a/src/arch/riscv/isa/formats/fp.isa
+++ b/src/arch/riscv/isa/formats/fp.isa
@@ -36,20 +36,13 @@
     Fault %(class_name)s::execute(ExecContext *xc,
         Trace::InstRecord *traceData) const
     {
-        STATUS status = xc->readMiscReg(MISCREG_STATUS);
-        if (status.fs == FPUStatus::OFF)
- return std::make_shared<IllegalInstFault>("FPU is off", machInst);
-
+        %(fp_enabled_check)s;
         %(op_decl)s;
         %(op_rd)s;

-        RegVal FFLAGS = xc->readMiscReg(MISCREG_FFLAGS);
         std::feclearexcept(FE_ALL_EXCEPT);
         %(code)s;
-
-        FFLAGS |= softfloat_exceptionFlags;
-        softfloat_exceptionFlags = 0;
-        xc->setMiscReg(MISCREG_FFLAGS, FFLAGS);
+        %(set_fflags)s;

         %(op_wb)s;

@@ -58,7 +51,21 @@
 }};

 def format FPROp(code, *opt_flags) {{
-    iop = InstObjParams(name, Name, 'RegOp', code, opt_flags)
+    fp_enabled_check = """
+        STATUS status = xc->readMiscReg(MISCREG_STATUS);
+        if (status.fs == FPUStatus::OFF)
+ return std::make_shared<IllegalInstFault>("FPU is off", machInst);
+    """
+
+    set_fflags = """
+    Fflags = Fflags | softfloat_exceptionFlags;
+    softfloat_exceptionFlags = 0;
+    """
+
+    iop = InstObjParams(name, Name, 'RegOp',
+            { "code": code,
+              "fp_enabled_check": fp_enabled_check,
+              "set_fflags": set_fflags }, opt_flags)
     header_output = BasicDeclare.subst(iop)
     decoder_output = BasicConstructor.subst(iop)
     decode_block = BasicDecode.subst(iop)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/45526
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I9f614225cedcd88a06737797e91f892f2f104f8d
Gerrit-Change-Number: 45526
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to