core: Implement the TAR register and the bctar instruction
authorPaul Mackerras <paulus@ozlabs.org>
Mon, 3 Aug 2020 00:08:33 +0000 (10:08 +1000)
committerPaul Mackerras <paulus@ozlabs.org>
Wed, 5 Aug 2020 05:50:06 +0000 (15:50 +1000)
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
common.vhdl
decode1.vhdl

index e05720b734028e359960939c7743bc592412ea50..bd9210b1ba5ca41c21df8861497594b7c65a9ce7 100644 (file)
@@ -26,6 +26,7 @@ package common is
     constant SPR_XER    : spr_num_t := 1;
     constant SPR_LR     : spr_num_t := 8;
     constant SPR_CTR    : spr_num_t := 9;
+    constant SPR_TAR    : spr_num_t := 815;
     constant SPR_DSISR  : spr_num_t := 18;
     constant SPR_DAR    : spr_num_t := 19;
     constant SPR_TB     : spr_num_t := 268;
@@ -459,6 +460,8 @@ package body common is
            n := 11;
        when SPR_XER =>
            n := 12;
+       when SPR_TAR =>
+           n := 13;
        when others =>
            n := 0;
            return "000000";
index f553e2dd2db7d1d44f5159cb4d87c7af3b242c07..567791710e7ff66ec88540b02ab8f3e7fbb00326 100644 (file)
@@ -94,7 +94,7 @@ architecture behaviour of decode1 is
         2#1100000010# => '1', 2#1100100010# => '1', 2#1101000010# => '1', 2#1101100010# => '1', 2#1110000010# => '1', 2#1110100010# => '1', 2#1111000010# => '1', 2#1111100010# => '1',
         2#1000010000# => '1', -- bcctr
         2#0000010000# => '1', -- bclr
-        2#1000110000# => '0', -- bctar
+        2#1000110000# => '1', -- bctar
         2#0100000001# => '1', -- crand
         2#0010000001# => '1', -- crandc
         2#0100100001# => '1', -- creqv
@@ -467,11 +467,12 @@ begin
                 if f_in.insn(23) = '0' then
                     v.ispr1 := fast_spr_num(SPR_CTR);
                 end if;
-                -- TODO: Add TAR
                 if f_in.insn(10) = '0' then
                     v.ispr2 := fast_spr_num(SPR_LR);
-                else
+                elsif f_in.insn(6) = '0' then
                     v.ispr2 := fast_spr_num(SPR_CTR);
+                else
+                    v.ispr2 := fast_spr_num(SPR_TAR);
                 end if;
             else
                 -- Could be OP_RFID