[sim,pk] reorganized status register
authorAndrew Waterman <waterman@s144.Millennium.Berkeley.EDU>
Sun, 10 Apr 2011 00:50:12 +0000 (17:50 -0700)
committerAndrew Waterman <waterman@s144.Millennium.Berkeley.EDU>
Sun, 10 Apr 2011 00:50:12 +0000 (17:50 -0700)
config.h.in
configure
riscv/decode.h
riscv/processor.cc
riscv/riscv.ac
riscv/trap.h

index 6ef883daeb65ffce3c91fa61cace1090bc2c6c47..fb0f56ff607627bb0940bc882b4f485d1aba1331 100644 (file)
@@ -27,6 +27,9 @@
 /* Define if floating-point instructions are supported */
 #undef RISCV_ENABLE_FPU
 
+/* Define if instruction compression is supported */
+#undef RISCV_ENABLE_RVC
+
 /* Define if libopcodes exists */
 #undef RISCV_HAVE_LIBOPCODES
 
index 82ea6a473ebec06c6eedb430a2d620def56a64da..3efe8e7f0f966aa21f76ba43f6cde713009aa460 100755 (executable)
--- a/configure
+++ b/configure
@@ -637,6 +637,7 @@ enable_stow
 enable_optional_subprojects
 enable_fpu
 enable_64bit
+enable_rvc
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1271,6 +1272,7 @@ Optional Features:
                           Enable all optional subprojects
   --disable-fpu           Disable floating-point
   --disable-64bit         Disable 64-bit mode
+  --disable-rvc           Disable instruction compression
 
 Some influential environment variables:
   CC          C compiler command
@@ -4043,6 +4045,19 @@ if test "x$enable_64bit" != "xno"; then :
 $as_echo "#define RISCV_ENABLE_64BIT /**/" >>confdefs.h
 
 
+fi
+
+# Check whether --enable-rvc was given.
+if test "${enable_rvc+set}" = set; then :
+  enableval=$enable_rvc;
+fi
+
+if test "x$enable_rvc" != "xno"; then :
+
+
+$as_echo "#define RISCV_ENABLE_RVC /**/" >>confdefs.h
+
+
 fi
 
 libopc=`dirname \`which riscv-gcc\``/../`$ac_config_guess`/riscv/lib/libopcodes.a
index 8d96ab9da02e319f54ddcf3e5819cb81990f16d2..bb1f605c0fc31a933e299bfb3ffc4b7383574c13 100644 (file)
@@ -35,14 +35,14 @@ const int JUMP_ALIGN_BITS = 1;
 
 #define SR_ET    0x0000000000000001ULL
 #define SR_EF    0x0000000000000002ULL
-#define SR_PS    0x0000000000000004ULL
-#define SR_    0x0000000000000008ULL
-#define SR_UX    0x0000000000000010ULL
-#define SR_SX    0x0000000000000020ULL
-#define SR_UC    0x0000000000000040ULL
-#define SR_SC    0x0000000000000080ULL
+#define SR_EV    0x0000000000000004ULL
+#define SR_EC    0x0000000000000008ULL
+#define SR_PS    0x0000000000000010ULL
+#define SR_S     0x0000000000000020ULL
+#define SR_UX    0x0000000000000040ULL
+#define SR_SX    0x0000000000000080ULL
 #define SR_IM    0x000000000000FF00ULL
-#define SR_ZERO  ~(SR_ET|SR_EF|SR_PS|SR_S|SR_UX|SR_SX|SR_UC|SR_SC|SR_IM)
+#define SR_ZERO  ~(SR_ET|SR_EF|SR_EV|SR_EC|SR_PS|SR_S|SR_UX|SR_SX|SR_IM)
 #define SR_IM_SHIFT 8
 #define TIMER_IRQ 7
 
@@ -190,13 +190,13 @@ private:
 #define require_xpr64 if(!xpr64) throw trap_illegal_instruction
 #define require_xpr32 if(xpr64) throw trap_illegal_instruction
 #define require_fp if(!(sr & SR_EF)) throw trap_fp_disabled
+#define require_vector if(!(sr & SR_EV)) throw trap_vector_disabled
 #define cmp_trunc(reg) (reg_t(reg) << (64-xprlen))
 #define set_fp_exceptions ({ set_fsr(fsr | \
                                (softfloat_exceptionFlags << FSR_AEXC_SHIFT)); \
                              softfloat_exceptionFlags = 0; })
 
-#define rvc_mode ((sr & SR_S) ? (sr & SR_SC) : (sr & SR_UC))
-#define require_rvc if(!rvc_mode) throw trap_illegal_instruction
+#define require_rvc if(!(sr & SR_EC)) throw trap_illegal_instruction
 
 #define sext32(x) ((sreg_t)(int32_t)(x))
 #define insn_length(x) (((x).bits & 0x3) < 0x3 ? 2 : 4)
index 81ac42a7398360329ff44fb521ea2af5993313da..8aa29661f3fc339f466f6f0d3b4914ddc2f723ae 100644 (file)
@@ -55,8 +55,8 @@ void processor_t::set_sr(uint32_t val)
 #ifndef RISCV_ENABLE_FPU
   sr &= ~SR_EF;
 #endif
-#ifdef RISCV_ENABLE_RVC
-  sr &= ~SR_C;
+#ifndef RISCV_ENABLE_RVC
+  sr &= ~SR_EC;
 #endif
 
   xprlen = ((sr & SR_S) ? (sr & SR_SX) : (sr & SR_UX)) ? 64 : 32;
@@ -79,7 +79,7 @@ void processor_t::step(size_t n, bool noisy)
       if(interrupts && (sr & SR_ET))
         take_trap(trap_interrupt,noisy);
 
-      insn_t insn = mmu.load_insn(pc, rvc_mode);
+      insn_t insn = mmu.load_insn(pc, sr & SR_EC);
   
       reg_t npc = pc + insn_length(insn);
 
index 7898145098c70b75f829bf5b114a500051576ccf..9bb4f2faacdce74b83b058fb6da06367299c0b18 100644 (file)
@@ -8,6 +8,11 @@ AS_IF([test "x$enable_64bit" != "xno"], [
   AC_DEFINE([RISCV_ENABLE_64BIT],,[Define if 64-bit mode is supported])
 ])
 
+AC_ARG_ENABLE([rvc], AS_HELP_STRING([--disable-rvc], [Disable instruction compression]))
+AS_IF([test "x$enable_rvc" != "xno"], [
+  AC_DEFINE([RISCV_ENABLE_RVC],,[Define if instruction compression is supported])
+])
+
 libopc=`dirname \`which riscv-gcc\``/../`$ac_config_guess`/riscv/lib/libopcodes.a
 AC_CHECK_FILES([$libopc],[have_libopcodes="yes"],[have_libopcodes="no"])
 
index 61b44360f6cb139828be09152d28ee0fecf593e6..a5c32125fcbe130d80ba6df8f79736fb1b0f13ea 100644 (file)
@@ -13,7 +13,7 @@
   DECLARE_TRAP(data_address_misaligned), \
   DECLARE_TRAP(load_access_fault), \
   DECLARE_TRAP(store_access_fault), \
-  DECLARE_TRAP(reserved1), \
+  DECLARE_TRAP(trap_vector_disabled), \
   DECLARE_TRAP(reserved2), \
   DECLARE_TRAP(reserved3), \
   DECLARE_TRAP(reserved4), \