operands.isa revision 11514
16019Shines@cs.fsu.edu// -*- mode:c++ -*-
210338SCurtis.Dunham@arm.com// Copyright (c) 2010-2014 ARM Limited
37091Sgblack@eecs.umich.edu// All rights reserved
47091Sgblack@eecs.umich.edu//
57091Sgblack@eecs.umich.edu// The license below extends only to copyright in the software and shall
67091Sgblack@eecs.umich.edu// not be construed as granting a license to any other intellectual
77091Sgblack@eecs.umich.edu// property including but not limited to intellectual property relating
87091Sgblack@eecs.umich.edu// to a hardware implementation of the functionality of the software
97091Sgblack@eecs.umich.edu// licensed hereunder.  You may use the software subject to the license
107091Sgblack@eecs.umich.edu// terms below provided that you ensure that this notice is replicated
117091Sgblack@eecs.umich.edu// unmodified and in its entirety in all distributions of the software,
127091Sgblack@eecs.umich.edu// modified or unmodified, in source code or in binary form.
137091Sgblack@eecs.umich.edu//
146019Shines@cs.fsu.edu// Copyright (c) 2007-2008 The Florida State University
156019Shines@cs.fsu.edu// All rights reserved.
166019Shines@cs.fsu.edu//
176019Shines@cs.fsu.edu// Redistribution and use in source and binary forms, with or without
186019Shines@cs.fsu.edu// modification, are permitted provided that the following conditions are
196019Shines@cs.fsu.edu// met: redistributions of source code must retain the above copyright
206019Shines@cs.fsu.edu// notice, this list of conditions and the following disclaimer;
216019Shines@cs.fsu.edu// redistributions in binary form must reproduce the above copyright
226019Shines@cs.fsu.edu// notice, this list of conditions and the following disclaimer in the
236019Shines@cs.fsu.edu// documentation and/or other materials provided with the distribution;
246019Shines@cs.fsu.edu// neither the name of the copyright holders nor the names of its
256019Shines@cs.fsu.edu// contributors may be used to endorse or promote products derived from
266019Shines@cs.fsu.edu// this software without specific prior written permission.
276019Shines@cs.fsu.edu//
286019Shines@cs.fsu.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
296019Shines@cs.fsu.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
306019Shines@cs.fsu.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
316019Shines@cs.fsu.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
326019Shines@cs.fsu.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
336019Shines@cs.fsu.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
346019Shines@cs.fsu.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
356019Shines@cs.fsu.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
366019Shines@cs.fsu.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
376019Shines@cs.fsu.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
386019Shines@cs.fsu.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
396019Shines@cs.fsu.edu//
406019Shines@cs.fsu.edu// Authors: Stephen Hines
416019Shines@cs.fsu.edu
426019Shines@cs.fsu.edudef operand_types {{
438449Sgblack@eecs.umich.edu    'sb' : 'int8_t',
448449Sgblack@eecs.umich.edu    'ub' : 'uint8_t',
458449Sgblack@eecs.umich.edu    'sh' : 'int16_t',
468449Sgblack@eecs.umich.edu    'uh' : 'uint16_t',
478449Sgblack@eecs.umich.edu    'sw' : 'int32_t',
488449Sgblack@eecs.umich.edu    'uw' : 'uint32_t',
498449Sgblack@eecs.umich.edu    'ud' : 'uint64_t',
508449Sgblack@eecs.umich.edu    'tud' : 'Twin64_t',
518449Sgblack@eecs.umich.edu    'sf' : 'float',
528449Sgblack@eecs.umich.edu    'df' : 'double'
536019Shines@cs.fsu.edu}};
546019Shines@cs.fsu.edu
556312Sgblack@eecs.umich.edulet {{
566312Sgblack@eecs.umich.edu    maybePCRead = '''
577720Sgblack@eecs.umich.edu        ((%(reg_idx)s == PCReg) ? readPC(xc) : xc->%(func)s(this, %(op_idx)s))
586312Sgblack@eecs.umich.edu    '''
597186Sgblack@eecs.umich.edu    maybeAlignedPCRead = '''
607720Sgblack@eecs.umich.edu        ((%(reg_idx)s == PCReg) ? (roundDown(readPC(xc), 4)) :
617186Sgblack@eecs.umich.edu         xc->%(func)s(this, %(op_idx)s))
627186Sgblack@eecs.umich.edu    '''
636312Sgblack@eecs.umich.edu    maybePCWrite = '''
647093Sgblack@eecs.umich.edu        ((%(reg_idx)s == PCReg) ? setNextPC(xc, %(final_val)s) :
656312Sgblack@eecs.umich.edu         xc->%(func)s(this, %(op_idx)s, %(final_val)s))
666312Sgblack@eecs.umich.edu    '''
677148Sgblack@eecs.umich.edu    maybeIWPCWrite = '''
687148Sgblack@eecs.umich.edu        ((%(reg_idx)s == PCReg) ? setIWNextPC(xc, %(final_val)s) :
697148Sgblack@eecs.umich.edu         xc->%(func)s(this, %(op_idx)s, %(final_val)s))
707148Sgblack@eecs.umich.edu    '''
717184Sgblack@eecs.umich.edu    maybeAIWPCWrite = '''
727184Sgblack@eecs.umich.edu        if (%(reg_idx)s == PCReg) {
737289Sgblack@eecs.umich.edu            bool thumb = THUMB;
747289Sgblack@eecs.umich.edu            if (thumb) {
757289Sgblack@eecs.umich.edu                setNextPC(xc, %(final_val)s);
767289Sgblack@eecs.umich.edu            } else {
777184Sgblack@eecs.umich.edu                setIWNextPC(xc, %(final_val)s);
787184Sgblack@eecs.umich.edu            }
797184Sgblack@eecs.umich.edu        } else {
807184Sgblack@eecs.umich.edu            xc->%(func)s(this, %(op_idx)s, %(final_val)s);
817184Sgblack@eecs.umich.edu        }
827184Sgblack@eecs.umich.edu    '''
8310037SARM gem5 Developers    aarch64Read = '''
8410037SARM gem5 Developers        ((xc->%(func)s(this, %(op_idx)s)) & mask(intWidth))
8510037SARM gem5 Developers    '''
8610037SARM gem5 Developers    aarch64Write = '''
8710037SARM gem5 Developers        xc->%(func)s(this, %(op_idx)s, (%(final_val)s) & mask(intWidth))
8810037SARM gem5 Developers    '''
8910037SARM gem5 Developers    aarchX64Read = '''
9010037SARM gem5 Developers        ((xc->%(func)s(this, %(op_idx)s)) & mask(aarch64 ? 64 : 32))
9110037SARM gem5 Developers    '''
9210037SARM gem5 Developers    aarchX64Write = '''
9310037SARM gem5 Developers        xc->%(func)s(this, %(op_idx)s, (%(final_val)s) & mask(aarch64 ? 64 : 32))
9410037SARM gem5 Developers    '''
9510037SARM gem5 Developers    aarchW64Read = '''
9610037SARM gem5 Developers        ((xc->%(func)s(this, %(op_idx)s)) & mask(32))
9710037SARM gem5 Developers    '''
9810037SARM gem5 Developers    aarchW64Write = '''
9910037SARM gem5 Developers        xc->%(func)s(this, %(op_idx)s, (%(final_val)s) & mask(32))
10010037SARM gem5 Developers    '''
10110037SARM gem5 Developers    cntrlNsBankedWrite = '''
10210037SARM gem5 Developers        xc->setMiscReg(flattenMiscRegNsBanked(dest, xc->tcBase()), %(final_val)s)
10310037SARM gem5 Developers    '''
10410037SARM gem5 Developers
10510037SARM gem5 Developers    cntrlNsBankedRead = '''
10610037SARM gem5 Developers        xc->readMiscReg(flattenMiscRegNsBanked(op1, xc->tcBase()))
10710037SARM gem5 Developers    '''
1087797Sgblack@eecs.umich.edu
1097797Sgblack@eecs.umich.edu    #PCState operands need to have a sorting index (the number at the end)
1107797Sgblack@eecs.umich.edu    #less than all the integer registers which might update the PC. That way
1117797Sgblack@eecs.umich.edu    #if the flag bits of the pc state are updated and a branch happens through
1127797Sgblack@eecs.umich.edu    #R15, the updates are layered properly and the R15 update isn't lost.
1137797Sgblack@eecs.umich.edu    srtNormal = 5
1147797Sgblack@eecs.umich.edu    srtCpsr = 4
1157797Sgblack@eecs.umich.edu    srtBase = 3
1167797Sgblack@eecs.umich.edu    srtPC = 2
1177797Sgblack@eecs.umich.edu    srtMode = 1
1187797Sgblack@eecs.umich.edu    srtEPC = 0
1197797Sgblack@eecs.umich.edu
1207797Sgblack@eecs.umich.edu    def floatReg(idx):
1217797Sgblack@eecs.umich.edu        return ('FloatReg', 'sf', idx, 'IsFloating', srtNormal)
1227797Sgblack@eecs.umich.edu
1237797Sgblack@eecs.umich.edu    def intReg(idx):
1247797Sgblack@eecs.umich.edu        return ('IntReg', 'uw', idx, 'IsInteger', srtNormal,
1257797Sgblack@eecs.umich.edu                maybePCRead, maybePCWrite)
1267797Sgblack@eecs.umich.edu
12710037SARM gem5 Developers    def intReg64(idx):
12810037SARM gem5 Developers        return ('IntReg', 'ud', idx, 'IsInteger', srtNormal,
12910037SARM gem5 Developers                aarch64Read, aarch64Write)
13010037SARM gem5 Developers
13110037SARM gem5 Developers    def intRegX64(idx, id = srtNormal):
13210037SARM gem5 Developers        return ('IntReg', 'ud', idx, 'IsInteger', id,
13310037SARM gem5 Developers                aarchX64Read, aarchX64Write)
13410037SARM gem5 Developers
13510037SARM gem5 Developers    def intRegW64(idx, id = srtNormal):
13610037SARM gem5 Developers        return ('IntReg', 'ud', idx, 'IsInteger', id,
13710037SARM gem5 Developers                aarchW64Read, aarchW64Write)
13810037SARM gem5 Developers
1397797Sgblack@eecs.umich.edu    def intRegNPC(idx):
1407797Sgblack@eecs.umich.edu        return ('IntReg', 'uw', idx, 'IsInteger', srtNormal)
1417797Sgblack@eecs.umich.edu
1427797Sgblack@eecs.umich.edu    def intRegAPC(idx, id = srtNormal):
1437797Sgblack@eecs.umich.edu        return ('IntReg', 'uw', idx, 'IsInteger', id,
1447797Sgblack@eecs.umich.edu                maybeAlignedPCRead, maybePCWrite)
1457797Sgblack@eecs.umich.edu
1467797Sgblack@eecs.umich.edu    def intRegIWPC(idx):
1477797Sgblack@eecs.umich.edu        return ('IntReg', 'uw', idx, 'IsInteger', srtNormal,
1487797Sgblack@eecs.umich.edu                maybePCRead, maybeIWPCWrite)
1497797Sgblack@eecs.umich.edu
1507797Sgblack@eecs.umich.edu    def intRegAIWPC(idx):
1517797Sgblack@eecs.umich.edu        return ('IntReg', 'uw', idx, 'IsInteger', srtNormal,
1527797Sgblack@eecs.umich.edu                maybePCRead, maybeAIWPCWrite)
1537797Sgblack@eecs.umich.edu
15410338SCurtis.Dunham@arm.com    def ccReg(idx):
15510338SCurtis.Dunham@arm.com        return ('CCReg', 'uw', idx, None, srtNormal)
1567797Sgblack@eecs.umich.edu
1577797Sgblack@eecs.umich.edu    def cntrlReg(idx, id = srtNormal, type = 'uw'):
1589251Snathanael.premillieu@irisa.fr        return ('ControlReg', type, idx, None, id)
1597797Sgblack@eecs.umich.edu
16010037SARM gem5 Developers    def cntrlNsBankedReg(idx, id = srtNormal, type = 'uw'):
16110037SARM gem5 Developers        return ('ControlReg', type, idx, (None, None, 'IsControl'), id, cntrlNsBankedRead, cntrlNsBankedWrite)
16210037SARM gem5 Developers
16310037SARM gem5 Developers    def cntrlNsBankedReg64(idx, id = srtNormal, type = 'ud'):
16410037SARM gem5 Developers        return ('ControlReg', type, idx, (None, None, 'IsControl'), id, cntrlNsBankedRead, cntrlNsBankedWrite)
16510037SARM gem5 Developers
1667797Sgblack@eecs.umich.edu    def cntrlRegNC(idx, id = srtNormal, type = 'uw'):
1677797Sgblack@eecs.umich.edu        return ('ControlReg', type, idx, None, id)
1687797Sgblack@eecs.umich.edu
1697797Sgblack@eecs.umich.edu    def pcStateReg(idx, id):
17010037SARM gem5 Developers        return ('PCState', 'ud', idx, (None, None, 'IsControl'), id)
1716312Sgblack@eecs.umich.edu}};
1726312Sgblack@eecs.umich.edu
1736019Shines@cs.fsu.edudef operands {{
1747119Sgblack@eecs.umich.edu    #Abstracted integer reg operands
1757797Sgblack@eecs.umich.edu    'Dest': intReg('dest'),
17610037SARM gem5 Developers    'Dest64': intReg64('dest'),
17710037SARM gem5 Developers    'XDest': intRegX64('dest'),
17810037SARM gem5 Developers    'WDest': intRegW64('dest'),
1797797Sgblack@eecs.umich.edu    'IWDest': intRegIWPC('dest'),
1807797Sgblack@eecs.umich.edu    'AIWDest': intRegAIWPC('dest'),
1817797Sgblack@eecs.umich.edu    'Dest2': intReg('dest2'),
18210037SARM gem5 Developers    'XDest2': intRegX64('dest2'),
18310037SARM gem5 Developers    'FDest2': floatReg('dest2'),
1847797Sgblack@eecs.umich.edu    'Result': intReg('result'),
18510037SARM gem5 Developers    'XResult': intRegX64('result'),
18610037SARM gem5 Developers    'XBase': intRegX64('base', id = srtBase),
1877797Sgblack@eecs.umich.edu    'Base': intRegAPC('base', id = srtBase),
18810037SARM gem5 Developers    'XOffset': intRegX64('offset'),
1897797Sgblack@eecs.umich.edu    'Index': intReg('index'),
1907797Sgblack@eecs.umich.edu    'Shift': intReg('shift'),
1917797Sgblack@eecs.umich.edu    'Op1': intReg('op1'),
1927797Sgblack@eecs.umich.edu    'Op2': intReg('op2'),
1937797Sgblack@eecs.umich.edu    'Op3': intReg('op3'),
19410037SARM gem5 Developers    'Op164': intReg64('op1'),
19510037SARM gem5 Developers    'Op264': intReg64('op2'),
19610037SARM gem5 Developers    'Op364': intReg64('op3'),
19710037SARM gem5 Developers    'XOp1': intRegX64('op1'),
19810037SARM gem5 Developers    'XOp2': intRegX64('op2'),
19910037SARM gem5 Developers    'XOp3': intRegX64('op3'),
20010037SARM gem5 Developers    'WOp1': intRegW64('op1'),
20110037SARM gem5 Developers    'WOp2': intRegW64('op2'),
20210037SARM gem5 Developers    'WOp3': intRegW64('op3'),
2037797Sgblack@eecs.umich.edu    'Reg0': intReg('reg0'),
2047797Sgblack@eecs.umich.edu    'Reg1': intReg('reg1'),
2057797Sgblack@eecs.umich.edu    'Reg2': intReg('reg2'),
2067797Sgblack@eecs.umich.edu    'Reg3': intReg('reg3'),
2076019Shines@cs.fsu.edu
2087797Sgblack@eecs.umich.edu    #Fixed index integer reg operands
2097797Sgblack@eecs.umich.edu    'SpMode': intRegNPC('intRegInMode((OperatingMode)regMode, INTREG_SP)'),
21010037SARM gem5 Developers    'DecodedBankedIntReg': intRegNPC('decodeMrsMsrBankedIntRegIndex(byteMask, r)'),
2117797Sgblack@eecs.umich.edu    'LR': intRegNPC('INTREG_LR'),
21210037SARM gem5 Developers    'XLR': intRegX64('INTREG_X30'),
2137797Sgblack@eecs.umich.edu    'R7': intRegNPC('7'),
2148204SAli.Saidi@ARM.com    # First four arguments are passed in registers
2157797Sgblack@eecs.umich.edu    'R0': intRegNPC('0'),
2168204SAli.Saidi@ARM.com    'R1': intRegNPC('1'),
2178204SAli.Saidi@ARM.com    'R2': intRegNPC('2'),
2188204SAli.Saidi@ARM.com    'R3': intRegNPC('3'),
21910037SARM gem5 Developers    'X0': intRegX64('0'),
22010037SARM gem5 Developers    'X1': intRegX64('1'),
22110037SARM gem5 Developers    'X2': intRegX64('2'),
22210037SARM gem5 Developers    'X3': intRegX64('3'),
2237797Sgblack@eecs.umich.edu
22410338SCurtis.Dunham@arm.com    # Condition code registers
22510338SCurtis.Dunham@arm.com    'CondCodesNZ': ccReg('CCREG_NZ'),
22610338SCurtis.Dunham@arm.com    'CondCodesC': ccReg('CCREG_C'),
22710338SCurtis.Dunham@arm.com    'CondCodesV': ccReg('CCREG_V'),
22810338SCurtis.Dunham@arm.com    'CondCodesGE': ccReg('CCREG_GE'),
22910338SCurtis.Dunham@arm.com    'OptCondCodesNZ': ccReg(
23010338SCurtis.Dunham@arm.com            '''((condCode == COND_AL || condCode == COND_UC ||
23110338SCurtis.Dunham@arm.com                 condCode == COND_CC || condCode == COND_CS ||
23210338SCurtis.Dunham@arm.com                 condCode == COND_VS || condCode == COND_VC) ?
23310338SCurtis.Dunham@arm.com                CCREG_ZERO : CCREG_NZ)'''),
23410338SCurtis.Dunham@arm.com    'OptCondCodesC': ccReg(
23510338SCurtis.Dunham@arm.com             '''((condCode == COND_HI || condCode == COND_LS ||
2368303SAli.Saidi@ARM.com                condCode == COND_CS || condCode == COND_CC) ?
23710338SCurtis.Dunham@arm.com               CCREG_C : CCREG_ZERO)'''),
23810338SCurtis.Dunham@arm.com    'OptShiftRmCondCodesC': ccReg(
23910338SCurtis.Dunham@arm.com            '''((condCode == COND_HI || condCode == COND_LS ||
24010338SCurtis.Dunham@arm.com                 condCode == COND_CS || condCode == COND_CC ||
24110338SCurtis.Dunham@arm.com                 shiftType == ROR) ?
24210338SCurtis.Dunham@arm.com                CCREG_C : CCREG_ZERO)'''),
24310338SCurtis.Dunham@arm.com    'OptCondCodesV': ccReg(
24410338SCurtis.Dunham@arm.com            '''((condCode == COND_VS || condCode == COND_VC ||
24510338SCurtis.Dunham@arm.com                 condCode == COND_GE || condCode == COND_LT ||
24610338SCurtis.Dunham@arm.com                 condCode == COND_GT || condCode == COND_LE) ?
24710338SCurtis.Dunham@arm.com                CCREG_V : CCREG_ZERO)'''),
24810338SCurtis.Dunham@arm.com    'FpCondCodes': ccReg('CCREG_FP'),
2497797Sgblack@eecs.umich.edu
2507797Sgblack@eecs.umich.edu    #Abstracted floating point reg operands
2517797Sgblack@eecs.umich.edu    'FpDest': floatReg('(dest + 0)'),
2527797Sgblack@eecs.umich.edu    'FpDestP0': floatReg('(dest + 0)'),
2537797Sgblack@eecs.umich.edu    'FpDestP1': floatReg('(dest + 1)'),
2547797Sgblack@eecs.umich.edu    'FpDestP2': floatReg('(dest + 2)'),
2557797Sgblack@eecs.umich.edu    'FpDestP3': floatReg('(dest + 3)'),
2567797Sgblack@eecs.umich.edu    'FpDestP4': floatReg('(dest + 4)'),
2577797Sgblack@eecs.umich.edu    'FpDestP5': floatReg('(dest + 5)'),
2587797Sgblack@eecs.umich.edu    'FpDestP6': floatReg('(dest + 6)'),
2597797Sgblack@eecs.umich.edu    'FpDestP7': floatReg('(dest + 7)'),
2607797Sgblack@eecs.umich.edu    'FpDestS0P0': floatReg('(dest + step * 0 + 0)'),
2617797Sgblack@eecs.umich.edu    'FpDestS0P1': floatReg('(dest + step * 0 + 1)'),
2627797Sgblack@eecs.umich.edu    'FpDestS1P0': floatReg('(dest + step * 1 + 0)'),
2637797Sgblack@eecs.umich.edu    'FpDestS1P1': floatReg('(dest + step * 1 + 1)'),
2647797Sgblack@eecs.umich.edu    'FpDestS2P0': floatReg('(dest + step * 2 + 0)'),
2657797Sgblack@eecs.umich.edu    'FpDestS2P1': floatReg('(dest + step * 2 + 1)'),
2667797Sgblack@eecs.umich.edu    'FpDestS3P0': floatReg('(dest + step * 3 + 0)'),
2677797Sgblack@eecs.umich.edu    'FpDestS3P1': floatReg('(dest + step * 3 + 1)'),
2687797Sgblack@eecs.umich.edu
2697797Sgblack@eecs.umich.edu    'FpDest2': floatReg('(dest2 + 0)'),
2707797Sgblack@eecs.umich.edu    'FpDest2P0': floatReg('(dest2 + 0)'),
2717797Sgblack@eecs.umich.edu    'FpDest2P1': floatReg('(dest2 + 1)'),
2727797Sgblack@eecs.umich.edu    'FpDest2P2': floatReg('(dest2 + 2)'),
2737797Sgblack@eecs.umich.edu    'FpDest2P3': floatReg('(dest2 + 3)'),
2747797Sgblack@eecs.umich.edu
2757797Sgblack@eecs.umich.edu    'FpOp1': floatReg('(op1 + 0)'),
2767797Sgblack@eecs.umich.edu    'FpOp1P0': floatReg('(op1 + 0)'),
2777797Sgblack@eecs.umich.edu    'FpOp1P1': floatReg('(op1 + 1)'),
2787797Sgblack@eecs.umich.edu    'FpOp1P2': floatReg('(op1 + 2)'),
2797797Sgblack@eecs.umich.edu    'FpOp1P3': floatReg('(op1 + 3)'),
2807797Sgblack@eecs.umich.edu    'FpOp1P4': floatReg('(op1 + 4)'),
2817797Sgblack@eecs.umich.edu    'FpOp1P5': floatReg('(op1 + 5)'),
2827797Sgblack@eecs.umich.edu    'FpOp1P6': floatReg('(op1 + 6)'),
2837797Sgblack@eecs.umich.edu    'FpOp1P7': floatReg('(op1 + 7)'),
2847797Sgblack@eecs.umich.edu    'FpOp1S0P0': floatReg('(op1 + step * 0 + 0)'),
2857797Sgblack@eecs.umich.edu    'FpOp1S0P1': floatReg('(op1 + step * 0 + 1)'),
2867797Sgblack@eecs.umich.edu    'FpOp1S1P0': floatReg('(op1 + step * 1 + 0)'),
2877797Sgblack@eecs.umich.edu    'FpOp1S1P1': floatReg('(op1 + step * 1 + 1)'),
2887797Sgblack@eecs.umich.edu    'FpOp1S2P0': floatReg('(op1 + step * 2 + 0)'),
2897797Sgblack@eecs.umich.edu    'FpOp1S2P1': floatReg('(op1 + step * 2 + 1)'),
2907797Sgblack@eecs.umich.edu    'FpOp1S3P0': floatReg('(op1 + step * 3 + 0)'),
2917797Sgblack@eecs.umich.edu    'FpOp1S3P1': floatReg('(op1 + step * 3 + 1)'),
2927797Sgblack@eecs.umich.edu
2937797Sgblack@eecs.umich.edu    'FpOp2': floatReg('(op2 + 0)'),
2947797Sgblack@eecs.umich.edu    'FpOp2P0': floatReg('(op2 + 0)'),
2957797Sgblack@eecs.umich.edu    'FpOp2P1': floatReg('(op2 + 1)'),
2967797Sgblack@eecs.umich.edu    'FpOp2P2': floatReg('(op2 + 2)'),
2977797Sgblack@eecs.umich.edu    'FpOp2P3': floatReg('(op2 + 3)'),
2987797Sgblack@eecs.umich.edu
29910037SARM gem5 Developers    # Create AArch64 unpacked view of the FP registers
30010037SARM gem5 Developers    'AA64FpOp1P0':   floatReg('((op1 * 4) + 0)'),
30110037SARM gem5 Developers    'AA64FpOp1P1':   floatReg('((op1 * 4) + 1)'),
30210037SARM gem5 Developers    'AA64FpOp1P2':   floatReg('((op1 * 4) + 2)'),
30310037SARM gem5 Developers    'AA64FpOp1P3':   floatReg('((op1 * 4) + 3)'),
30410037SARM gem5 Developers    'AA64FpOp2P0':   floatReg('((op2 * 4) + 0)'),
30510037SARM gem5 Developers    'AA64FpOp2P1':   floatReg('((op2 * 4) + 1)'),
30610037SARM gem5 Developers    'AA64FpOp2P2':   floatReg('((op2 * 4) + 2)'),
30710037SARM gem5 Developers    'AA64FpOp2P3':   floatReg('((op2 * 4) + 3)'),
30810037SARM gem5 Developers    'AA64FpOp3P0':   floatReg('((op3 * 4) + 0)'),
30910037SARM gem5 Developers    'AA64FpOp3P1':   floatReg('((op3 * 4) + 1)'),
31010037SARM gem5 Developers    'AA64FpOp3P2':   floatReg('((op3 * 4) + 2)'),
31110037SARM gem5 Developers    'AA64FpOp3P3':   floatReg('((op3 * 4) + 3)'),
31210037SARM gem5 Developers    'AA64FpDestP0':  floatReg('((dest * 4) + 0)'),
31310037SARM gem5 Developers    'AA64FpDestP1':  floatReg('((dest * 4) + 1)'),
31410037SARM gem5 Developers    'AA64FpDestP2':  floatReg('((dest * 4) + 2)'),
31510037SARM gem5 Developers    'AA64FpDestP3':  floatReg('((dest * 4) + 3)'),
31610037SARM gem5 Developers    'AA64FpDest2P0': floatReg('((dest2 * 4) + 0)'),
31710037SARM gem5 Developers    'AA64FpDest2P1': floatReg('((dest2 * 4) + 1)'),
31810037SARM gem5 Developers    'AA64FpDest2P2': floatReg('((dest2 * 4) + 2)'),
31910037SARM gem5 Developers    'AA64FpDest2P3': floatReg('((dest2 * 4) + 3)'),
32010037SARM gem5 Developers
32110037SARM gem5 Developers    'AA64FpOp1P0V0':   floatReg('((((op1+0)) * 4) + 0)'),
32210037SARM gem5 Developers    'AA64FpOp1P1V0':   floatReg('((((op1+0)) * 4) + 1)'),
32310037SARM gem5 Developers    'AA64FpOp1P2V0':   floatReg('((((op1+0)) * 4) + 2)'),
32410037SARM gem5 Developers    'AA64FpOp1P3V0':   floatReg('((((op1+0)) * 4) + 3)'),
32510037SARM gem5 Developers
32610037SARM gem5 Developers    'AA64FpOp1P0V1':   floatReg('((((op1+1)) * 4) + 0)'),
32710037SARM gem5 Developers    'AA64FpOp1P1V1':   floatReg('((((op1+1)) * 4) + 1)'),
32810037SARM gem5 Developers    'AA64FpOp1P2V1':   floatReg('((((op1+1)) * 4) + 2)'),
32910037SARM gem5 Developers    'AA64FpOp1P3V1':   floatReg('((((op1+1)) * 4) + 3)'),
33010037SARM gem5 Developers
33110037SARM gem5 Developers    'AA64FpOp1P0V2':   floatReg('((((op1+2)) * 4) + 0)'),
33210037SARM gem5 Developers    'AA64FpOp1P1V2':   floatReg('((((op1+2)) * 4) + 1)'),
33310037SARM gem5 Developers    'AA64FpOp1P2V2':   floatReg('((((op1+2)) * 4) + 2)'),
33410037SARM gem5 Developers    'AA64FpOp1P3V2':   floatReg('((((op1+2)) * 4) + 3)'),
33510037SARM gem5 Developers
33610037SARM gem5 Developers    'AA64FpOp1P0V3':   floatReg('((((op1+3)) * 4) + 0)'),
33710037SARM gem5 Developers    'AA64FpOp1P1V3':   floatReg('((((op1+3)) * 4) + 1)'),
33810037SARM gem5 Developers    'AA64FpOp1P2V3':   floatReg('((((op1+3)) * 4) + 2)'),
33910037SARM gem5 Developers    'AA64FpOp1P3V3':   floatReg('((((op1+3)) * 4) + 3)'),
34010037SARM gem5 Developers
34110037SARM gem5 Developers    'AA64FpOp1P0V0S':   floatReg('((((op1+0)%32) * 4) + 0)'),
34210037SARM gem5 Developers    'AA64FpOp1P1V0S':   floatReg('((((op1+0)%32) * 4) + 1)'),
34310037SARM gem5 Developers    'AA64FpOp1P2V0S':   floatReg('((((op1+0)%32) * 4) + 2)'),
34410037SARM gem5 Developers    'AA64FpOp1P3V0S':   floatReg('((((op1+0)%32) * 4) + 3)'),
34510037SARM gem5 Developers
34610037SARM gem5 Developers    'AA64FpOp1P0V1S':   floatReg('((((op1+1)%32) * 4) + 0)'),
34710037SARM gem5 Developers    'AA64FpOp1P1V1S':   floatReg('((((op1+1)%32) * 4) + 1)'),
34810037SARM gem5 Developers    'AA64FpOp1P2V1S':   floatReg('((((op1+1)%32) * 4) + 2)'),
34910037SARM gem5 Developers    'AA64FpOp1P3V1S':   floatReg('((((op1+1)%32) * 4) + 3)'),
35010037SARM gem5 Developers
35110037SARM gem5 Developers    'AA64FpOp1P0V2S':   floatReg('((((op1+2)%32) * 4) + 0)'),
35210037SARM gem5 Developers    'AA64FpOp1P1V2S':   floatReg('((((op1+2)%32) * 4) + 1)'),
35310037SARM gem5 Developers    'AA64FpOp1P2V2S':   floatReg('((((op1+2)%32) * 4) + 2)'),
35410037SARM gem5 Developers    'AA64FpOp1P3V2S':   floatReg('((((op1+2)%32) * 4) + 3)'),
35510037SARM gem5 Developers
35610037SARM gem5 Developers    'AA64FpOp1P0V3S':   floatReg('((((op1+3)%32) * 4) + 0)'),
35710037SARM gem5 Developers    'AA64FpOp1P1V3S':   floatReg('((((op1+3)%32) * 4) + 1)'),
35810037SARM gem5 Developers    'AA64FpOp1P2V3S':   floatReg('((((op1+3)%32) * 4) + 2)'),
35910037SARM gem5 Developers    'AA64FpOp1P3V3S':   floatReg('((((op1+3)%32) * 4) + 3)'),
36010037SARM gem5 Developers
36110037SARM gem5 Developers    'AA64FpDestP0V0':   floatReg('((((dest+0)) * 4) + 0)'),
36210037SARM gem5 Developers    'AA64FpDestP1V0':   floatReg('((((dest+0)) * 4) + 1)'),
36310037SARM gem5 Developers    'AA64FpDestP2V0':   floatReg('((((dest+0)) * 4) + 2)'),
36410037SARM gem5 Developers    'AA64FpDestP3V0':   floatReg('((((dest+0)) * 4) + 3)'),
36510037SARM gem5 Developers
36610037SARM gem5 Developers    'AA64FpDestP0V1':   floatReg('((((dest+1)) * 4) + 0)'),
36710037SARM gem5 Developers    'AA64FpDestP1V1':   floatReg('((((dest+1)) * 4) + 1)'),
36810037SARM gem5 Developers    'AA64FpDestP2V1':   floatReg('((((dest+1)) * 4) + 2)'),
36910037SARM gem5 Developers    'AA64FpDestP3V1':   floatReg('((((dest+1)) * 4) + 3)'),
37010037SARM gem5 Developers
37110037SARM gem5 Developers    'AA64FpDestP0V0L':   floatReg('((((dest+0)%32) * 4) + 0)'),
37210037SARM gem5 Developers    'AA64FpDestP1V0L':   floatReg('((((dest+0)%32) * 4) + 1)'),
37310037SARM gem5 Developers    'AA64FpDestP2V0L':   floatReg('((((dest+0)%32) * 4) + 2)'),
37410037SARM gem5 Developers    'AA64FpDestP3V0L':   floatReg('((((dest+0)%32) * 4) + 3)'),
37510037SARM gem5 Developers
37610037SARM gem5 Developers    'AA64FpDestP0V1L':   floatReg('((((dest+1)%32) * 4) + 0)'),
37710037SARM gem5 Developers    'AA64FpDestP1V1L':   floatReg('((((dest+1)%32) * 4) + 1)'),
37810037SARM gem5 Developers    'AA64FpDestP2V1L':   floatReg('((((dest+1)%32) * 4) + 2)'),
37910037SARM gem5 Developers    'AA64FpDestP3V1L':   floatReg('((((dest+1)%32) * 4) + 3)'),
38010037SARM gem5 Developers
3817797Sgblack@eecs.umich.edu    #Abstracted control reg operands
3827797Sgblack@eecs.umich.edu    'MiscDest': cntrlReg('dest'),
3837797Sgblack@eecs.umich.edu    'MiscOp1': cntrlReg('op1'),
38410037SARM gem5 Developers    'MiscNsBankedDest': cntrlNsBankedReg('dest'),
38510037SARM gem5 Developers    'MiscNsBankedOp1': cntrlNsBankedReg('op1'),
38610037SARM gem5 Developers    'MiscNsBankedDest64': cntrlNsBankedReg64('dest'),
38710037SARM gem5 Developers    'MiscNsBankedOp164': cntrlNsBankedReg64('op1'),
3887797Sgblack@eecs.umich.edu
3897797Sgblack@eecs.umich.edu    #Fixed index control regs
3907797Sgblack@eecs.umich.edu    'Cpsr': cntrlReg('MISCREG_CPSR', srtCpsr),
3918302SAli.Saidi@ARM.com    'CpsrQ': cntrlReg('MISCREG_CPSR_Q', srtCpsr),
3927797Sgblack@eecs.umich.edu    'Spsr': cntrlRegNC('MISCREG_SPSR'),
3937797Sgblack@eecs.umich.edu    'Fpsr': cntrlRegNC('MISCREG_FPSR'),
3947797Sgblack@eecs.umich.edu    'Fpsid': cntrlRegNC('MISCREG_FPSID'),
3957797Sgblack@eecs.umich.edu    'Fpscr': cntrlRegNC('MISCREG_FPSCR'),
3967797Sgblack@eecs.umich.edu    'FpscrQc': cntrlRegNC('MISCREG_FPSCR_QC'),
3977797Sgblack@eecs.umich.edu    'FpscrExc': cntrlRegNC('MISCREG_FPSCR_EXC'),
3987797Sgblack@eecs.umich.edu    'Cpacr': cntrlReg('MISCREG_CPACR'),
39910037SARM gem5 Developers    'Cpacr64': cntrlReg('MISCREG_CPACR_EL1'),
4007797Sgblack@eecs.umich.edu    'Fpexc': cntrlRegNC('MISCREG_FPEXC'),
40110037SARM gem5 Developers    'Nsacr': cntrlReg('MISCREG_NSACR'),
40210037SARM gem5 Developers    'ElrHyp': cntrlRegNC('MISCREG_ELR_HYP'),
40310037SARM gem5 Developers    'Hcr': cntrlReg('MISCREG_HCR'),
40410037SARM gem5 Developers    'Hcr64': cntrlReg('MISCREG_HCR_EL2'),
40510037SARM gem5 Developers    'Hdcr': cntrlReg('MISCREG_HDCR'),
40610037SARM gem5 Developers    'Hcptr': cntrlReg('MISCREG_HCPTR'),
40710037SARM gem5 Developers    'CptrEl264': cntrlReg('MISCREG_CPTR_EL2'),
40810037SARM gem5 Developers    'CptrEl364': cntrlReg('MISCREG_CPTR_EL3'),
40910037SARM gem5 Developers    'Hstr': cntrlReg('MISCREG_HSTR'),
41010037SARM gem5 Developers    'Scr': cntrlReg('MISCREG_SCR'),
41110037SARM gem5 Developers    'Scr64': cntrlReg('MISCREG_SCR_EL3'),
4127797Sgblack@eecs.umich.edu    'Sctlr': cntrlRegNC('MISCREG_SCTLR'),
4137797Sgblack@eecs.umich.edu    'SevMailbox': cntrlRegNC('MISCREG_SEV_MAILBOX'),
4148209SAli.Saidi@ARM.com    'LLSCLock': cntrlRegNC('MISCREG_LOCKFLAG'),
41510037SARM gem5 Developers    'Dczid' : cntrlRegNC('MISCREG_DCZID_EL0'),
4166019Shines@cs.fsu.edu
4176308Sgblack@eecs.umich.edu    #Register fields for microops
4188139SMatt.Horsnell@arm.com    'URa' : intReg('ura'),
41910037SARM gem5 Developers    'XURa' : intRegX64('ura'),
42010037SARM gem5 Developers    'WURa' : intRegW64('ura'),
4217797Sgblack@eecs.umich.edu    'IWRa' : intRegIWPC('ura'),
4227797Sgblack@eecs.umich.edu    'Fa' : floatReg('ura'),
42310037SARM gem5 Developers    'FaP1' : floatReg('ura + 1'),
4248139SMatt.Horsnell@arm.com    'URb' : intReg('urb'),
42510037SARM gem5 Developers    'XURb' : intRegX64('urb'),
4268139SMatt.Horsnell@arm.com    'URc' : intReg('urc'),
42710037SARM gem5 Developers    'XURc' : intRegX64('urc'),
4286308Sgblack@eecs.umich.edu
4296019Shines@cs.fsu.edu    #Memory Operand
4307797Sgblack@eecs.umich.edu    'Mem': ('Mem', 'uw', None, ('IsMemRef', 'IsLoad', 'IsStore'), srtNormal),
4316019Shines@cs.fsu.edu
4327797Sgblack@eecs.umich.edu    #PCState fields
43310037SARM gem5 Developers    'RawPC': pcStateReg('pc', srtPC),
4347797Sgblack@eecs.umich.edu    'PC': pcStateReg('instPC', srtPC),
4357797Sgblack@eecs.umich.edu    'NPC': pcStateReg('instNPC', srtPC),
4367797Sgblack@eecs.umich.edu    'pNPC': pcStateReg('instNPC', srtEPC),
4377797Sgblack@eecs.umich.edu    'IWNPC': pcStateReg('instIWNPC', srtPC),
4387797Sgblack@eecs.umich.edu    'Thumb': pcStateReg('thumb', srtPC),
4397797Sgblack@eecs.umich.edu    'NextThumb': pcStateReg('nextThumb', srtMode),
4407797Sgblack@eecs.umich.edu    'NextJazelle': pcStateReg('nextJazelle', srtMode),
4418205SAli.Saidi@ARM.com    'NextItState': pcStateReg('nextItstate', srtMode),
4428205SAli.Saidi@ARM.com    'Itstate': pcStateReg('itstate', srtMode),
44311514Sandreas.sandberg@arm.com    'NextAArch64': pcStateReg('nextAArch64', srtMode),
4447797Sgblack@eecs.umich.edu
4457797Sgblack@eecs.umich.edu    #Register operands depending on a field in the instruction encoding. These
4467797Sgblack@eecs.umich.edu    #should be avoided since they may not be portable across different
4477797Sgblack@eecs.umich.edu    #encodings of the same instruction.
4487797Sgblack@eecs.umich.edu    'Rd': intReg('RD'),
4497797Sgblack@eecs.umich.edu    'Rm': intReg('RM'),
4507797Sgblack@eecs.umich.edu    'Rs': intReg('RS'),
4517797Sgblack@eecs.umich.edu    'Rn': intReg('RN'),
4527797Sgblack@eecs.umich.edu    'Rt': intReg('RT')
4536019Shines@cs.fsu.edu}};
454