From 8f2695a0500587a80b09224befd68c10a4e22686 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Tue, 7 Sep 2010 00:19:19 -0700 Subject: [PATCH] [sim, xcc] branches now have 2-byte-aligned displacements This will facilitate 16-bit instructions later on --- riscv/decode.h | 6 ++++-- riscv/processor.cc | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/riscv/decode.h b/riscv/decode.h index 1b631ae..dffb9be 100644 --- a/riscv/decode.h +++ b/riscv/decode.h @@ -28,6 +28,8 @@ const int SHAMT_BITS = 6; const int FUNCT_BITS = 3; const int FFUNCT_BITS = 5; const int BIGIMM_BITS = 20; +const int BRANCH_ALIGN_BITS = 1; +const int JUMP_ALIGN_BITS = 1; #define SR_ET 0x0000000000000001ULL #define SR_PS 0x0000000000000004ULL @@ -129,8 +131,8 @@ union insn_t #define SIMM ((int32_t)((uint32_t)insn.itype.imm<<(32-IMM_BITS))>>(32-IMM_BITS)) #define SHAMT insn.rtype.shamt #define TARGET insn.jtype.target -#define BRANCH_TARGET (npc + (SIMM*sizeof(insn_t))) -#define JUMP_TARGET ((npc & ~((1<