diff options
author | Andrew Waterman <waterman@s143.Millennium.Berkeley.EDU> | 2012-01-22 18:18:47 -0800 |
---|---|---|
committer | Andrew Waterman <waterman@s143.Millennium.Berkeley.EDU> | 2012-01-22 18:18:47 -0800 |
commit | ed71703766a59469c137d3061321cd9d0f31f4eb (patch) | |
tree | 74b287aadc98e8c50e52a5879d67e3bbe80cb661 | |
parent | e1592aebf6e17542671b2a6d4baeeb86d5df3342 (diff) | |
download | spike-ed71703766a59469c137d3061321cd9d0f31f4eb.zip spike-ed71703766a59469c137d3061321cd9d0f31f4eb.tar.gz spike-ed71703766a59469c137d3061321cd9d0f31f4eb.tar.bz2 |
disentangle decode.h from other headers
-rw-r--r-- | riscv/decode.h | 16 | ||||
-rw-r--r-- | riscv/mmu.h | 1 | ||||
-rw-r--r-- | riscv/processor.h | 15 |
3 files changed, 16 insertions, 16 deletions
diff --git a/riscv/decode.h b/riscv/decode.h index b76617a..6fa0a4b 100644 --- a/riscv/decode.h +++ b/riscv/decode.h @@ -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) diff --git a/riscv/mmu.h b/riscv/mmu.h index 9d648ef..0c61a77 100644 --- a/riscv/mmu.h +++ b/riscv/mmu.h @@ -4,6 +4,7 @@ #include "decode.h" #include "trap.h" #include "common.h" +#include "config.h" #include "processor.h" class processor_t; diff --git a/riscv/processor.h b/riscv/processor.h index a675141..1e007a8 100644 --- a/riscv/processor.h +++ b/riscv/processor.h @@ -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 |