operands.isa revision 6479
12SN/A// Copyright (c) 2007 The Regents of The University of Michigan
21762SN/A// All rights reserved.
32SN/A//
42SN/A// Redistribution and use in source and binary forms, with or without
52SN/A// modification, are permitted provided that the following conditions are
62SN/A// met: redistributions of source code must retain the above copyright
72SN/A// notice, this list of conditions and the following disclaimer;
82SN/A// redistributions in binary form must reproduce the above copyright
92SN/A// notice, this list of conditions and the following disclaimer in the
102SN/A// documentation and/or other materials provided with the distribution;
112SN/A// neither the name of the copyright holders nor the names of its
122SN/A// contributors may be used to endorse or promote products derived from
132SN/A// this software without specific prior written permission.
142SN/A//
152SN/A// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
162SN/A// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
172SN/A// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
182SN/A// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
192SN/A// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
202SN/A// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
212SN/A// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
222SN/A// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
232SN/A// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
242SN/A// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
252SN/A// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
262SN/A//
272665Ssaidi@eecs.umich.edu// Authors: Gabe Black
282760Sbinkertn@umich.edu
292760Sbinkertn@umich.edu// Copyright (c) 2007-2008 The Hewlett-Packard Development Company
302665Ssaidi@eecs.umich.edu// All rights reserved.
312SN/A//
322SN/A// Redistribution and use of this software in source and binary forms,
332SN/A// with or without modification, are permitted provided that the
342SN/A// following conditions are met:
352SN/A//
362SN/A// The software must be used only for Non-Commercial Use which means any
372SN/A// use which is NOT directed to receiving any direct monetary
382SN/A// compensation for, or commercial advantage from such use.  Illustrative
392SN/A// examples of non-commercial use are academic research, personal study,
402SN/A// teaching, education and corporate research & development.
412SN/A// Illustrative examples of commercial use are distributing products for
424841Ssaidi@eecs.umich.edu// commercial advantage and providing services using the software for
432SN/A// commercial advantage.
44217SN/A//
452SN/A// If you wish to use this software or functionality therein that may be
466214Snate@binkert.org// covered by patents for commercial use, please contact:
472SN/A//     Director of Intellectual Property Licensing
482738Sstever@eecs.umich.edu//     Office of Strategy and Technology
49395SN/A//     Hewlett-Packard Company
50237SN/A//     1501 Page Mill Road
514000Ssaidi@eecs.umich.edu//     Palo Alto, California  94304
522SN/A//
53217SN/A// Redistributions of source code must retain the above copyright notice,
54502SN/A// this list of conditions and the following disclaimer.  Redistributions
55217SN/A// in binary form must reproduce the above copyright notice, this list of
56217SN/A// conditions and the following disclaimer in the documentation and/or
57237SN/A// other materials provided with the distribution.  Neither the name of
58502SN/A// the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
59217SN/A// contributors may be used to endorse or promote products derived from
60217SN/A// this software without specific prior written permission.  No right of
616820SLisa.Hsu@amd.com// sublicense is granted herewith.  Derivatives of the software and
626820SLisa.Hsu@amd.com// output created using the software may be prepared, but only for
636820SLisa.Hsu@amd.com// Non-Commercial Uses.  Derivatives of the software may be shared with
646820SLisa.Hsu@amd.com// others provided: (i) the others agree to abide by the list of
65217SN/A// conditions herein which includes the Non-Commercial Use restrictions;
666227Snate@binkert.org// and (ii) such Derivatives of the software include the above copyright
67217SN/A// notice to acknowledge the contribution from this software where
68217SN/A// applicable, this list of conditions and the disclaimer below.
694841Ssaidi@eecs.umich.edu//
704841Ssaidi@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
714841Ssaidi@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
724841Ssaidi@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
73237SN/A// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
746227Snate@binkert.org// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
75217SN/A// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
764841Ssaidi@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
774841Ssaidi@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
784841Ssaidi@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
794841Ssaidi@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
80237SN/A// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
81237SN/A//
824000Ssaidi@eecs.umich.edu// Authors: Gabe Black
83237SN/A
84237SN/Adef operand_types {{
85217SN/A    'sb' : ('signed int', 8),
86217SN/A    'ub' : ('unsigned int', 8),
87217SN/A    'sw' : ('signed int', 16),
88237SN/A    'uw' : ('unsigned int', 16),
895543Ssaidi@eecs.umich.edu    'sdw' : ('signed int', 32),
90217SN/A    'udw' : ('unsigned int', 32),
915543Ssaidi@eecs.umich.edu    'sqw' : ('signed int', 64),
926820SLisa.Hsu@amd.com    'uqw' : ('unsigned int', 64),
93217SN/A    'sf' : ('float', 32),
94223SN/A    'df' : ('float', 64),
955543Ssaidi@eecs.umich.edu}};
96223SN/A
975543Ssaidi@eecs.umich.edulet {{
985543Ssaidi@eecs.umich.edu    def foldInt(idx, foldBit, id):
995543Ssaidi@eecs.umich.edu        return ('IntReg', 'uqw', 'INTREG_FOLDED(%s, %s)' % (idx, foldBit),
1005543Ssaidi@eecs.umich.edu                'IsInteger', id)
1015543Ssaidi@eecs.umich.edu    def intReg(idx, id):
102223SN/A        return ('IntReg', 'uqw', idx, 'IsInteger', id)
103223SN/A    def impIntReg(idx, id):
1045543Ssaidi@eecs.umich.edu        return ('IntReg', 'uqw', 'INTREG_IMPLICIT(%s)' % idx, 'IsInteger', id)
105217SN/A    def floatReg(idx, id):
106217SN/A        return ('FloatReg', 'df', idx, 'IsFloating', id)
1075543Ssaidi@eecs.umich.edu    def controlReg(idx, id, ctype = 'uqw'):
108237SN/A        return ('ControlReg', ctype, idx,
109237SN/A                (None, None, ['IsSerializeAfter',
1105543Ssaidi@eecs.umich.edu                              'IsSerializing',
111237SN/A                              'IsNonSpeculative']),
1125543Ssaidi@eecs.umich.edu                id)
1135543Ssaidi@eecs.umich.edu}};
1145543Ssaidi@eecs.umich.edu
1155543Ssaidi@eecs.umich.edudef operands {{
1165543Ssaidi@eecs.umich.edu        'SrcReg1':       foldInt('src1', 'foldOBit', 1),
117237SN/A        'SSrcReg1':      intReg('src1', 1),
118217SN/A        'SrcReg2':       foldInt('src2', 'foldOBit', 2),
1192SN/A        'SSrcReg2':      intReg('src2', 1),
1202SN/A        'Index':         foldInt('index', 'foldABit', 3),
1212SN/A        'Base':          foldInt('base', 'foldABit', 4),
122395SN/A        'DestReg':       foldInt('dest', 'foldOBit', 5),
1232SN/A        'SDestReg':      intReg('dest', 5),
1242SN/A        'Data':          foldInt('data', 'foldOBit', 6),
125510SN/A        'ProdLow':       impIntReg(0, 7),
126510SN/A        'ProdHi':        impIntReg(1, 8),
1272SN/A        'Quotient':      impIntReg(2, 9),
1282SN/A        'Remainder':     impIntReg(3, 10),
1295739Snate@binkert.org        'Divisor':       impIntReg(4, 11),
1305739Snate@binkert.org        'DoubleBits':    impIntReg(5, 11),
1312SN/A        'Rax':           intReg('(INTREG_RAX)', 12),
132265SN/A        'Rbx':           intReg('(INTREG_RBX)', 13),
133512SN/A        'Rcx':           intReg('(INTREG_RCX)', 14),
1342SN/A        'Rdx':           intReg('(INTREG_RDX)', 15),
1355739Snate@binkert.org        'Rsp':           intReg('(INTREG_RSP)', 16),
1365739Snate@binkert.org        'Rbp':           intReg('(INTREG_RBP)', 17),
137237SN/A        'Rsi':           intReg('(INTREG_RSI)', 18),
1385739Snate@binkert.org        'Rdi':           intReg('(INTREG_RDI)', 19),
1392SN/A        'FpSrcReg1':     floatReg('src1', 20),
1402287SN/A        'FpSrcReg2':     floatReg('src2', 21),
1412287SN/A        'FpDestReg':     floatReg('dest', 22),
1422287SN/A        'FpData':        floatReg('data', 23),
1432868Sktlim@umich.edu        'RIP':           ('NPC', 'uqw', None, (None, None, 'IsControl'), 50),
1442868Sktlim@umich.edu        'uIP':           ('UPC', 'uqw', None, (None, None, 'IsControl'), 51),
145395SN/A        'nuIP':          ('NUPC', 'uqw', None, (None, None, 'IsControl'), 52),
1462SN/A        # This holds the condition code portion of the flag register. The
1472SN/A        # nccFlagBits version holds the rest.
1482SN/A        'ccFlagBits':    intReg('INTREG_PSEUDO(0)', 60),
149395SN/A        # These register should needs to be more protected so that later
150395SN/A        # instructions don't map their indexes with an old value.
1512SN/A        'nccFlagBits':   controlReg('MISCREG_RFLAGS', 61),
1522SN/A        'TOP':           controlReg('MISCREG_X87_TOP', 62, ctype='ub'),
1532SN/A        # The segment base as used by memory instructions.
154395SN/A        'SegBase':       controlReg('MISCREG_SEG_EFF_BASE(segment)', 70),
1552SN/A
156395SN/A        # Operands to get and set registers indexed by the operands of the
1572SN/A        # original instruction.
1582SN/A        'ControlDest':   controlReg('MISCREG_CR(dest)', 100),
159395SN/A        'ControlSrc1':   controlReg('MISCREG_CR(src1)', 101),
1602SN/A        'DebugDest':     controlReg('MISCREG_DR(dest)', 102),
161395SN/A        'DebugSrc1':     controlReg('MISCREG_DR(src1)', 103),
1622SN/A        'SegBaseDest':   controlReg('MISCREG_SEG_BASE(dest)', 104),
1632SN/A        'SegBaseSrc1':   controlReg('MISCREG_SEG_BASE(src1)', 105),
1642SN/A        'SegLimitDest':  controlReg('MISCREG_SEG_LIMIT(dest)', 106),
165395SN/A        'SegLimitSrc1':  controlReg('MISCREG_SEG_LIMIT(src1)', 107),
1662SN/A        'SegSelDest':    controlReg('MISCREG_SEG_SEL(dest)', 108),
167395SN/A        'SegSelSrc1':    controlReg('MISCREG_SEG_SEL(src1)', 109),
1682SN/A        'SegAttrDest':   controlReg('MISCREG_SEG_ATTR(dest)', 110),
169395SN/A        'SegAttrSrc1':   controlReg('MISCREG_SEG_ATTR(src1)', 111),
1702SN/A
1712SN/A        # Operands to access specific control registers directly.
172395SN/A        'EferOp':        controlReg('MISCREG_EFER', 200),
173395SN/A        'CR4Op':         controlReg('MISCREG_CR4', 201),
1742SN/A        'DR7Op':         controlReg('MISCREG_DR7', 202),
1752SN/A        'LDTRBase':      controlReg('MISCREG_TSL_BASE', 203),
1762SN/A        'LDTRLimit':     controlReg('MISCREG_TSL_LIMIT', 204),
177395SN/A        'LDTRSel':       controlReg('MISCREG_TSL', 205),
178395SN/A        'GDTRBase':      controlReg('MISCREG_TSG_BASE', 206),
1792SN/A        'GDTRLimit':     controlReg('MISCREG_TSG_LIMIT', 207),
1802SN/A        'CSBase':        controlReg('MISCREG_CS_EFF_BASE', 208),
1812SN/A        'CSAttr':        controlReg('MISCREG_CS_ATTR', 209),
1822SN/A        'MiscRegDest':   controlReg('dest', 210),
1832SN/A        'MiscRegSrc1':   controlReg('src1', 211),
1842SN/A        'TscOp':         controlReg('MISCREG_TSC', 212),
185395SN/A        'M5Reg':         controlReg('MISCREG_M5_REG', 213),
1862SN/A        'Mem':           ('Mem', 'uqw', None, \
1872SN/A                          ('IsMemRef', 'IsLoad', 'IsStore'), 300)
1882SN/A}};
1892SN/A