uncond.isa revision 7308
1360SN/A// Copyright (c) 2010 ARM Limited 21458SN/A// All rights reserved 3360SN/A// 4360SN/A// The license below extends only to copyright in the software and shall 5360SN/A// not be construed as granting a license to any other intellectual 6360SN/A// property including but not limited to intellectual property relating 7360SN/A// to a hardware implementation of the functionality of the software 8360SN/A// licensed hereunder. You may use the software subject to the license 9360SN/A// terms below provided that you ensure that this notice is replicated 10360SN/A// unmodified and in its entirety in all distributions of the software, 11360SN/A// modified or unmodified, in source code or in binary form. 12360SN/A// 13360SN/A// Redistribution and use in source and binary forms, with or without 14360SN/A// modification, are permitted provided that the following conditions are 15360SN/A// met: redistributions of source code must retain the above copyright 16360SN/A// notice, this list of conditions and the following disclaimer; 17360SN/A// redistributions in binary form must reproduce the above copyright 18360SN/A// notice, this list of conditions and the following disclaimer in the 19360SN/A// documentation and/or other materials provided with the distribution; 20360SN/A// neither the name of the copyright holders nor the names of its 21360SN/A// contributors may be used to endorse or promote products derived from 22360SN/A// this software without specific prior written permission. 23360SN/A// 24360SN/A// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25360SN/A// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26360SN/A// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 272665Ssaidi@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 282665Ssaidi@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 292665Ssaidi@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30360SN/A// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31360SN/A// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 321354SN/A// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 331354SN/A// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34360SN/A// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 352764Sstever@eecs.umich.edu// 362764Sstever@eecs.umich.edu// Authors: Gabe Black 372064SN/A 38360SN/Adef format ArmUnconditional() {{ 39360SN/A decode_block = ''' 40360SN/A { 41360SN/A const IntRegIndex rn = (IntRegIndex)(uint32_t)bits(machInst, 19, 16); 42360SN/A const uint32_t op1 = bits(machInst, 27, 20); 43360SN/A if (bits(op1, 7) == 0) { 441809SN/A const uint32_t op2 = bits(machInst, 7, 4); 455543Ssaidi@eecs.umich.edu if (op1 == 0x10) { 461809SN/A if (bits((uint32_t)rn, 0) == 1 && op2 == 0) { 473113Sgblack@eecs.umich.edu return new Setend(machInst, bits(machInst, 9)); 487075Snate@binkert.org } else if (bits((uint32_t)rn, 0) == 0 && bits(op2, 1) == 0) { 493113Sgblack@eecs.umich.edu return new WarnUnimplemented("cps", machInst); 501999SN/A } 517075Snate@binkert.org } else if (bits(op1, 6, 5) == 0x1) { 527075Snate@binkert.org return new WarnUnimplemented( 537075Snate@binkert.org "Advanced SIMD data-processing", machInst); 54360SN/A } else if (bits(op1, 6, 4) == 0x4) { 552474SN/A if (bits(op1, 0) == 0) { 565543Ssaidi@eecs.umich.edu return new WarnUnimplemented( 572462SN/A "Advanced SIMD element or structure load/store", 581354SN/A machInst); 596216Snate@binkert.org } else if (bits(op1, 2, 0) == 1) { 606658Snate@binkert.org // Unallocated memory hint 612474SN/A return new NopInst(machInst); 622680Sktlim@umich.edu } else if (bits(op1, 2, 0) == 5) { 632474SN/A const bool add = bits(machInst, 23); 642474SN/A const uint32_t imm12 = bits(machInst, 11, 0); 656640Svince@csl.cornell.edu if (add) { 661354SN/A return new %(pli_iadd)s(machInst, INTREG_ZERO, 67360SN/A rn, add, imm12); 68360SN/A } else { 69360SN/A return new %(pli_isub)s(machInst, INTREG_ZERO, 70360SN/A rn, add, imm12); 71360SN/A } 72360SN/A } 73360SN/A } else if (bits(op1, 6, 4) == 0x5) { 74360SN/A if (bits(op1, 1, 0) == 0x1) { 75378SN/A const bool add = bits(machInst, 23); 761450SN/A const bool pldw = bits(machInst, 22); 773114Sgblack@eecs.umich.edu const uint32_t imm12 = bits(machInst, 11, 0); 78360SN/A if (pldw) { 795543Ssaidi@eecs.umich.edu if (add) { 805543Ssaidi@eecs.umich.edu return new %(pldw_iadd)s(machInst, INTREG_ZERO, 815543Ssaidi@eecs.umich.edu rn, add, imm12); 82360SN/A } else { 83360SN/A return new %(pldw_isub)s(machInst, INTREG_ZERO, 84360SN/A rn, add, imm12); 85360SN/A } 86360SN/A } else { 872680Sktlim@umich.edu if (add) { 88360SN/A return new %(pld_iadd)s(machInst, INTREG_ZERO, 89360SN/A rn, add, imm12); 90360SN/A } else { 91360SN/A return new %(pld_isub)s(machInst, INTREG_ZERO, 92360SN/A rn, add, imm12); 93360SN/A } 94360SN/A } 95360SN/A } else if (op1 == 0x57) { 96360SN/A switch (op2) { 97360SN/A case 0x1: 98360SN/A return new WarnUnimplemented("clrex", machInst); 993114Sgblack@eecs.umich.edu case 0x4: 100360SN/A return new WarnUnimplemented("dsb", machInst); 101360SN/A case 0x5: 102360SN/A return new WarnUnimplemented("dmb", machInst); 103360SN/A case 0x6: 104360SN/A return new WarnUnimplemented("isb", machInst); 105360SN/A } 106360SN/A } 107360SN/A } else if (bits(op2, 0) == 0) { 108360SN/A switch (op1 & 0xf7) { 109360SN/A case 0x61: 110360SN/A // Unallocated memory hint 111360SN/A return new NopInst(machInst); 112360SN/A case 0x65: 113360SN/A { 114360SN/A const uint32_t imm5 = bits(machInst, 11, 7); 115360SN/A const uint32_t type = bits(machInst, 6, 5); 116360SN/A const bool add = bits(machInst, 23); 117360SN/A const IntRegIndex rm = 118360SN/A (IntRegIndex)(uint32_t)bits(machInst, 3, 0); 119360SN/A if (add) { 120360SN/A return new %(pli_radd)s(machInst, INTREG_ZERO, rn, 1212400SN/A add, imm5, type, rm); 122360SN/A } else { 1232461SN/A return new %(pli_rsub)s(machInst, INTREG_ZERO, rn, 1245543Ssaidi@eecs.umich.edu add, imm5, type, rm); 125360SN/A } 126360SN/A } 127360SN/A case 0x71: 128360SN/A case 0x75: 129360SN/A { 1302400SN/A const uint32_t imm5 = bits(machInst, 11, 7); 131360SN/A const uint32_t type = bits(machInst, 6, 5); 1322461SN/A const bool add = bits(machInst, 23); 1335543Ssaidi@eecs.umich.edu const bool pldw = bits(machInst, 22); 134360SN/A const IntRegIndex rm = 135360SN/A (IntRegIndex)(uint32_t)bits(machInst, 3, 0); 136360SN/A if (pldw) { 137360SN/A if (add) { 138360SN/A return new %(pldw_radd)s(machInst, INTREG_ZERO, 139360SN/A rn, add, imm5, 140360SN/A type, rm); 141360SN/A } else { 142360SN/A return new %(pldw_rsub)s(machInst, INTREG_ZERO, 143360SN/A rn, add, imm5, 144360SN/A type, rm); 145360SN/A } 146360SN/A } else { 1475543Ssaidi@eecs.umich.edu if (add) { 148360SN/A return new %(pld_radd)s(machInst, INTREG_ZERO, 149360SN/A rn, add, imm5, 150360SN/A type, rm); 151360SN/A } else { 152360SN/A return new %(pld_rsub)s(machInst, INTREG_ZERO, 153360SN/A rn, add, imm5, 154360SN/A type, rm); 155360SN/A } 156360SN/A } 157360SN/A } 158360SN/A } 159360SN/A } 160360SN/A } else { 161360SN/A switch (bits(machInst, 26, 25)) { 162360SN/A case 0x0: 163360SN/A { 164360SN/A const uint32_t val = ((machInst >> 20) & 0x5); 1655543Ssaidi@eecs.umich.edu if (val == 0x4) { 1665543Ssaidi@eecs.umich.edu return new WarnUnimplemented("srs", machInst); 167502SN/A } else if (val == 0x1) { 168360SN/A switch (bits(machInst, 24, 21)) { 169360SN/A case 0x0: 170360SN/A return new %(rfe)s(machInst, rn, 171360SN/A RfeOp::DecrementAfter, false); 172360SN/A case 0x1: 173360SN/A return new %(rfe_w)s(machInst, rn, 174360SN/A RfeOp::DecrementAfter, true); 175360SN/A case 0x4: 176360SN/A return new %(rfe_u)s(machInst, rn, 177360SN/A RfeOp::IncrementAfter, false); 178360SN/A case 0x5: 179378SN/A return new %(rfe_uw)s(machInst, rn, 1801706SN/A RfeOp::IncrementAfter, true); 1813114Sgblack@eecs.umich.edu case 0x8: 182378SN/A return new %(rfe_p)s(machInst, rn, 183378SN/A RfeOp::DecrementBefore, false); 184378SN/A case 0x9: 185378SN/A return new %(rfe_pw)s(machInst, rn, 186378SN/A RfeOp::DecrementBefore, true); 1871706SN/A case 0xc: 1883114Sgblack@eecs.umich.edu return new %(rfe_pu)s(machInst, rn, 189360SN/A RfeOp::IncrementBefore, false); 1906109Ssanchezd@stanford.edu case 0xd: 1911706SN/A return new %(rfe_puw)s(machInst, rn, 1923114Sgblack@eecs.umich.edu RfeOp::IncrementBefore, true); 193378SN/A } 1946109Ssanchezd@stanford.edu return new Unknown(machInst); 1956109Ssanchezd@stanford.edu } 1966109Ssanchezd@stanford.edu } 1976109Ssanchezd@stanford.edu break; 198378SN/A case 0x1: 1991706SN/A { 2003114Sgblack@eecs.umich.edu const uint32_t imm = 201378SN/A (sext<26>(bits(machInst, 23, 0) << 2)) | 2025748SSteve.Reinhardt@amd.com (bits(machInst, 24) << 1); 2035748SSteve.Reinhardt@amd.com return new BlxImm(machInst, imm); 2045748SSteve.Reinhardt@amd.com } 205378SN/A case 0x2: 206378SN/A if (bits(op1, 0) == 1) { 2071706SN/A if (rn == INTREG_PC) { 2083114Sgblack@eecs.umich.edu if (bits(op1, 4, 3) != 0x0) { 209378SN/A return new WarnUnimplemented( 210378SN/A "ldc, ldc2 (literal)", machInst); 2111706SN/A } 2123114Sgblack@eecs.umich.edu } else { 213378SN/A if (op1 == 0xC3 || op1 == 0xC7) { 214378SN/A return new WarnUnimplemented( 2151706SN/A "ldc, ldc2 (immediate)", machInst); 2163114Sgblack@eecs.umich.edu } 217378SN/A } 218378SN/A if (op1 == 0xC5) { 2191706SN/A return new WarnUnimplemented("mrrc, mrrc2", machInst); 2203114Sgblack@eecs.umich.edu } 221378SN/A } else { 2224118Sgblack@eecs.umich.edu if (bits(op1, 4, 3) != 0 || bits(op1, 1) == 1) { 2234118Sgblack@eecs.umich.edu return new WarnUnimplemented("stc, stc2", machInst); 2244118Sgblack@eecs.umich.edu } else if (op1 == 0xC4) { 2254118Sgblack@eecs.umich.edu return new WarnUnimplemented("mcrr, mcrrc", machInst); 226378SN/A } 2271706SN/A } 2283114Sgblack@eecs.umich.edu break; 229378SN/A case 0x3: 230378SN/A { 2311706SN/A const bool op = bits(machInst, 4); 2323114Sgblack@eecs.umich.edu if (op) { 233360SN/A if (bits(op1, 0)) { 2345513SMichael.Adler@intel.com return new WarnUnimplemented( 2355513SMichael.Adler@intel.com "mrc, mrc2", machInst); 2365513SMichael.Adler@intel.com } else { 2375513SMichael.Adler@intel.com return new WarnUnimplemented( 2385513SMichael.Adler@intel.com "mcr, mcr2", machInst); 2395513SMichael.Adler@intel.com } 2405513SMichael.Adler@intel.com } else { 2415513SMichael.Adler@intel.com return new WarnUnimplemented("cdp, cdp2", machInst); 242511SN/A } 2431706SN/A } 2443114Sgblack@eecs.umich.edu break; 245511SN/A } 2465513SMichael.Adler@intel.com } 2475513SMichael.Adler@intel.com return new Unknown(machInst); 2485513SMichael.Adler@intel.com } 2495513SMichael.Adler@intel.com ''' % { 250511SN/A "pli_iadd" : "PLI_" + loadImmClassName(False, True, False, 1), 2511706SN/A "pli_isub" : "PLI_" + loadImmClassName(False, False, False, 1), 2523114Sgblack@eecs.umich.edu "pld_iadd" : "PLD_" + loadImmClassName(False, True, False, 1), 2531706SN/A "pld_isub" : "PLD_" + loadImmClassName(False, False, False, 1), 2541706SN/A "pldw_iadd" : "PLDW_" + loadImmClassName(False, True, False, 1), 2551706SN/A "pldw_isub" : "PLDW_" + loadImmClassName(False, False, False, 1), 2561706SN/A "pli_radd" : "PLI_" + loadRegClassName(False, True, False, 1), 2573114Sgblack@eecs.umich.edu "pli_rsub" : "PLI_" + loadRegClassName(False, False, False, 1), 2581706SN/A "pld_radd" : "PLD_" + loadRegClassName(False, True, False, 1), 2591706SN/A "pld_rsub" : "PLD_" + loadRegClassName(False, False, False, 1), 2601706SN/A "pldw_radd" : "PLDW_" + loadRegClassName(False, True, False, 1), 2611706SN/A "pldw_rsub" : "PLDW_" + loadRegClassName(False, False, False, 1), 2623114Sgblack@eecs.umich.edu "rfe" : "RFE_" + loadImmClassName(True, False, False, 8), 2631706SN/A "rfe_w" : "RFE_" + loadImmClassName(True, False, True, 8), 264511SN/A "rfe_u" : "RFE_" + loadImmClassName(True, True, False, 8), 2656703Svince@csl.cornell.edu "rfe_uw" : "RFE_" + loadImmClassName(True, True, True, 8), 2666703Svince@csl.cornell.edu "rfe_p" : "RFE_" + loadImmClassName(False, False, False, 8), 2676703Svince@csl.cornell.edu "rfe_pw" : "RFE_" + loadImmClassName(False, False, True, 8), 2686703Svince@csl.cornell.edu "rfe_pu" : "RFE_" + loadImmClassName(False, True, False, 8), 2696685Stjones1@inf.ed.ac.uk "rfe_puw" : "RFE_" + loadImmClassName(False, True, True, 8) 2706685Stjones1@inf.ed.ac.uk }; 2716685Stjones1@inf.ed.ac.uk}}; 2726685Stjones1@inf.ed.ac.uk