aboutsummaryrefslogtreecommitdiff
path: root/riscv
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@s144.Millennium.Berkeley.EDU>2010-11-02 12:19:52 -0700
committerAndrew Waterman <waterman@s144.Millennium.Berkeley.EDU>2010-11-21 16:54:32 -0800
commit68f81d8f487c56a71ab2f374114fb513b55dce86 (patch)
tree2472e47a375ccefe71c526d48ab5b1808849ba01 /riscv
parent63844a7558c1ed6c361081b5bc2fbdaf746bd582 (diff)
downloadspike-68f81d8f487c56a71ab2f374114fb513b55dce86.zip
spike-68f81d8f487c56a71ab2f374114fb513b55dce86.tar.gz
spike-68f81d8f487c56a71ab2f374114fb513b55dce86.tar.bz2
[opcodes, pk, sim, xcc] made jumps shorter and PC-relative
Diffstat (limited to 'riscv')
-rw-r--r--riscv/decode.h9
-rw-r--r--riscv/execute.h30
2 files changed, 4 insertions, 35 deletions
diff --git a/riscv/decode.h b/riscv/decode.h
index 3db82da..9278a35 100644
--- a/riscv/decode.h
+++ b/riscv/decode.h
@@ -27,7 +27,6 @@ typedef uint64_t reg_t;
typedef uint64_t freg_t;
const int OPCODE_BITS = 7;
-const int JTYPE_OPCODE_BITS = 5;
const int GPR_BITS = 8*sizeof(reg_t);
const int GPRID_BITS = 5;
@@ -38,7 +37,7 @@ const int FPRID_BITS = 5;
const int NFPR = 1 << FPRID_BITS;
const int IMM_BITS = 12;
-const int TARGET_BITS = 27;
+const int TARGET_BITS = 25;
const int SHAMT_BITS = 6;
const int FUNCT_BITS = 3;
const int FUNCTR_BITS = 7;
@@ -93,8 +92,8 @@ struct itype_t
struct jtype_t
{
- unsigned target : TARGET_BITS;
- unsigned jump_opcode : JTYPE_OPCODE_BITS;
+ signed target : TARGET_BITS;
+ unsigned jump_opcode : OPCODE_BITS;
};
struct rtype_t
@@ -174,7 +173,7 @@ private:
#define SHAMTW (insn.itype.imm12 & 0x1F)
#define TARGET insn.jtype.target
#define BRANCH_TARGET (npc + (SIMM << BRANCH_ALIGN_BITS))
-#define JUMP_TARGET ((npc & ~((1<<(TARGET_BITS+JUMP_ALIGN_BITS))-1)) + (TARGET << JUMP_ALIGN_BITS))
+#define JUMP_TARGET (npc + (TARGET << JUMP_ALIGN_BITS))
#define RM ((insn.ftype.ffunct >> 1) & 3)
#define require_supervisor if(!(sr & SR_S)) throw trap_privileged_instruction
diff --git a/riscv/execute.h b/riscv/execute.h
index 8e583fd..d80c12f 100644
--- a/riscv/execute.h
+++ b/riscv/execute.h
@@ -28,36 +28,6 @@ switch((insn.bits >> 0x19) & 0x7f)
}
case 0x61:
{
- #include "insns/j.h"
- break;
- }
- case 0x62:
- {
- #include "insns/j.h"
- break;
- }
- case 0x63:
- {
- #include "insns/j.h"
- break;
- }
- case 0x64:
- {
- #include "insns/jal.h"
- break;
- }
- case 0x65:
- {
- #include "insns/jal.h"
- break;
- }
- case 0x66:
- {
- #include "insns/jal.h"
- break;
- }
- case 0x67:
- {
#include "insns/jal.h"
break;
}