Check for F extension when accessing FCSR
authorAndrew Waterman <waterman@cs.berkeley.edu>
Sat, 4 Apr 2015 22:17:13 +0000 (15:17 -0700)
committerAndrew Waterman <waterman@cs.berkeley.edu>
Sat, 4 Apr 2015 22:17:13 +0000 (15:17 -0700)
riscv/processor.cc

index 11872656059c93f4556b0b8477b919937904a7ab..1fe0a9c3813fd591f4e032379d66272214c68225 100644 (file)
@@ -460,12 +460,18 @@ reg_t processor_t::get_csr(int which)
   {
     case CSR_FFLAGS:
       require_fp;
+      if (!supports_extension('F'))
+        break;
       return state.fflags;
     case CSR_FRM:
       require_fp;
+      if (!supports_extension('F'))
+        break;
       return state.frm;
     case CSR_FCSR:
       require_fp;
+      if (!supports_extension('F'))
+        break;
       return (state.fflags << FSR_AEXC_SHIFT) | (state.frm << FSR_RD_SHIFT);
     case CSR_CYCLE:
     case CSR_TIME: