specop.isa revision 4519
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// Fault Microop
594519Sgblack@eecs.umich.edu//
604519Sgblack@eecs.umich.edu//////////////////////////////////////////////////////////////////////////
614519Sgblack@eecs.umich.edu
624519Sgblack@eecs.umich.edudef template MicroFaultExecute {{
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            //Return the fault we were constructed with
674519Sgblack@eecs.umich.edu            return fault;
684519Sgblack@eecs.umich.edu        }
694519Sgblack@eecs.umich.edu}};
704519Sgblack@eecs.umich.edu
714519Sgblack@eecs.umich.edudef template MicroFaultDeclare {{
724519Sgblack@eecs.umich.edu    class %(class_name)s : public X86MicroOpBase
734519Sgblack@eecs.umich.edu    {
744519Sgblack@eecs.umich.edu      protected:
754519Sgblack@eecs.umich.edu        Fault fault;
764519Sgblack@eecs.umich.edu        void buildMe();
774519Sgblack@eecs.umich.edu
784519Sgblack@eecs.umich.edu      public:
794519Sgblack@eecs.umich.edu        %(class_name)s(ExtMachInst _machInst,
804519Sgblack@eecs.umich.edu                const char * instMnem,
814519Sgblack@eecs.umich.edu                bool isMicro, bool isDelayed, bool isFirst, bool isLast,
824519Sgblack@eecs.umich.edu                Fault _fault);
834519Sgblack@eecs.umich.edu
844519Sgblack@eecs.umich.edu        %(class_name)s(ExtMachInst _machInst,
854519Sgblack@eecs.umich.edu                const char * instMnem,
864519Sgblack@eecs.umich.edu                Fault _fault);
874519Sgblack@eecs.umich.edu
884519Sgblack@eecs.umich.edu        %(BasicExecDeclare)s
894519Sgblack@eecs.umich.edu    };
904519Sgblack@eecs.umich.edu}};
914519Sgblack@eecs.umich.edu
924519Sgblack@eecs.umich.edudef template MicroFaultConstructor {{
934519Sgblack@eecs.umich.edu
944519Sgblack@eecs.umich.edu    inline void %(class_name)s::buildMe()
954519Sgblack@eecs.umich.edu    {
964519Sgblack@eecs.umich.edu        %(constructor)s;
974519Sgblack@eecs.umich.edu    }
984519Sgblack@eecs.umich.edu
994519Sgblack@eecs.umich.edu    inline %(class_name)s::%(class_name)s(
1004519Sgblack@eecs.umich.edu            ExtMachInst machInst, const char * instMnem, Fault _fault) :
1014519Sgblack@eecs.umich.edu        %(base_class)s(machInst, "%(mnemonic)s", instMnem,
1024519Sgblack@eecs.umich.edu                false, false, false, false, %(op_class)s), fault(_fault)
1034519Sgblack@eecs.umich.edu    {
1044519Sgblack@eecs.umich.edu        buildMe();
1054519Sgblack@eecs.umich.edu    }
1064519Sgblack@eecs.umich.edu
1074519Sgblack@eecs.umich.edu    inline %(class_name)s::%(class_name)s(
1084519Sgblack@eecs.umich.edu            ExtMachInst machInst, const char * instMnem,
1094519Sgblack@eecs.umich.edu            bool isMicro, bool isDelayed, bool isFirst, bool isLast,
1104519Sgblack@eecs.umich.edu            Fault _fault) :
1114519Sgblack@eecs.umich.edu        %(base_class)s(machInst, "%(mnemonic)s", instMnem,
1124519Sgblack@eecs.umich.edu                isMicro, isDelayed, isFirst, isLast, %(op_class)s),
1134519Sgblack@eecs.umich.edu                fault(_fault)
1144519Sgblack@eecs.umich.edu    {
1154519Sgblack@eecs.umich.edu        buildMe();
1164519Sgblack@eecs.umich.edu    }
1174519Sgblack@eecs.umich.edu}};
1184519Sgblack@eecs.umich.edu
1194519Sgblack@eecs.umich.edulet {{
1204519Sgblack@eecs.umich.edu    # This microop takes in a single parameter, a fault to return.
1214519Sgblack@eecs.umich.edu    iop = InstObjParams("fault", "GenFault", 'X86MicroOpBase', {"code" : ""})
1224519Sgblack@eecs.umich.edu    header_output += MicroFaultDeclare.subst(iop)
1234519Sgblack@eecs.umich.edu    decoder_output += MicroFaultConstructor.subst(iop)
1244519Sgblack@eecs.umich.edu    exec_output += MicroFaultExecute.subst(iop)
1254519Sgblack@eecs.umich.edu}};
126