types.hh revision 6759:98101a5f7ee4
112855Sgabeblack@google.com/*
212855Sgabeblack@google.com * Copyright (c) 2007-2008 The Florida State University
312855Sgabeblack@google.com * All rights reserved.
412855Sgabeblack@google.com *
512855Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without
612855Sgabeblack@google.com * modification, are permitted provided that the following conditions are
712855Sgabeblack@google.com * met: redistributions of source code must retain the above copyright
812855Sgabeblack@google.com * notice, this list of conditions and the following disclaimer;
912855Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright
1012855Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the
1112855Sgabeblack@google.com * documentation and/or other materials provided with the distribution;
1212855Sgabeblack@google.com * neither the name of the copyright holders nor the names of its
1312855Sgabeblack@google.com * contributors may be used to endorse or promote products derived from
1412855Sgabeblack@google.com * this software without specific prior written permission.
1512855Sgabeblack@google.com *
1612855Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1712855Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1812855Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1912855Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2012855Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2112855Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2212855Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2312855Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2412855Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2512855Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2612855Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2712855Sgabeblack@google.com *
2812855Sgabeblack@google.com * Authors: Stephen Hines
2912855Sgabeblack@google.com */
3012855Sgabeblack@google.com
3112855Sgabeblack@google.com#ifndef __ARCH_ARM_TYPES_HH__
3212855Sgabeblack@google.com#define __ARCH_ARM_TYPES_HH__
3312855Sgabeblack@google.com
3412855Sgabeblack@google.com#include "base/bitunion.hh"
3512855Sgabeblack@google.com#include "base/types.hh"
3612855Sgabeblack@google.com
3712855Sgabeblack@google.comnamespace ArmISA
3812855Sgabeblack@google.com{
3912855Sgabeblack@google.com    typedef uint32_t MachInst;
4012855Sgabeblack@google.com
4112855Sgabeblack@google.com    BitUnion64(ExtMachInst)
4212855Sgabeblack@google.com        // Made up bitfields that make life easier.
4312855Sgabeblack@google.com        Bitfield<33>     sevenAndFour;
4412855Sgabeblack@google.com        Bitfield<32>     isMisc;
4512855Sgabeblack@google.com
4612855Sgabeblack@google.com        // All the different types of opcode fields.
4712855Sgabeblack@google.com        Bitfield<27, 25> encoding;
4812855Sgabeblack@google.com        Bitfield<25>     useImm;
4912855Sgabeblack@google.com        Bitfield<24, 21> opcode;
5012855Sgabeblack@google.com        Bitfield<24, 20> mediaOpcode;
5112855Sgabeblack@google.com        Bitfield<24>     opcode24;
5212855Sgabeblack@google.com        Bitfield<23, 20> opcode23_20;
5312855Sgabeblack@google.com        Bitfield<23, 21> opcode23_21;
5412855Sgabeblack@google.com        Bitfield<20>     opcode20;
5512855Sgabeblack@google.com        Bitfield<22>     opcode22;
5612855Sgabeblack@google.com        Bitfield<19>     opcode19;
5712855Sgabeblack@google.com        Bitfield<18>     opcode18;
5812855Sgabeblack@google.com        Bitfield<15, 12> opcode15_12;
5912855Sgabeblack@google.com        Bitfield<15>     opcode15;
6012855Sgabeblack@google.com        Bitfield<7,  4>  miscOpcode;
6112855Sgabeblack@google.com        Bitfield<7,5>    opc2;
6212855Sgabeblack@google.com        Bitfield<7>      opcode7;
6312855Sgabeblack@google.com        Bitfield<4>      opcode4;
6412855Sgabeblack@google.com
6512855Sgabeblack@google.com        Bitfield<31, 28> condCode;
6612855Sgabeblack@google.com        Bitfield<20>     sField;
6712855Sgabeblack@google.com        Bitfield<19, 16> rn;
6812855Sgabeblack@google.com        Bitfield<15, 12> rd;
6912855Sgabeblack@google.com        Bitfield<11, 7>  shiftSize;
7012855Sgabeblack@google.com        Bitfield<6,  5>  shift;
7112855Sgabeblack@google.com        Bitfield<3,  0>  rm;
7212855Sgabeblack@google.com
7312855Sgabeblack@google.com        Bitfield<11, 8>  rs;
7412855Sgabeblack@google.com
7512855Sgabeblack@google.com        SubBitUnion(puswl, 24, 20)
7612855Sgabeblack@google.com            Bitfield<24> prepost;
7712855Sgabeblack@google.com            Bitfield<23> up;
7812855Sgabeblack@google.com            Bitfield<22> psruser;
7912855Sgabeblack@google.com            Bitfield<21> writeback;
8012855Sgabeblack@google.com            Bitfield<20> loadOp;
8112855Sgabeblack@google.com        EndSubBitUnion(puswl)
8212855Sgabeblack@google.com
8312855Sgabeblack@google.com        Bitfield<24, 20> pubwl;
8412855Sgabeblack@google.com
8512855Sgabeblack@google.com        Bitfield<7, 0> imm;
8612855Sgabeblack@google.com
8712855Sgabeblack@google.com        Bitfield<11, 8>  rotate;
8812855Sgabeblack@google.com
8912855Sgabeblack@google.com        Bitfield<11, 0>  immed11_0;
9012855Sgabeblack@google.com        Bitfield<7,  0>  immed7_0;
9112855Sgabeblack@google.com
9212855Sgabeblack@google.com        Bitfield<11, 8>  immedHi11_8;
9312855Sgabeblack@google.com        Bitfield<3,  0>  immedLo3_0;
9412855Sgabeblack@google.com
9512855Sgabeblack@google.com        Bitfield<15, 0>  regList;
9612855Sgabeblack@google.com
9712855Sgabeblack@google.com        Bitfield<23, 0>  offset;
9812855Sgabeblack@google.com
9912855Sgabeblack@google.com        Bitfield<23, 0>  immed23_0;
10012855Sgabeblack@google.com
10112855Sgabeblack@google.com        Bitfield<11, 8>  cpNum;
10212855Sgabeblack@google.com        Bitfield<18, 16> fn;
10312855Sgabeblack@google.com        Bitfield<14, 12> fd;
10412855Sgabeblack@google.com        Bitfield<3>      fpRegImm;
10512855Sgabeblack@google.com        Bitfield<3,  0>  fm;
10612855Sgabeblack@google.com        Bitfield<2,  0>  fpImm;
10712855Sgabeblack@google.com        Bitfield<24, 20> punwl;
10812855Sgabeblack@google.com
10912855Sgabeblack@google.com        Bitfield<7,  0>  m5Func;
11012855Sgabeblack@google.com    EndBitUnion(ExtMachInst)
11112855Sgabeblack@google.com
11212855Sgabeblack@google.com    // Shift types for ARM instructions
11312855Sgabeblack@google.com    enum ArmShiftType {
11412855Sgabeblack@google.com        LSL = 0,
11512855Sgabeblack@google.com        LSR,
11612855Sgabeblack@google.com        ASR,
11712855Sgabeblack@google.com        ROR
11812855Sgabeblack@google.com    };
11912855Sgabeblack@google.com
12012855Sgabeblack@google.com    typedef uint64_t LargestRead;
12112855Sgabeblack@google.com    // Need to use 64 bits to make sure that read requests get handled properly
12212855Sgabeblack@google.com
12312855Sgabeblack@google.com    typedef int RegContextParam;
12412855Sgabeblack@google.com    typedef int RegContextVal;
12512855Sgabeblack@google.com
12612855Sgabeblack@google.com    //used in FP convert & round function
12712855Sgabeblack@google.com    enum ConvertType{
12812855Sgabeblack@google.com        SINGLE_TO_DOUBLE,
12912855Sgabeblack@google.com        SINGLE_TO_WORD,
13012855Sgabeblack@google.com        SINGLE_TO_LONG,
13112855Sgabeblack@google.com
13212855Sgabeblack@google.com        DOUBLE_TO_SINGLE,
13312855Sgabeblack@google.com        DOUBLE_TO_WORD,
13412855Sgabeblack@google.com        DOUBLE_TO_LONG,
13512855Sgabeblack@google.com
13612855Sgabeblack@google.com        LONG_TO_SINGLE,
13712855Sgabeblack@google.com        LONG_TO_DOUBLE,
13812855Sgabeblack@google.com        LONG_TO_WORD,
13912855Sgabeblack@google.com        LONG_TO_PS,
14012855Sgabeblack@google.com
14112855Sgabeblack@google.com        WORD_TO_SINGLE,
14212855Sgabeblack@google.com        WORD_TO_DOUBLE,
14312855Sgabeblack@google.com        WORD_TO_LONG,
14412855Sgabeblack@google.com        WORD_TO_PS,
14512855Sgabeblack@google.com
14612855Sgabeblack@google.com        PL_TO_SINGLE,
14712855Sgabeblack@google.com        PU_TO_SINGLE
14812855Sgabeblack@google.com    };
14912855Sgabeblack@google.com
15012855Sgabeblack@google.com    //used in FP convert & round function
15112855Sgabeblack@google.com    enum RoundMode{
15212855Sgabeblack@google.com        RND_ZERO,
15312855Sgabeblack@google.com        RND_DOWN,
15412855Sgabeblack@google.com        RND_UP,
15512855Sgabeblack@google.com        RND_NEAREST
15612855Sgabeblack@google.com    };
15712855Sgabeblack@google.com
15812855Sgabeblack@google.com    enum OperatingMode {
15912855Sgabeblack@google.com        MODE_USER = 16,
16012855Sgabeblack@google.com        MODE_FIQ = 17,
16112855Sgabeblack@google.com        MODE_IRQ = 18,
16212855Sgabeblack@google.com        MODE_SVC = 19,
16312855Sgabeblack@google.com        MODE_MON = 22,
16412855Sgabeblack@google.com        MODE_ABORT = 23,
16512855Sgabeblack@google.com        MODE_UNDEFINED = 27,
16612855Sgabeblack@google.com        MODE_SYSTEM = 31
16712855Sgabeblack@google.com    };
16812855Sgabeblack@google.com
16912855Sgabeblack@google.com    struct CoreSpecific {
17012855Sgabeblack@google.com        // Empty for now on the ARM
17112855Sgabeblack@google.com    };
17212855Sgabeblack@google.com
17312855Sgabeblack@google.com} // namespace ArmISA
17412855Sgabeblack@google.com
17512855Sgabeblack@google.com#endif
17612855Sgabeblack@google.com