[xcc, sim] branches now are next-PC-based, not PC-based
authorAndrew Waterman <waterman@s141.Millennium.Berkeley.EDU>
Mon, 13 Sep 2010 00:03:47 +0000 (17:03 -0700)
committerAndrew Waterman <waterman@s141.Millennium.Berkeley.EDU>
Mon, 13 Sep 2010 00:03:47 +0000 (17:03 -0700)
riscv/decode.h
riscv/execute.h
riscv/insns/rdnpc.h [new file with mode: 0644]
riscv/insns/rdpc.h [deleted file]

index e22a05ab748700b82165f4020b970a60501abcca..ddf4eca0791227c5a74aaf16f1d92cadd770195e 100644 (file)
@@ -141,8 +141,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 (pc + (SIMM << BRANCH_ALIGN_BITS))
-#define JUMP_TARGET ((pc & ~((1<<(TARGET_BITS+JUMP_ALIGN_BITS))-1)) + (TARGET << JUMP_ALIGN_BITS))
+#define BRANCH_TARGET (npc + (SIMM << BRANCH_ALIGN_BITS))
+#define JUMP_TARGET ((npc & ~((1<<(TARGET_BITS+JUMP_ALIGN_BITS))-1)) + (TARGET << JUMP_ALIGN_BITS))
 
 #define require_supervisor if(!(sr & SR_S)) throw trap_privileged_instruction
 #define require64 if(gprlen != 64) throw trap_illegal_instruction
index 9a50b998a6f82753652a9e80be76ef9ae4d5564e..ae2511f753a89fcda682edf0e9a3bc838401ae02 100644 (file)
@@ -176,6 +176,11 @@ switch((insn.bits >> 0x19) & 0x7f)
           #include "insns/sgninj_d.h"
           break;
         }
+        if((insn.bits & 0xfe007fe0) == 0xd0006060)
+        {
+          #include "insns/div_d.h"
+          break;
+        }
         if((insn.bits & 0xfe007fe0) == 0xd0006820)
         {
           #include "insns/c_eq_d.h"
@@ -246,11 +251,6 @@ switch((insn.bits >> 0x19) & 0x7f)
           #include "insns/sqrt_d.h"
           break;
         }
-        if((insn.bits & 0xfe007fe0) == 0xd0006060)
-        {
-          #include "insns/div_d.h"
-          break;
-        }
         if((insn.bits & 0xfe0fffe0) == 0xd00064c0)
         {
           #include "insns/cvt_d_w.h"
@@ -984,7 +984,7 @@ switch((insn.bits >> 0x19) & 0x7f)
       {
         if((insn.bits & 0xffffffe0) == 0xf6001000)
         {
-          #include "insns/rdpc.h"
+          #include "insns/rdnpc.h"
           break;
         }
         #include "insns/unimp.h"
diff --git a/riscv/insns/rdnpc.h b/riscv/insns/rdnpc.h
new file mode 100644 (file)
index 0000000..95e528a
--- /dev/null
@@ -0,0 +1 @@
+RC = npc;
diff --git a/riscv/insns/rdpc.h b/riscv/insns/rdpc.h
deleted file mode 100644 (file)
index 95e528a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-RC = npc;