From 664a94055ebcea876c455f07eae1de12b97ee210 Mon Sep 17 00:00:00 2001 From: Sandipan Das Date: Thu, 7 Jun 2018 20:03:01 +0530 Subject: [PATCH] arch-power: Add branch target address register instructions This adds the definition of the Target Address Register (TAR) and the following instructions that are associated with it: * Move To Target Address Register (mttar) * Move From Target Address Register (mftar) * Branch Conditional to Branch Target Address Register (bctar[l]) Change-Id: I5130a22040e30a05e963b1cc8d38abbed9a49edb Signed-off-by: Sandipan Das --- src/arch/power/isa/decoder.isa | 3 +++ src/arch/power/isa/operands.isa | 3 ++- src/arch/power/registers.hh | 5 +++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/arch/power/isa/decoder.isa b/src/arch/power/isa/decoder.isa index a8ba67141..6b2ebf4fe 100644 --- a/src/arch/power/isa/decoder.isa +++ b/src/arch/power/isa/decoder.isa @@ -58,6 +58,7 @@ decode PO default Unknown::unknown() { format BranchRegCondOp { 16: bclr({{ NIA = LR & -4ULL; }}, true, [ IsReturn ]); 528: bcctr({{ NIA = CTR & -4ULL; }}); + 560: bctar({{ NIA = TAR & -4ULL; }}, true); } // Condition register manipulation instructions. @@ -705,11 +706,13 @@ decode PO default Unknown::unknown() { 0x20: mfxer({{ Rt = XER; }}); 0x100: mflr({{ Rt = LR; }}); 0x120: mfctr({{ Rt = CTR; }}); + 0x32f: mftar({{ Rt = TAR; }}); } 467: decode SPR { 0x20: mtxer({{ XER = Rs; }}); 0x100: mtlr({{ LR = Rs; }}); 0x120: mtctr({{ CTR = Rs; }}); + 0x32f: mttar({{ TAR = Rs; }}); } } diff --git a/src/arch/power/isa/operands.isa b/src/arch/power/isa/operands.isa index c2a45b943..d45cc11a7 100644 --- a/src/arch/power/isa/operands.isa +++ b/src/arch/power/isa/operands.isa @@ -65,9 +65,10 @@ def operands {{ # Control registers 'CR': ('IntReg', 'uw', 'INTREG_CR', 'IsInteger', 9), + 'XER': ('IntReg', 'uw', 'INTREG_XER', 'IsInteger', 9), 'LR': ('IntReg', 'ud', 'INTREG_LR', 'IsInteger', 9), 'CTR': ('IntReg', 'ud', 'INTREG_CTR', 'IsInteger', 9), - 'XER': ('IntReg', 'uw', 'INTREG_XER', 'IsInteger', 9), + 'TAR': ('IntReg', 'ud', 'INTREG_TAR', 'IsInteger', 9), # Setting as IntReg so things are stored as an integer, not double 'FPSCR': ('IntReg', 'uw', 'INTREG_FPSCR', 'IsFloating', 9), diff --git a/src/arch/power/registers.hh b/src/arch/power/registers.hh index 4e8c9e9f4..20eae565b 100644 --- a/src/arch/power/registers.hh +++ b/src/arch/power/registers.hh @@ -66,9 +66,9 @@ constexpr unsigned NumVecRegs = 1; // Constants Related to the number of registers const int NumIntArchRegs = 32; -// CR, XER, LR, CTR, FPSCR, RSV, RSV-LEN, RSV-ADDR +// CR, XER, LR, CTR, TAR, FPSCR, RSV, RSV-LEN, RSV-ADDR // and zero register, which doesn't actually exist but needs a number -const int NumIntSpecialRegs = 9; +const int NumIntSpecialRegs = 10; const int NumFloatArchRegs = 32; const int NumFloatSpecialRegs = 0; const int NumInternalProcRegs = 0; @@ -106,6 +106,7 @@ enum MiscIntRegNums { INTREG_XER, INTREG_LR, INTREG_CTR, + INTREG_TAR, INTREG_FPSCR, INTREG_RSV, INTREG_RSV_LEN, -- 2.30.2