regop.isa revision 4560
14519Sgblack@eecs.umich.edu// Copyright (c) 2007 The Hewlett-Packard Development Company
24519Sgblack@eecs.umich.edu// All rights reserved.
34519Sgblack@eecs.umich.edu//
44519Sgblack@eecs.umich.edu// Redistribution and use of this software in source and binary forms,
54519Sgblack@eecs.umich.edu// with or without modification, are permitted provided that the
64519Sgblack@eecs.umich.edu// following conditions are met:
74519Sgblack@eecs.umich.edu//
84519Sgblack@eecs.umich.edu// The software must be used only for Non-Commercial Use which means any
94519Sgblack@eecs.umich.edu// use which is NOT directed to receiving any direct monetary
104519Sgblack@eecs.umich.edu// compensation for, or commercial advantage from such use.  Illustrative
114519Sgblack@eecs.umich.edu// examples of non-commercial use are academic research, personal study,
124519Sgblack@eecs.umich.edu// teaching, education and corporate research & development.
134519Sgblack@eecs.umich.edu// Illustrative examples of commercial use are distributing products for
144519Sgblack@eecs.umich.edu// commercial advantage and providing services using the software for
154519Sgblack@eecs.umich.edu// commercial advantage.
164519Sgblack@eecs.umich.edu//
174519Sgblack@eecs.umich.edu// If you wish to use this software or functionality therein that may be
184519Sgblack@eecs.umich.edu// covered by patents for commercial use, please contact:
194519Sgblack@eecs.umich.edu//     Director of Intellectual Property Licensing
204519Sgblack@eecs.umich.edu//     Office of Strategy and Technology
214519Sgblack@eecs.umich.edu//     Hewlett-Packard Company
224519Sgblack@eecs.umich.edu//     1501 Page Mill Road
234519Sgblack@eecs.umich.edu//     Palo Alto, California  94304
244519Sgblack@eecs.umich.edu//
254519Sgblack@eecs.umich.edu// Redistributions of source code must retain the above copyright notice,
264519Sgblack@eecs.umich.edu// this list of conditions and the following disclaimer.  Redistributions
274519Sgblack@eecs.umich.edu// in binary form must reproduce the above copyright notice, this list of
284519Sgblack@eecs.umich.edu// conditions and the following disclaimer in the documentation and/or
294519Sgblack@eecs.umich.edu// other materials provided with the distribution.  Neither the name of
304519Sgblack@eecs.umich.edu// the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
314519Sgblack@eecs.umich.edu// contributors may be used to endorse or promote products derived from
324519Sgblack@eecs.umich.edu// this software without specific prior written permission.  No right of
334519Sgblack@eecs.umich.edu// sublicense is granted herewith.  Derivatives of the software and
344519Sgblack@eecs.umich.edu// output created using the software may be prepared, but only for
354519Sgblack@eecs.umich.edu// Non-Commercial Uses.  Derivatives of the software may be shared with
364519Sgblack@eecs.umich.edu// others provided: (i) the others agree to abide by the list of
374519Sgblack@eecs.umich.edu// conditions herein which includes the Non-Commercial Use restrictions;
384519Sgblack@eecs.umich.edu// and (ii) such Derivatives of the software include the above copyright
394519Sgblack@eecs.umich.edu// notice to acknowledge the contribution from this software where
404519Sgblack@eecs.umich.edu// applicable, this list of conditions and the disclaimer below.
414519Sgblack@eecs.umich.edu//
424519Sgblack@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
434519Sgblack@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
444519Sgblack@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
454519Sgblack@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
464519Sgblack@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
474519Sgblack@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
484519Sgblack@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
494519Sgblack@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
504519Sgblack@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
514519Sgblack@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
524519Sgblack@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
534519Sgblack@eecs.umich.edu//
544519Sgblack@eecs.umich.edu// Authors: Gabe Black
554519Sgblack@eecs.umich.edu
564519Sgblack@eecs.umich.edu//////////////////////////////////////////////////////////////////////////
574519Sgblack@eecs.umich.edu//
584519Sgblack@eecs.umich.edu// RegOp Microop templates
594519Sgblack@eecs.umich.edu//
604519Sgblack@eecs.umich.edu//////////////////////////////////////////////////////////////////////////
614519Sgblack@eecs.umich.edu
624519Sgblack@eecs.umich.edudef template MicroRegOpExecute {{
634519Sgblack@eecs.umich.edu        Fault %(class_name)s::execute(%(CPU_exec_context)s *xc,
644519Sgblack@eecs.umich.edu                Trace::InstRecord *traceData) const
654519Sgblack@eecs.umich.edu        {
664519Sgblack@eecs.umich.edu            Fault fault = NoFault;
674519Sgblack@eecs.umich.edu
684519Sgblack@eecs.umich.edu            %(op_decl)s;
694519Sgblack@eecs.umich.edu            %(op_rd)s;
704519Sgblack@eecs.umich.edu            %(code)s;
714519Sgblack@eecs.umich.edu
724519Sgblack@eecs.umich.edu            //Write the resulting state to the execution context
734519Sgblack@eecs.umich.edu            if(fault == NoFault)
744519Sgblack@eecs.umich.edu            {
754519Sgblack@eecs.umich.edu                %(op_wb)s;
764519Sgblack@eecs.umich.edu            }
774519Sgblack@eecs.umich.edu            return fault;
784519Sgblack@eecs.umich.edu        }
794519Sgblack@eecs.umich.edu}};
804519Sgblack@eecs.umich.edu
814519Sgblack@eecs.umich.edudef template MicroRegOpImmExecute {{
824519Sgblack@eecs.umich.edu        Fault %(class_name)sImm::execute(%(CPU_exec_context)s *xc,
834519Sgblack@eecs.umich.edu                Trace::InstRecord *traceData) const
844519Sgblack@eecs.umich.edu        {
854519Sgblack@eecs.umich.edu            Fault fault = NoFault;
864519Sgblack@eecs.umich.edu
874519Sgblack@eecs.umich.edu            %(op_decl)s;
884519Sgblack@eecs.umich.edu            %(op_rd)s;
894519Sgblack@eecs.umich.edu            %(code)s;
904519Sgblack@eecs.umich.edu
914519Sgblack@eecs.umich.edu            //Write the resulting state to the execution context
924519Sgblack@eecs.umich.edu            if(fault == NoFault)
934519Sgblack@eecs.umich.edu            {
944519Sgblack@eecs.umich.edu                %(op_wb)s;
954519Sgblack@eecs.umich.edu            }
964519Sgblack@eecs.umich.edu            return fault;
974519Sgblack@eecs.umich.edu        }
984519Sgblack@eecs.umich.edu}};
994519Sgblack@eecs.umich.edu
1004519Sgblack@eecs.umich.edudef template MicroRegOpDeclare {{
1014519Sgblack@eecs.umich.edu    class %(class_name)s : public %(base_class)s
1024519Sgblack@eecs.umich.edu    {
1034519Sgblack@eecs.umich.edu      protected:
1044519Sgblack@eecs.umich.edu        const RegIndex src1;
1054519Sgblack@eecs.umich.edu        const RegIndex src2;
1064519Sgblack@eecs.umich.edu        const RegIndex dest;
1074519Sgblack@eecs.umich.edu        const bool setStatus;
1084519Sgblack@eecs.umich.edu        const uint8_t dataSize;
1094519Sgblack@eecs.umich.edu        const uint8_t ext;
1104519Sgblack@eecs.umich.edu        void buildMe();
1114519Sgblack@eecs.umich.edu
1124519Sgblack@eecs.umich.edu      public:
1134519Sgblack@eecs.umich.edu        %(class_name)s(ExtMachInst _machInst,
1144519Sgblack@eecs.umich.edu                const char * instMnem,
1154519Sgblack@eecs.umich.edu                bool isMicro, bool isDelayed, bool isFirst, bool isLast,
1164519Sgblack@eecs.umich.edu                RegIndex _src1, RegIndex _src2, RegIndex _dest,
1174519Sgblack@eecs.umich.edu                bool _setStatus, uint8_t _dataSize, uint8_t _ext);
1184519Sgblack@eecs.umich.edu
1194519Sgblack@eecs.umich.edu        %(class_name)s(ExtMachInst _machInst,
1204519Sgblack@eecs.umich.edu                const char * instMnem,
1214519Sgblack@eecs.umich.edu                RegIndex _src1, RegIndex _src2, RegIndex _dest,
1224519Sgblack@eecs.umich.edu                bool _setStatus, uint8_t _dataSize, uint8_t _ext);
1234519Sgblack@eecs.umich.edu
1244519Sgblack@eecs.umich.edu        %(BasicExecDeclare)s
1254519Sgblack@eecs.umich.edu    };
1264519Sgblack@eecs.umich.edu}};
1274519Sgblack@eecs.umich.edu
1284519Sgblack@eecs.umich.edudef template MicroRegOpImmDeclare {{
1294519Sgblack@eecs.umich.edu
1304519Sgblack@eecs.umich.edu    class %(class_name)sImm : public %(base_class)s
1314519Sgblack@eecs.umich.edu    {
1324519Sgblack@eecs.umich.edu      protected:
1334519Sgblack@eecs.umich.edu        const RegIndex src1;
1344519Sgblack@eecs.umich.edu        const uint8_t imm8;
1354519Sgblack@eecs.umich.edu        const RegIndex dest;
1364519Sgblack@eecs.umich.edu        const bool setStatus;
1374519Sgblack@eecs.umich.edu        const uint8_t dataSize;
1384519Sgblack@eecs.umich.edu        const uint8_t ext;
1394519Sgblack@eecs.umich.edu        void buildMe();
1404519Sgblack@eecs.umich.edu
1414519Sgblack@eecs.umich.edu      public:
1424519Sgblack@eecs.umich.edu        %(class_name)sImm(ExtMachInst _machInst,
1434519Sgblack@eecs.umich.edu                const char * instMnem,
1444519Sgblack@eecs.umich.edu                bool isMicro, bool isDelayed, bool isFirst, bool isLast,
1454519Sgblack@eecs.umich.edu                RegIndex _src1, uint8_t _imm8, RegIndex _dest,
1464519Sgblack@eecs.umich.edu                bool _setStatus, uint8_t _dataSize, uint8_t _ext);
1474519Sgblack@eecs.umich.edu
1484519Sgblack@eecs.umich.edu        %(class_name)sImm(ExtMachInst _machInst,
1494519Sgblack@eecs.umich.edu                const char * instMnem,
1504519Sgblack@eecs.umich.edu                RegIndex _src1, uint8_t _imm8, RegIndex _dest,
1514519Sgblack@eecs.umich.edu                bool _setStatus, uint8_t _dataSize, uint8_t _ext);
1524519Sgblack@eecs.umich.edu
1534519Sgblack@eecs.umich.edu        %(BasicExecDeclare)s
1544519Sgblack@eecs.umich.edu    };
1554519Sgblack@eecs.umich.edu}};
1564519Sgblack@eecs.umich.edu
1574519Sgblack@eecs.umich.edudef template MicroRegOpConstructor {{
1584519Sgblack@eecs.umich.edu
1594519Sgblack@eecs.umich.edu    inline void %(class_name)s::buildMe()
1604519Sgblack@eecs.umich.edu    {
1614519Sgblack@eecs.umich.edu        %(constructor)s;
1624519Sgblack@eecs.umich.edu    }
1634519Sgblack@eecs.umich.edu
1644519Sgblack@eecs.umich.edu    inline %(class_name)s::%(class_name)s(
1654519Sgblack@eecs.umich.edu            ExtMachInst machInst, const char * instMnem,
1664519Sgblack@eecs.umich.edu            RegIndex _src1, RegIndex _src2, RegIndex _dest,
1674519Sgblack@eecs.umich.edu            bool _setStatus, uint8_t _dataSize, uint8_t _ext) :
1684519Sgblack@eecs.umich.edu        %(base_class)s(machInst, "%(mnemonic)s", instMnem,
1694519Sgblack@eecs.umich.edu                false, false, false, false, %(op_class)s),
1704519Sgblack@eecs.umich.edu                src1(_src1), src2(_src2), dest(_dest),
1714519Sgblack@eecs.umich.edu                setStatus(_setStatus), dataSize(_dataSize), ext(_ext)
1724519Sgblack@eecs.umich.edu    {
1734519Sgblack@eecs.umich.edu        buildMe();
1744519Sgblack@eecs.umich.edu    }
1754519Sgblack@eecs.umich.edu
1764519Sgblack@eecs.umich.edu    inline %(class_name)s::%(class_name)s(
1774519Sgblack@eecs.umich.edu            ExtMachInst machInst, const char * instMnem,
1784519Sgblack@eecs.umich.edu            bool isMicro, bool isDelayed, bool isFirst, bool isLast,
1794519Sgblack@eecs.umich.edu            RegIndex _src1, RegIndex _src2, RegIndex _dest,
1804519Sgblack@eecs.umich.edu            bool _setStatus, uint8_t _dataSize, uint8_t _ext) :
1814519Sgblack@eecs.umich.edu        %(base_class)s(machInst, "%(mnemonic)s", instMnem,
1824519Sgblack@eecs.umich.edu                isMicro, isDelayed, isFirst, isLast, %(op_class)s),
1834519Sgblack@eecs.umich.edu                src1(_src1), src2(_src2), dest(_dest),
1844519Sgblack@eecs.umich.edu                setStatus(_setStatus), dataSize(_dataSize), ext(_ext)
1854519Sgblack@eecs.umich.edu    {
1864519Sgblack@eecs.umich.edu        buildMe();
1874519Sgblack@eecs.umich.edu    }
1884519Sgblack@eecs.umich.edu}};
1894519Sgblack@eecs.umich.edu
1904519Sgblack@eecs.umich.edudef template MicroRegOpImmConstructor {{
1914519Sgblack@eecs.umich.edu
1924519Sgblack@eecs.umich.edu    inline void %(class_name)sImm::buildMe()
1934519Sgblack@eecs.umich.edu    {
1944519Sgblack@eecs.umich.edu        %(constructor)s;
1954519Sgblack@eecs.umich.edu    }
1964519Sgblack@eecs.umich.edu
1974519Sgblack@eecs.umich.edu    inline %(class_name)sImm::%(class_name)sImm(
1984519Sgblack@eecs.umich.edu            ExtMachInst machInst, const char * instMnem,
1994519Sgblack@eecs.umich.edu            RegIndex _src1, uint8_t _imm8, RegIndex _dest,
2004519Sgblack@eecs.umich.edu            bool _setStatus, uint8_t _dataSize, uint8_t _ext) :
2014519Sgblack@eecs.umich.edu        %(base_class)s(machInst, "%(mnemonic)s", instMnem,
2024519Sgblack@eecs.umich.edu                false, false, false, false, %(op_class)s),
2034519Sgblack@eecs.umich.edu                src1(_src1), imm8(_imm8), dest(_dest),
2044519Sgblack@eecs.umich.edu                setStatus(_setStatus), dataSize(_dataSize), ext(_ext)
2054519Sgblack@eecs.umich.edu    {
2064519Sgblack@eecs.umich.edu        buildMe();
2074519Sgblack@eecs.umich.edu    }
2084519Sgblack@eecs.umich.edu
2094519Sgblack@eecs.umich.edu    inline %(class_name)sImm::%(class_name)sImm(
2104519Sgblack@eecs.umich.edu            ExtMachInst machInst, const char * instMnem,
2114519Sgblack@eecs.umich.edu            bool isMicro, bool isDelayed, bool isFirst, bool isLast,
2124519Sgblack@eecs.umich.edu            RegIndex _src1, uint8_t _imm8, RegIndex _dest,
2134519Sgblack@eecs.umich.edu            bool _setStatus, uint8_t _dataSize, uint8_t _ext) :
2144519Sgblack@eecs.umich.edu        %(base_class)s(machInst, "%(mnemonic)s", instMnem,
2154519Sgblack@eecs.umich.edu                isMicro, isDelayed, isFirst, isLast, %(op_class)s),
2164519Sgblack@eecs.umich.edu                src1(_src1), imm8(_imm8), dest(_dest),
2174519Sgblack@eecs.umich.edu                setStatus(_setStatus), dataSize(_dataSize), ext(_ext)
2184519Sgblack@eecs.umich.edu    {
2194519Sgblack@eecs.umich.edu        buildMe();
2204519Sgblack@eecs.umich.edu    }
2214519Sgblack@eecs.umich.edu}};
2224519Sgblack@eecs.umich.edu
2234519Sgblack@eecs.umich.edulet {{
2244528Sgblack@eecs.umich.edu    class RegOp(X86Microop):
2254519Sgblack@eecs.umich.edu        def __init__(self, dest, src1, src2):
2264519Sgblack@eecs.umich.edu            self.dest = dest
2274519Sgblack@eecs.umich.edu            self.src1 = src1
2284519Sgblack@eecs.umich.edu            self.src2 = src2
2294519Sgblack@eecs.umich.edu            self.setStatus = False
2304519Sgblack@eecs.umich.edu            self.dataSize = 1
2314519Sgblack@eecs.umich.edu            self.ext = 0
2324519Sgblack@eecs.umich.edu
2334519Sgblack@eecs.umich.edu        def getAllocator(self, *microFlags):
2344560Sgblack@eecs.umich.edu            allocator = '''new %(class_name)s(machInst, mnemonic
2354539Sgblack@eecs.umich.edu                    %(flags)s, %(src1)s, %(src2)s, %(dest)s,
2364519Sgblack@eecs.umich.edu                    %(setStatus)s, %(dataSize)s, %(ext)s)''' % {
2374519Sgblack@eecs.umich.edu                "class_name" : self.className,
2384519Sgblack@eecs.umich.edu                "flags" : self.microFlagsText(microFlags),
2394519Sgblack@eecs.umich.edu                "src1" : self.src1, "src2" : self.src2,
2404519Sgblack@eecs.umich.edu                "dest" : self.dest,
2414539Sgblack@eecs.umich.edu                "setStatus" : self.cppBool(self.setStatus),
2424519Sgblack@eecs.umich.edu                "dataSize" : self.dataSize,
2434519Sgblack@eecs.umich.edu                "ext" : self.ext}
2444539Sgblack@eecs.umich.edu            return allocator
2454519Sgblack@eecs.umich.edu
2464528Sgblack@eecs.umich.edu    class RegOpImm(X86Microop):
2474560Sgblack@eecs.umich.edu        def __init__(self, dest, src1, imm8):
2484519Sgblack@eecs.umich.edu            self.dest = dest
2494519Sgblack@eecs.umich.edu            self.src1 = src1
2504560Sgblack@eecs.umich.edu            self.imm8 = imm8
2514519Sgblack@eecs.umich.edu            self.setStatus = False
2524519Sgblack@eecs.umich.edu            self.dataSize = 1
2534519Sgblack@eecs.umich.edu            self.ext = 0
2544519Sgblack@eecs.umich.edu
2554519Sgblack@eecs.umich.edu        def getAllocator(self, *microFlags):
2564560Sgblack@eecs.umich.edu            allocator = '''new %(class_name)s(machInst, mnemonic
2574539Sgblack@eecs.umich.edu                    %(flags)s, %(src1)s, %(imm8)s, %(dest)s,
2584519Sgblack@eecs.umich.edu                    %(setStatus)s, %(dataSize)s, %(ext)s)''' % {
2594519Sgblack@eecs.umich.edu                "class_name" : self.className,
2604519Sgblack@eecs.umich.edu                "flags" : self.microFlagsText(microFlags),
2614519Sgblack@eecs.umich.edu                "src1" : self.src1, "imm8" : self.imm8,
2624519Sgblack@eecs.umich.edu                "dest" : self.dest,
2634539Sgblack@eecs.umich.edu                "setStatus" : self.cppBool(self.setStatus),
2644519Sgblack@eecs.umich.edu                "dataSize" : self.dataSize,
2654519Sgblack@eecs.umich.edu                "ext" : self.ext}
2664539Sgblack@eecs.umich.edu            return allocator
2674519Sgblack@eecs.umich.edu}};
2684519Sgblack@eecs.umich.edu
2694519Sgblack@eecs.umich.edulet {{
2704519Sgblack@eecs.umich.edu
2714519Sgblack@eecs.umich.edu    # Make these empty strings so that concatenating onto
2724519Sgblack@eecs.umich.edu    # them will always work.
2734519Sgblack@eecs.umich.edu    header_output = ""
2744519Sgblack@eecs.umich.edu    decoder_output = ""
2754519Sgblack@eecs.umich.edu    exec_output = ""
2764519Sgblack@eecs.umich.edu
2774528Sgblack@eecs.umich.edu    def defineMicroRegOp(mnemonic, code):
2784519Sgblack@eecs.umich.edu        global header_output
2794519Sgblack@eecs.umich.edu        global decoder_output
2804519Sgblack@eecs.umich.edu        global exec_output
2814528Sgblack@eecs.umich.edu        global microopClasses
2824519Sgblack@eecs.umich.edu        Name = mnemonic
2834519Sgblack@eecs.umich.edu        name = mnemonic.lower()
2844519Sgblack@eecs.umich.edu
2854519Sgblack@eecs.umich.edu        # Find op2 in each of the instruction definitions. Create two versions
2864519Sgblack@eecs.umich.edu        # of the code, one with an integer operand, and one with an immediate
2874519Sgblack@eecs.umich.edu        # operand.
2884519Sgblack@eecs.umich.edu        matcher = re.compile("op2(?P<typeQual>\\.\\w+)?")
2894519Sgblack@eecs.umich.edu        regCode = matcher.sub("SrcReg2", code)
2904519Sgblack@eecs.umich.edu        immCode = matcher.sub("imm8", code)
2914519Sgblack@eecs.umich.edu
2924519Sgblack@eecs.umich.edu        # Build up the all register version of this micro op
2934539Sgblack@eecs.umich.edu        iop = InstObjParams(name, Name, 'X86MicroopBase', {"code" : regCode})
2944519Sgblack@eecs.umich.edu        header_output += MicroRegOpDeclare.subst(iop)
2954519Sgblack@eecs.umich.edu        decoder_output += MicroRegOpConstructor.subst(iop)
2964519Sgblack@eecs.umich.edu        exec_output += MicroRegOpExecute.subst(iop)
2974519Sgblack@eecs.umich.edu
2984519Sgblack@eecs.umich.edu        class RegOpChild(RegOp):
2994519Sgblack@eecs.umich.edu            def __init__(self, dest, src1, src2):
3004528Sgblack@eecs.umich.edu                super(RegOpChild, self).__init__(dest, src1, src2)
3014528Sgblack@eecs.umich.edu                self.className = Name
3024519Sgblack@eecs.umich.edu                self.mnemonic = name
3034519Sgblack@eecs.umich.edu
3044519Sgblack@eecs.umich.edu        microopClasses[name] = RegOpChild
3054519Sgblack@eecs.umich.edu
3064519Sgblack@eecs.umich.edu        # Build up the immediate version of this micro op
3074519Sgblack@eecs.umich.edu        iop = InstObjParams(name + "i", Name,
3084539Sgblack@eecs.umich.edu                'X86MicroopBase', {"code" : immCode})
3094519Sgblack@eecs.umich.edu        header_output += MicroRegOpImmDeclare.subst(iop)
3104519Sgblack@eecs.umich.edu        decoder_output += MicroRegOpImmConstructor.subst(iop)
3114519Sgblack@eecs.umich.edu        exec_output += MicroRegOpImmExecute.subst(iop)
3124519Sgblack@eecs.umich.edu
3134519Sgblack@eecs.umich.edu        class RegOpImmChild(RegOpImm):
3144519Sgblack@eecs.umich.edu            def __init__(self, dest, src1, imm):
3154528Sgblack@eecs.umich.edu                super(RegOpImmChild, self).__init__(dest, src1, imm)
3164528Sgblack@eecs.umich.edu                self.className = Name + "Imm"
3174519Sgblack@eecs.umich.edu                self.mnemonic = name + "i"
3184519Sgblack@eecs.umich.edu
3194560Sgblack@eecs.umich.edu        microopClasses[name + "i"] = RegOpImmChild
3204519Sgblack@eecs.umich.edu
3214528Sgblack@eecs.umich.edu    defineMicroRegOp('Add', 'DestReg = merge(DestReg, SrcReg1 + op2, dataSize)') #Needs to set OF,CF,SF
3224528Sgblack@eecs.umich.edu    defineMicroRegOp('Or', 'DestReg = merge(DestReg, SrcReg1 | op2, dataSize)')
3234528Sgblack@eecs.umich.edu    defineMicroRegOp('Adc', 'DestReg = merge(DestReg, SrcReg1 + op2, dataSize)') #Needs to add in CF, set OF,CF,SF
3244528Sgblack@eecs.umich.edu    defineMicroRegOp('Sbb', 'DestReg = merge(DestReg, SrcReg1 - op2, dataSize)') #Needs to subtract CF, set OF,CF,SF
3254528Sgblack@eecs.umich.edu    defineMicroRegOp('And', 'DestReg = merge(DestReg, SrcReg1 & op2, dataSize)')
3264528Sgblack@eecs.umich.edu    defineMicroRegOp('Sub', 'DestReg = merge(DestReg, SrcReg1 - op2, dataSize)') #Needs to set OF,CF,SF
3274528Sgblack@eecs.umich.edu    defineMicroRegOp('Xor', 'DestReg = merge(DestReg, SrcReg1 ^ op2, dataSize)')
3284528Sgblack@eecs.umich.edu    defineMicroRegOp('Cmp', 'DestReg = merge(DestReg, DestReg - op2, dataSize)') #Needs to set OF,CF,SF and not DestReg
3294528Sgblack@eecs.umich.edu    defineMicroRegOp('Mov', 'DestReg = merge(SrcReg1, op2, dataSize)')
3304519Sgblack@eecs.umich.edu
3314519Sgblack@eecs.umich.edu}};
332