vfp.isa revision 7848:cc5e64f8423f
11689SN/A// -*- mode:c++ -*- 21689SN/A 31689SN/A// Copyright (c) 2010 ARM Limited 41689SN/A// All rights reserved 51689SN/A// 61689SN/A// The license below extends only to copyright in the software and shall 71689SN/A// not be construed as granting a license to any other intellectual 81689SN/A// property including but not limited to intellectual property relating 91689SN/A// to a hardware implementation of the functionality of the software 101689SN/A// licensed hereunder. You may use the software subject to the license 111689SN/A// terms below provided that you ensure that this notice is replicated 121689SN/A// unmodified and in its entirety in all distributions of the software, 131689SN/A// modified or unmodified, in source code or in binary form. 141689SN/A// 151689SN/A// Redistribution and use in source and binary forms, with or without 161689SN/A// modification, are permitted provided that the following conditions are 171689SN/A// met: redistributions of source code must retain the above copyright 181689SN/A// notice, this list of conditions and the following disclaimer; 191689SN/A// redistributions in binary form must reproduce the above copyright 201689SN/A// notice, this list of conditions and the following disclaimer in the 211689SN/A// documentation and/or other materials provided with the distribution; 221689SN/A// neither the name of the copyright holders nor the names of its 231689SN/A// contributors may be used to endorse or promote products derived from 241689SN/A// this software without specific prior written permission. 251689SN/A// 261689SN/A// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 271689SN/A// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 281689SN/A// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 292292SN/A// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 302292SN/A// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 311060SN/A// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 322165SN/A// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 332170SN/A// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 342669Sktlim@umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 351681SN/A// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 361858SN/A// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 371717SN/A// 381060SN/A// Authors: Gabe Black 391858SN/A 401681SN/Alet {{ 411681SN/A vfpEnabledCheckCode = ''' 421681SN/A if (!vfpEnabled(Cpacr, Cpsr, Fpexc)) 431063SN/A return disabledFault(); 442292SN/A ''' 451060SN/A 462292SN/A vmsrEnabledCheckCode = ''' 472292SN/A if (!vfpEnabled(Cpacr, Cpsr)) 482669Sktlim@umich.edu if (dest != (int)MISCREG_FPEXC && dest != (int)MISCREG_FPSID) 492669Sktlim@umich.edu return disabledFault(); 502292SN/A if (!inPrivilegedMode(Cpsr)) 511061SN/A if (dest != (int)MISCREG_FPSCR) 521060SN/A return disabledFault(); 531060SN/A 542107SN/A ''' 552107SN/A 562107SN/A vmrsEnabledCheckCode = ''' 572669Sktlim@umich.edu if (!vfpEnabled(Cpacr, Cpsr)) 582107SN/A if (op1 != (int)MISCREG_FPEXC && op1 != (int)MISCREG_FPSID && 592159SN/A op1 != (int)MISCREG_MVFR0 && op1 != (int)MISCREG_MVFR1) 602669Sktlim@umich.edu return disabledFault(); 612669Sktlim@umich.edu if (!inPrivilegedMode(Cpsr)) 622669Sktlim@umich.edu if (op1 != (int)MISCREG_FPSCR) 632669Sktlim@umich.edu return disabledFault(); 642669Sktlim@umich.edu ''' 652669Sktlim@umich.edu}}; 662292SN/A 672292SN/Adef template FpRegRegOpDeclare {{ 682159SN/Aclass %(class_name)s : public %(base_class)s 692292SN/A{ 702292SN/A public: 711060SN/A // Constructor 721681SN/A %(class_name)s(ExtMachInst machInst, 731060SN/A IntRegIndex _dest, IntRegIndex _op1, 742292SN/A VfpMicroMode mode = VfpNotAMicroop); 752292SN/A %(BasicExecDeclare)s 762292SN/A}; 772292SN/A}}; 781060SN/A 791060SN/Adef template FpRegRegOpConstructor {{ 801060SN/A inline %(class_name)s::%(class_name)s(ExtMachInst machInst, 811060SN/A IntRegIndex _dest, IntRegIndex _op1, 821060SN/A VfpMicroMode mode) 831060SN/A : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 841060SN/A _dest, _op1, mode) 851060SN/A { 861060SN/A %(constructor)s; 871060SN/A if (!(condCode == COND_AL || condCode == COND_UC)) { 881060SN/A for (int x = 0; x < _numDestRegs; x++) { 891060SN/A _srcRegIdx[_numSrcRegs++] = _destRegIdx[x]; 902292SN/A } 911060SN/A } 921060SN/A } 931061SN/A}}; 941061SN/A 951060SN/Adef template FpRegImmOpDeclare {{ 961060SN/Aclass %(class_name)s : public %(base_class)s 971060SN/A{ 981060SN/A public: 991060SN/A // Constructor 1002455SN/A %(class_name)s(ExtMachInst machInst, IntRegIndex _dest, 1011060SN/A uint64_t _imm, VfpMicroMode mode = VfpNotAMicroop); 1021060SN/A %(BasicExecDeclare)s 1031060SN/A}; 1041060SN/A}}; 1051062SN/A 1061061SN/Adef template FpRegImmOpConstructor {{ 1072669Sktlim@umich.edu inline %(class_name)s::%(class_name)s(ExtMachInst machInst, 1081060SN/A IntRegIndex _dest, uint64_t _imm, VfpMicroMode mode) 1092455SN/A : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 1102455SN/A _dest, _imm, mode) 1112455SN/A { 1122455SN/A %(constructor)s; 1131060SN/A if (!(condCode == COND_AL || condCode == COND_UC)) { 1141060SN/A for (int x = 0; x < _numDestRegs; x++) { 1152292SN/A _srcRegIdx[_numSrcRegs++] = _destRegIdx[x]; 1162455SN/A } 1171060SN/A } 1181060SN/A } 1191060SN/A}}; 1201060SN/A 1211062SN/Adef template FpRegRegImmOpDeclare {{ 1221061SN/Aclass %(class_name)s : public %(base_class)s 1232669Sktlim@umich.edu{ 1241060SN/A public: 1252455SN/A // Constructor 1262455SN/A %(class_name)s(ExtMachInst machInst, 1272455SN/A IntRegIndex _dest, IntRegIndex _op1, 1282455SN/A uint64_t _imm, VfpMicroMode mode = VfpNotAMicroop); 1291060SN/A %(BasicExecDeclare)s 1301060SN/A}; 1312292SN/A}}; 1322455SN/A 1331060SN/Adef template FpRegRegImmOpConstructor {{ 1341060SN/A inline %(class_name)s::%(class_name)s(ExtMachInst machInst, 1351060SN/A IntRegIndex _dest, 1361060SN/A IntRegIndex _op1, 1371062SN/A uint64_t _imm, 1381061SN/A VfpMicroMode mode) 1392669Sktlim@umich.edu : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 1401060SN/A _dest, _op1, _imm, mode) 1412455SN/A { 1422455SN/A %(constructor)s; 1432455SN/A if (!(condCode == COND_AL || condCode == COND_UC)) { 1442455SN/A for (int x = 0; x < _numDestRegs; x++) { 1452455SN/A _srcRegIdx[_numSrcRegs++] = _destRegIdx[x]; 1462455SN/A } 1472455SN/A } 1482455SN/A } 1492455SN/A}}; 1502455SN/A 1512455SN/Adef template FpRegRegRegOpDeclare {{ 1522455SN/Aclass %(class_name)s : public %(base_class)s 1532455SN/A{ 1542669Sktlim@umich.edu public: 1552455SN/A // Constructor 1562455SN/A %(class_name)s(ExtMachInst machInst, 1572455SN/A IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _op2, 1582455SN/A VfpMicroMode mode = VfpNotAMicroop); 1592455SN/A %(BasicExecDeclare)s 1601060SN/A}; 1611060SN/A}}; 1622292SN/A 1631060SN/Adef template FpRegRegRegOpConstructor {{ 1641060SN/A inline %(class_name)s::%(class_name)s(ExtMachInst machInst, 1651061SN/A IntRegIndex _dest, 1661061SN/A IntRegIndex _op1, 1671060SN/A IntRegIndex _op2, 1681060SN/A VfpMicroMode mode) 1691060SN/A : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 1702292SN/A _dest, _op1, _op2, mode) 1712292SN/A { 1721060SN/A %(constructor)s; 1731060SN/A if (!(condCode == COND_AL || condCode == COND_UC)) { 1742292SN/A for (int x = 0; x < _numDestRegs; x++) { 1752455SN/A _srcRegIdx[_numSrcRegs++] = _destRegIdx[x]; 1761060SN/A } 1771060SN/A } 1781060SN/A } 1791060SN/A}}; 1801062SN/A