base.isa revision 5040
14338Sgblack@eecs.umich.edu// -*- mode:c++ -*-
24338Sgblack@eecs.umich.edu
34338Sgblack@eecs.umich.edu// Copyright (c) 2007 The Hewlett-Packard Development Company
44338Sgblack@eecs.umich.edu// All rights reserved.
54338Sgblack@eecs.umich.edu//
64338Sgblack@eecs.umich.edu// Redistribution and use of this software in source and binary forms,
74338Sgblack@eecs.umich.edu// with or without modification, are permitted provided that the
84338Sgblack@eecs.umich.edu// following conditions are met:
94338Sgblack@eecs.umich.edu//
104338Sgblack@eecs.umich.edu// The software must be used only for Non-Commercial Use which means any
114338Sgblack@eecs.umich.edu// use which is NOT directed to receiving any direct monetary
124338Sgblack@eecs.umich.edu// compensation for, or commercial advantage from such use.  Illustrative
134338Sgblack@eecs.umich.edu// examples of non-commercial use are academic research, personal study,
144338Sgblack@eecs.umich.edu// teaching, education and corporate research & development.
154338Sgblack@eecs.umich.edu// Illustrative examples of commercial use are distributing products for
164338Sgblack@eecs.umich.edu// commercial advantage and providing services using the software for
174338Sgblack@eecs.umich.edu// commercial advantage.
184338Sgblack@eecs.umich.edu//
194338Sgblack@eecs.umich.edu// If you wish to use this software or functionality therein that may be
204338Sgblack@eecs.umich.edu// covered by patents for commercial use, please contact:
214338Sgblack@eecs.umich.edu//     Director of Intellectual Property Licensing
224338Sgblack@eecs.umich.edu//     Office of Strategy and Technology
234338Sgblack@eecs.umich.edu//     Hewlett-Packard Company
244338Sgblack@eecs.umich.edu//     1501 Page Mill Road
254338Sgblack@eecs.umich.edu//     Palo Alto, California  94304
264338Sgblack@eecs.umich.edu//
274338Sgblack@eecs.umich.edu// Redistributions of source code must retain the above copyright notice,
284338Sgblack@eecs.umich.edu// this list of conditions and the following disclaimer.  Redistributions
294338Sgblack@eecs.umich.edu// in binary form must reproduce the above copyright notice, this list of
304338Sgblack@eecs.umich.edu// conditions and the following disclaimer in the documentation and/or
314338Sgblack@eecs.umich.edu// other materials provided with the distribution.  Neither the name of
324338Sgblack@eecs.umich.edu// the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
334338Sgblack@eecs.umich.edu// contributors may be used to endorse or promote products derived from
344338Sgblack@eecs.umich.edu// this software without specific prior written permission.  No right of
354338Sgblack@eecs.umich.edu// sublicense is granted herewith.  Derivatives of the software and
364338Sgblack@eecs.umich.edu// output created using the software may be prepared, but only for
374338Sgblack@eecs.umich.edu// Non-Commercial Uses.  Derivatives of the software may be shared with
384338Sgblack@eecs.umich.edu// others provided: (i) the others agree to abide by the list of
394338Sgblack@eecs.umich.edu// conditions herein which includes the Non-Commercial Use restrictions;
404338Sgblack@eecs.umich.edu// and (ii) such Derivatives of the software include the above copyright
414338Sgblack@eecs.umich.edu// notice to acknowledge the contribution from this software where
424338Sgblack@eecs.umich.edu// applicable, this list of conditions and the disclaimer below.
434338Sgblack@eecs.umich.edu//
444338Sgblack@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
454338Sgblack@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
464338Sgblack@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
474338Sgblack@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
484338Sgblack@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
494338Sgblack@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
504338Sgblack@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
514338Sgblack@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
524338Sgblack@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
534338Sgblack@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
544338Sgblack@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
554338Sgblack@eecs.umich.edu//
564338Sgblack@eecs.umich.edu// Authors: Gabe Black
574338Sgblack@eecs.umich.edu
584519Sgblack@eecs.umich.edulet {{
594519Sgblack@eecs.umich.edu    # This will be populated with mappings between microop mnemonics and
604519Sgblack@eecs.umich.edu    # the classes that represent them.
614519Sgblack@eecs.umich.edu    microopClasses = {}
624338Sgblack@eecs.umich.edu}};
634338Sgblack@eecs.umich.edu
644519Sgblack@eecs.umich.edu//////////////////////////////////////////////////////////////////////////
654519Sgblack@eecs.umich.edu//
664519Sgblack@eecs.umich.edu// Base class for the python representation of x86 microops
674534Sgblack@eecs.umich.edu//
684534Sgblack@eecs.umich.edu//////////////////////////////////////////////////////////////////////////
694519Sgblack@eecs.umich.edu
704519Sgblack@eecs.umich.edulet {{
714519Sgblack@eecs.umich.edu    class X86Microop(object):
725040Sgblack@eecs.umich.edu
734519Sgblack@eecs.umich.edu        def __init__(self, name):
744519Sgblack@eecs.umich.edu            self.name = name
754519Sgblack@eecs.umich.edu
764539Sgblack@eecs.umich.edu        # This converts a python bool into a C++ bool
774539Sgblack@eecs.umich.edu        def cppBool(self, val):
784539Sgblack@eecs.umich.edu            if val:
794539Sgblack@eecs.umich.edu                return "true"
804539Sgblack@eecs.umich.edu            else:
814539Sgblack@eecs.umich.edu                return "false"
824539Sgblack@eecs.umich.edu
834519Sgblack@eecs.umich.edu        # This converts a list of python bools into
844519Sgblack@eecs.umich.edu        # a comma seperated list of C++ bools.
854519Sgblack@eecs.umich.edu        def microFlagsText(self, vals):
864519Sgblack@eecs.umich.edu            text = ""
874519Sgblack@eecs.umich.edu            for val in vals:
884539Sgblack@eecs.umich.edu                text += ", %s" % self.cppBool(val)
894519Sgblack@eecs.umich.edu            return text
904519Sgblack@eecs.umich.edu
914519Sgblack@eecs.umich.edu        def getAllocator(self, mnemonic, *microFlags):
925040Sgblack@eecs.umich.edu            return 'new %s(machInst, %s)' % \
935040Sgblack@eecs.umich.edu                (self.className, mnemonic, self.microFlagsText(microFlags))
944338Sgblack@eecs.umich.edu}};
954338Sgblack@eecs.umich.edu
964519Sgblack@eecs.umich.edu//////////////////////////////////////////////////////////////////////////
974519Sgblack@eecs.umich.edu//
984519Sgblack@eecs.umich.edu// FpOp Microop templates
994519Sgblack@eecs.umich.edu//
1004519Sgblack@eecs.umich.edu//////////////////////////////////////////////////////////////////////////
1014519Sgblack@eecs.umich.edu
1024519Sgblack@eecs.umich.edu//TODO Actually write an fp microop base class.
103