isa_traits.hh revision 4120
12023SN/A/* 22023SN/A * Copyright (c) 2003-2005 The Regents of The University of Michigan 32023SN/A * All rights reserved. 42023SN/A * 52023SN/A * Redistribution and use in source and binary forms, with or without 62023SN/A * modification, are permitted provided that the following conditions are 72023SN/A * met: redistributions of source code must retain the above copyright 82023SN/A * notice, this list of conditions and the following disclaimer; 92023SN/A * redistributions in binary form must reproduce the above copyright 102023SN/A * notice, this list of conditions and the following disclaimer in the 112023SN/A * documentation and/or other materials provided with the distribution; 122023SN/A * neither the name of the copyright holders nor the names of its 132023SN/A * contributors may be used to endorse or promote products derived from 142023SN/A * this software without specific prior written permission. 152023SN/A * 162023SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172023SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182023SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192023SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202023SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212023SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222023SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232023SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242023SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252023SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262023SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665Ssaidi@eecs.umich.edu * 282665Ssaidi@eecs.umich.edu * Authors: Gabe Black 292665Ssaidi@eecs.umich.edu * Korey Sewell 302023SN/A */ 312023SN/A 322028SN/A#ifndef __ARCH_MIPS_ISA_TRAITS_HH__ 332028SN/A#define __ARCH_MIPS_ISA_TRAITS_HH__ 342023SN/A 352597SN/A#include "arch/mips/types.hh" 362023SN/A#include "sim/host.hh" 372023SN/A 382239SN/Anamespace LittleEndianGuest {}; 392239SN/A 402028SN/A#define TARGET_MIPS 412023SN/A 422131SN/Aclass StaticInstPtr; 432023SN/A 442131SN/Anamespace MipsISA 452023SN/A{ 462525SN/A using namespace LittleEndianGuest; 472525SN/A 482447SN/A StaticInstPtr decodeInst(ExtMachInst); 492023SN/A 503093Sksewell@umich.edu // MIPS DOES a delay slot 513093Sksewell@umich.edu #define ISA_HAS_DELAY_SLOT 1 523093Sksewell@umich.edu 532972Sgblack@eecs.umich.edu const Addr PageShift = 13; 542972Sgblack@eecs.umich.edu const Addr PageBytes = ULL(1) << PageShift; 552972Sgblack@eecs.umich.edu const Addr PageMask = ~(PageBytes - 1); 562972Sgblack@eecs.umich.edu const Addr PageOffset = PageBytes - 1; 572239SN/A 582972Sgblack@eecs.umich.edu // return a no-op instruction... used for instruction fetch faults 592972Sgblack@eecs.umich.edu const ExtMachInst NoopMachInst = 0x00000000; 602131SN/A 612972Sgblack@eecs.umich.edu // Constants Related to the number of registers 622972Sgblack@eecs.umich.edu const int NumIntArchRegs = 32; 632972Sgblack@eecs.umich.edu const int NumIntSpecialRegs = 2; 642972Sgblack@eecs.umich.edu const int NumFloatArchRegs = 32; 652972Sgblack@eecs.umich.edu const int NumFloatSpecialRegs = 5; 662972Sgblack@eecs.umich.edu const int NumControlRegs = 265; 672972Sgblack@eecs.umich.edu const int NumInternalProcRegs = 0; 682131SN/A 692972Sgblack@eecs.umich.edu const int NumIntRegs = NumIntArchRegs + NumIntSpecialRegs; //HI & LO Regs 702972Sgblack@eecs.umich.edu const int NumFloatRegs = NumFloatArchRegs + NumFloatSpecialRegs;// 712972Sgblack@eecs.umich.edu const int NumMiscRegs = NumControlRegs; 722131SN/A 732972Sgblack@eecs.umich.edu const int TotalNumRegs = NumIntRegs + NumFloatRegs + 742972Sgblack@eecs.umich.edu NumMiscRegs + 0/*NumInternalProcRegs*/; 752597SN/A 762972Sgblack@eecs.umich.edu const int TotalDataRegs = NumIntRegs + NumFloatRegs; 772597SN/A 782972Sgblack@eecs.umich.edu // Static instruction parameters 792972Sgblack@eecs.umich.edu const int MaxInstSrcRegs = 3; 802972Sgblack@eecs.umich.edu const int MaxInstDestRegs = 2; 812597SN/A 822972Sgblack@eecs.umich.edu // semantically meaningful register indices 832972Sgblack@eecs.umich.edu const int ZeroReg = 0; 842972Sgblack@eecs.umich.edu const int AssemblerReg = 1; 852972Sgblack@eecs.umich.edu const int ReturnValueReg = 2; 862972Sgblack@eecs.umich.edu const int ReturnValueReg1 = 2; 872972Sgblack@eecs.umich.edu const int ReturnValueReg2 = 3; 882972Sgblack@eecs.umich.edu const int ArgumentReg0 = 4; 892972Sgblack@eecs.umich.edu const int ArgumentReg1 = 5; 902972Sgblack@eecs.umich.edu const int ArgumentReg2 = 6; 912972Sgblack@eecs.umich.edu const int ArgumentReg3 = 7; 922972Sgblack@eecs.umich.edu const int KernelReg0 = 26; 932972Sgblack@eecs.umich.edu const int KernelReg1 = 27; 942972Sgblack@eecs.umich.edu const int GlobalPointerReg = 28; 952972Sgblack@eecs.umich.edu const int StackPointerReg = 29; 962972Sgblack@eecs.umich.edu const int FramePointerReg = 30; 972972Sgblack@eecs.umich.edu const int ReturnAddressReg = 31; 982597SN/A 992972Sgblack@eecs.umich.edu const int SyscallNumReg = ReturnValueReg1; 1002972Sgblack@eecs.umich.edu const int SyscallPseudoReturnReg = ReturnValueReg1; 1012972Sgblack@eecs.umich.edu const int SyscallSuccessReg = ArgumentReg3; 1022131SN/A 1032972Sgblack@eecs.umich.edu const int LogVMPageSize = 13; // 8K bytes 1042972Sgblack@eecs.umich.edu const int VMPageSize = (1 << LogVMPageSize); 1052131SN/A 1062972Sgblack@eecs.umich.edu const int BranchPredAddrShiftAmt = 2; // instructions are 4-byte aligned 1072131SN/A 1082972Sgblack@eecs.umich.edu const int MachineBytes = 4; 1092972Sgblack@eecs.umich.edu const int WordBytes = 4; 1102972Sgblack@eecs.umich.edu const int HalfwordBytes = 2; 1112972Sgblack@eecs.umich.edu const int ByteBytes = 1; 1122131SN/A 1132972Sgblack@eecs.umich.edu // These help enumerate all the registers for dependence tracking. 1142972Sgblack@eecs.umich.edu const int FP_Base_DepTag = 34; 1152972Sgblack@eecs.umich.edu const int Ctrl_Base_DepTag = 257; 1162131SN/A 1172972Sgblack@eecs.umich.edu const int ANNOTE_NONE = 0; 1182972Sgblack@eecs.umich.edu const uint32_t ITOUCH_ANNOTE = 0xffffffff; 1192131SN/A 1202023SN/A}; 1212023SN/A 1222447SN/Ausing namespace MipsISA; 1232447SN/A 1242028SN/A#endif // __ARCH_MIPS_ISA_TRAITS_HH__ 125