disentangle decode.h from other headers
authorAndrew Waterman <waterman@s143.Millennium.Berkeley.EDU>
Mon, 23 Jan 2012 02:18:47 +0000 (18:18 -0800)
committerAndrew Waterman <waterman@s143.Millennium.Berkeley.EDU>
Mon, 23 Jan 2012 02:18:47 +0000 (18:18 -0800)
riscv/decode.h
riscv/mmu.h
riscv/processor.h

index b76617a9e2631c6df76beaa15856a54094f71c50..6fa0a4bb47b850376a5ac1ee9d2efc33d784f139 100644 (file)
@@ -3,8 +3,6 @@
 
 #define __STDC_LIMIT_MACROS
 #include <stdint.h>
-#include "common.h"
-#include "config.h"
 
 typedef int int128_t __attribute__((mode(TI)));
 typedef unsigned int uint128_t __attribute__((mode(TI)));
@@ -206,20 +204,6 @@ private:
 #define sext_xprlen(x) (((sreg_t)(x) << (64-xprlen)) >> (64-xprlen))
 #define zext_xprlen(x) (((reg_t)(x) << (64-xprlen)) >> (64-xprlen))
 
-#ifndef RISCV_ENABLE_RVC
-# define set_pc(x) \
-  do { if((x) & (sizeof(insn_t)-1)) \
-       { badvaddr = (x); throw trap_instruction_address_misaligned; } \
-       npc = (x); \
-     } while(0)
-#else
-# define set_pc(x) \
-  do { if((x) & ((sr & SR_EC) ? 1 : 3)) \
-       { badvaddr = (x); throw trap_instruction_address_misaligned; } \
-       npc = (x); \
-     } while(0)
-#endif
-
 // RVC stuff
 
 #define INSN_IS_RVC(x) (((x) & 0x3) < 0x3)
index 9d648ef4de657d9d52a12e0c57fed6b2993d7477..0c61a7798d6de859eb3de6b43535bfda890972b3 100644 (file)
@@ -4,6 +4,7 @@
 #include "decode.h"
 #include "trap.h"
 #include "common.h"
+#include "config.h"
 #include "processor.h"
 
 class processor_t;
index a6751410be8e12c10d1ba973b23d71131f407e3e..1e007a8fbdbb1829bdfbb673feaa4687578dbbb4 100644 (file)
@@ -4,6 +4,7 @@
 #include "decode.h"
 #include <cstring>
 #include "trap.h"
+#include "config.h"
 
 #define MAX_UTS 2048
 
@@ -87,4 +88,18 @@ private:
   #include "dispatch.h"
 };
 
+#ifndef RISCV_ENABLE_RVC
+# define set_pc(x) \
+  do { if((x) & (sizeof(insn_t)-1)) \
+       { badvaddr = (x); throw trap_instruction_address_misaligned; } \
+       npc = (x); \
+     } while(0)
+#else
+# define set_pc(x) \
+  do { if((x) & ((sr & SR_EC) ? 1 : 3)) \
+       { badvaddr = (x); throw trap_instruction_address_misaligned; } \
+       npc = (x); \
+     } while(0)
+#endif
+
 #endif