data.isa revision 7139
17139Sgblack@eecs.umich.edu// Copyright (c) 2010 ARM Limited 27139Sgblack@eecs.umich.edu// All rights reserved 37139Sgblack@eecs.umich.edu// 47139Sgblack@eecs.umich.edu// The license below extends only to copyright in the software and shall 57139Sgblack@eecs.umich.edu// not be construed as granting a license to any other intellectual 67139Sgblack@eecs.umich.edu// property including but not limited to intellectual property relating 77139Sgblack@eecs.umich.edu// to a hardware implementation of the functionality of the software 87139Sgblack@eecs.umich.edu// licensed hereunder. You may use the software subject to the license 97139Sgblack@eecs.umich.edu// terms below provided that you ensure that this notice is replicated 107139Sgblack@eecs.umich.edu// unmodified and in its entirety in all distributions of the software, 117139Sgblack@eecs.umich.edu// modified or unmodified, in source code or in binary form. 127139Sgblack@eecs.umich.edu// 137139Sgblack@eecs.umich.edu// Redistribution and use in source and binary forms, with or without 147139Sgblack@eecs.umich.edu// modification, are permitted provided that the following conditions are 157139Sgblack@eecs.umich.edu// met: redistributions of source code must retain the above copyright 167139Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer; 177139Sgblack@eecs.umich.edu// redistributions in binary form must reproduce the above copyright 187139Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer in the 197139Sgblack@eecs.umich.edu// documentation and/or other materials provided with the distribution; 207139Sgblack@eecs.umich.edu// neither the name of the copyright holders nor the names of its 217139Sgblack@eecs.umich.edu// contributors may be used to endorse or promote products derived from 227139Sgblack@eecs.umich.edu// this software without specific prior written permission. 237139Sgblack@eecs.umich.edu// 247139Sgblack@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 257139Sgblack@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 267139Sgblack@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 277139Sgblack@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 287139Sgblack@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 297139Sgblack@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 307139Sgblack@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 317139Sgblack@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 327139Sgblack@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 337139Sgblack@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 347139Sgblack@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 357139Sgblack@eecs.umich.edu// 367139Sgblack@eecs.umich.edu// Authors: Gabe Black 377139Sgblack@eecs.umich.edu 387139Sgblack@eecs.umich.edudef format ArmDataProcReg() {{ 397139Sgblack@eecs.umich.edu instDecode = ''' 407139Sgblack@eecs.umich.edu case %(opcode)#x: 417139Sgblack@eecs.umich.edu if (immShift) { 427139Sgblack@eecs.umich.edu if (setCc) { 437139Sgblack@eecs.umich.edu return new %(className)sDRegCc(machInst, 447139Sgblack@eecs.umich.edu rd, rn, rm, imm5, type); 457139Sgblack@eecs.umich.edu } else { 467139Sgblack@eecs.umich.edu return new %(className)sDReg(machInst, 477139Sgblack@eecs.umich.edu rd, rn, rm, imm5, type); 487139Sgblack@eecs.umich.edu } 497139Sgblack@eecs.umich.edu } else { 507139Sgblack@eecs.umich.edu if (setCc) { 517139Sgblack@eecs.umich.edu return new %(className)sDRegRegCc(machInst, 527139Sgblack@eecs.umich.edu rd, rn, rm, rs, type); 537139Sgblack@eecs.umich.edu } else { 547139Sgblack@eecs.umich.edu return new %(className)sDRegReg(machInst, 557139Sgblack@eecs.umich.edu rd, rn, rm, rs, type); 567139Sgblack@eecs.umich.edu } 577139Sgblack@eecs.umich.edu } 587139Sgblack@eecs.umich.edu break; 597139Sgblack@eecs.umich.edu ''' 607139Sgblack@eecs.umich.edu 617139Sgblack@eecs.umich.edu def instCode(opcode, mnem): 627139Sgblack@eecs.umich.edu global instDecode 637139Sgblack@eecs.umich.edu return instDecode % { "className": mnem.capitalize(), 647139Sgblack@eecs.umich.edu "opcode": opcode } 657139Sgblack@eecs.umich.edu 667139Sgblack@eecs.umich.edu decode_block = ''' 677139Sgblack@eecs.umich.edu { 687139Sgblack@eecs.umich.edu const bool immShift = (bits(machInst, 4) == 0); 697139Sgblack@eecs.umich.edu const bool setCc = (bits(machInst, 20) == 1); 707139Sgblack@eecs.umich.edu const uint32_t imm5 = bits(machInst, 11, 7); 717139Sgblack@eecs.umich.edu const ArmShiftType type = (ArmShiftType)(uint32_t)bits(machInst, 6, 5); 727139Sgblack@eecs.umich.edu const IntRegIndex rd = (IntRegIndex)(uint32_t)RD; 737139Sgblack@eecs.umich.edu const IntRegIndex rn = (IntRegIndex)(uint32_t)RN; 747139Sgblack@eecs.umich.edu const IntRegIndex rm = (IntRegIndex)(uint32_t)RM; 757139Sgblack@eecs.umich.edu const IntRegIndex rs = (IntRegIndex)(uint32_t)RS; 767139Sgblack@eecs.umich.edu switch (OPCODE) { 777139Sgblack@eecs.umich.edu ''' 787139Sgblack@eecs.umich.edu decode_block += instCode(0x0, "and") 797139Sgblack@eecs.umich.edu decode_block += instCode(0x1, "eor") 807139Sgblack@eecs.umich.edu decode_block += instCode(0x2, "sub") 817139Sgblack@eecs.umich.edu decode_block += instCode(0x3, "rsb") 827139Sgblack@eecs.umich.edu decode_block += instCode(0x4, "add") 837139Sgblack@eecs.umich.edu decode_block += instCode(0x5, "adc") 847139Sgblack@eecs.umich.edu decode_block += instCode(0x6, "sbc") 857139Sgblack@eecs.umich.edu decode_block += instCode(0x7, "rsc") 867139Sgblack@eecs.umich.edu decode_block += instCode(0x8, "tst") 877139Sgblack@eecs.umich.edu decode_block += instCode(0x9, "teq") 887139Sgblack@eecs.umich.edu decode_block += instCode(0xa, "cmp") 897139Sgblack@eecs.umich.edu decode_block += instCode(0xb, "cmn") 907139Sgblack@eecs.umich.edu decode_block += instCode(0xc, "orr") 917139Sgblack@eecs.umich.edu decode_block += instCode(0xd, "mov") 927139Sgblack@eecs.umich.edu decode_block += instCode(0xe, "bic") 937139Sgblack@eecs.umich.edu decode_block += instCode(0xf, "mvn") 947139Sgblack@eecs.umich.edu decode_block += ''' 957139Sgblack@eecs.umich.edu default: 967139Sgblack@eecs.umich.edu return new Unknown(machInst); 977139Sgblack@eecs.umich.edu } 987139Sgblack@eecs.umich.edu } 997139Sgblack@eecs.umich.edu ''' 1007139Sgblack@eecs.umich.edu}}; 1017139Sgblack@eecs.umich.edu 1027139Sgblack@eecs.umich.edudef format ArmDataProcImm() {{ 1037139Sgblack@eecs.umich.edu instDecode = ''' 1047139Sgblack@eecs.umich.edu case %(opcode)#x: 1057139Sgblack@eecs.umich.edu if (setCc) { 1067139Sgblack@eecs.umich.edu return new %(className)sDImmCc(machInst, rd, rn, imm, rotC); 1077139Sgblack@eecs.umich.edu } else { 1087139Sgblack@eecs.umich.edu return new %(className)sDImm(machInst, rd, rn, imm, rotC); 1097139Sgblack@eecs.umich.edu } 1107139Sgblack@eecs.umich.edu break; 1117139Sgblack@eecs.umich.edu ''' 1127139Sgblack@eecs.umich.edu 1137139Sgblack@eecs.umich.edu def instCode(opcode, mnem): 1147139Sgblack@eecs.umich.edu global instDecode 1157139Sgblack@eecs.umich.edu return instDecode % { "className": mnem.capitalize(), 1167139Sgblack@eecs.umich.edu "opcode": opcode } 1177139Sgblack@eecs.umich.edu 1187139Sgblack@eecs.umich.edu decode_block = ''' 1197139Sgblack@eecs.umich.edu { 1207139Sgblack@eecs.umich.edu const bool setCc = (bits(machInst, 20) == 1); 1217139Sgblack@eecs.umich.edu const uint32_t unrotated = bits(machInst, 7, 0); 1227139Sgblack@eecs.umich.edu const uint32_t rotation = (bits(machInst, 11, 8) << 1); 1237139Sgblack@eecs.umich.edu const bool rotC = (rotation != 0); 1247139Sgblack@eecs.umich.edu const uint32_t imm = rotate_imm(unrotated, rotation); 1257139Sgblack@eecs.umich.edu const IntRegIndex rd = (IntRegIndex)(uint32_t)RD; 1267139Sgblack@eecs.umich.edu const IntRegIndex rn = (IntRegIndex)(uint32_t)RN; 1277139Sgblack@eecs.umich.edu switch (OPCODE) { 1287139Sgblack@eecs.umich.edu ''' 1297139Sgblack@eecs.umich.edu decode_block += instCode(0x0, "and") 1307139Sgblack@eecs.umich.edu decode_block += instCode(0x1, "eor") 1317139Sgblack@eecs.umich.edu decode_block += instCode(0x2, "sub") 1327139Sgblack@eecs.umich.edu decode_block += instCode(0x3, "rsb") 1337139Sgblack@eecs.umich.edu decode_block += instCode(0x4, "add") 1347139Sgblack@eecs.umich.edu decode_block += instCode(0x5, "adc") 1357139Sgblack@eecs.umich.edu decode_block += instCode(0x6, "sbc") 1367139Sgblack@eecs.umich.edu decode_block += instCode(0x7, "rsc") 1377139Sgblack@eecs.umich.edu decode_block += instCode(0x8, "tst") 1387139Sgblack@eecs.umich.edu decode_block += instCode(0x9, "teq") 1397139Sgblack@eecs.umich.edu decode_block += instCode(0xa, "cmp") 1407139Sgblack@eecs.umich.edu decode_block += instCode(0xb, "cmn") 1417139Sgblack@eecs.umich.edu decode_block += instCode(0xc, "orr") 1427139Sgblack@eecs.umich.edu decode_block += instCode(0xd, "mov") 1437139Sgblack@eecs.umich.edu decode_block += instCode(0xe, "bic") 1447139Sgblack@eecs.umich.edu decode_block += instCode(0xf, "mvn") 1457139Sgblack@eecs.umich.edu decode_block += ''' 1467139Sgblack@eecs.umich.edu default: 1477139Sgblack@eecs.umich.edu return new Unknown(machInst); 1487139Sgblack@eecs.umich.edu } 1497139Sgblack@eecs.umich.edu } 1507139Sgblack@eecs.umich.edu ''' 1517139Sgblack@eecs.umich.edu}}; 152