isa_traits.hh revision 3093:b09c33e66bce
11897Sstever@eecs.umich.edu/*
24130Ssaidi@eecs.umich.edu * Copyright (c) 2003-2005 The Regents of The University of Michigan
31897Sstever@eecs.umich.edu * All rights reserved.
41897Sstever@eecs.umich.edu *
51897Sstever@eecs.umich.edu * Redistribution and use in source and binary forms, with or without
61897Sstever@eecs.umich.edu * modification, are permitted provided that the following conditions are
71897Sstever@eecs.umich.edu * met: redistributions of source code must retain the above copyright
81897Sstever@eecs.umich.edu * notice, this list of conditions and the following disclaimer;
91897Sstever@eecs.umich.edu * redistributions in binary form must reproduce the above copyright
101897Sstever@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the
111897Sstever@eecs.umich.edu * documentation and/or other materials provided with the distribution;
121897Sstever@eecs.umich.edu * neither the name of the copyright holders nor the names of its
131897Sstever@eecs.umich.edu * contributors may be used to endorse or promote products derived from
141897Sstever@eecs.umich.edu * this software without specific prior written permission.
151897Sstever@eecs.umich.edu *
161897Sstever@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
171897Sstever@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
181897Sstever@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
191897Sstever@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
201897Sstever@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
211897Sstever@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
221897Sstever@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
231897Sstever@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
241897Sstever@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
251897Sstever@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
261897Sstever@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
271897Sstever@eecs.umich.edu *
281897Sstever@eecs.umich.edu * Authors: Gabe Black
291897Sstever@eecs.umich.edu *          Korey Sewell
301897Sstever@eecs.umich.edu */
311897Sstever@eecs.umich.edu
321897Sstever@eecs.umich.edu#ifndef __ARCH_MIPS_ISA_TRAITS_HH__
331897Sstever@eecs.umich.edu#define __ARCH_MIPS_ISA_TRAITS_HH__
344961Ssaidi@eecs.umich.edu
351897Sstever@eecs.umich.edu#include "arch/mips/types.hh"
361897Sstever@eecs.umich.edu#include "sim/host.hh"
371897Sstever@eecs.umich.edu
381897Sstever@eecs.umich.edunamespace LittleEndianGuest {};
397047Snate@binkert.org
408319Ssteve.reinhardt@amd.com#define TARGET_MIPS
417047Snate@binkert.org
428319Ssteve.reinhardt@amd.comclass StaticInstPtr;
438811Sandreas.hansson@arm.com
448811Sandreas.hansson@arm.comnamespace MipsISA
458811Sandreas.hansson@arm.com{
468811Sandreas.hansson@arm.com    using namespace LittleEndianGuest;
478811Sandreas.hansson@arm.com
488811Sandreas.hansson@arm.com    StaticInstPtr decodeInst(ExtMachInst);
498811Sandreas.hansson@arm.com
508969Snilay@cs.wisc.edu    // MIPS DOES a delay slot
518811Sandreas.hansson@arm.com    #define ISA_HAS_DELAY_SLOT 1
527047Snate@binkert.org
538811Sandreas.hansson@arm.com    const Addr PageShift = 13;
548811Sandreas.hansson@arm.com    const Addr PageBytes = ULL(1) << PageShift;
558811Sandreas.hansson@arm.com    const Addr PageMask = ~(PageBytes - 1);
568319Ssteve.reinhardt@amd.com    const Addr PageOffset = PageBytes - 1;
578319Ssteve.reinhardt@amd.com
588319Ssteve.reinhardt@amd.com    // return a no-op instruction... used for instruction fetch faults
598319Ssteve.reinhardt@amd.com    const ExtMachInst NoopMachInst = 0x00000000;
608319Ssteve.reinhardt@amd.com
618319Ssteve.reinhardt@amd.com    // Constants Related to the number of registers
628319Ssteve.reinhardt@amd.com    const int NumIntArchRegs = 32;
637047Snate@binkert.org    const int NumIntSpecialRegs = 2;
648319Ssteve.reinhardt@amd.com    const int NumFloatArchRegs = 32;
658319Ssteve.reinhardt@amd.com    const int NumFloatSpecialRegs = 5;
667047Snate@binkert.org    const int NumControlRegs = 265;
677047Snate@binkert.org    const int NumInternalProcRegs = 0;
688319Ssteve.reinhardt@amd.com
698319Ssteve.reinhardt@amd.com    const int NumIntRegs = NumIntArchRegs + NumIntSpecialRegs;        //HI & LO Regs
708319Ssteve.reinhardt@amd.com    const int NumFloatRegs = NumFloatArchRegs + NumFloatSpecialRegs;//
717047Snate@binkert.org    const int NumMiscRegs = NumControlRegs;
727047Snate@binkert.org
737047Snate@binkert.org    const int TotalNumRegs = NumIntRegs + NumFloatRegs +
741897Sstever@eecs.umich.edu    NumMiscRegs + 0/*NumInternalProcRegs*/;
751897Sstever@eecs.umich.edu
761897Sstever@eecs.umich.edu    const int TotalDataRegs = NumIntRegs + NumFloatRegs;
771897Sstever@eecs.umich.edu
788319Ssteve.reinhardt@amd.com    // Static instruction parameters
798319Ssteve.reinhardt@amd.com    const int MaxInstSrcRegs = 3;
808319Ssteve.reinhardt@amd.com    const int MaxInstDestRegs = 2;
818319Ssteve.reinhardt@amd.com
828319Ssteve.reinhardt@amd.com    // semantically meaningful register indices
838319Ssteve.reinhardt@amd.com    const int ZeroReg = 0;
848319Ssteve.reinhardt@amd.com    const int AssemblerReg = 1;
851897Sstever@eecs.umich.edu    const int ReturnValueReg = 2;
868319Ssteve.reinhardt@amd.com    const int ReturnValueReg1 = 2;
878811Sandreas.hansson@arm.com    const int ReturnValueReg2 = 3;
888319Ssteve.reinhardt@amd.com    const int ArgumentReg0 = 4;
898319Ssteve.reinhardt@amd.com    const int ArgumentReg1 = 5;
901897Sstever@eecs.umich.edu    const int ArgumentReg2 = 6;
917047Snate@binkert.org    const int ArgumentReg3 = 7;
927047Snate@binkert.org    const int KernelReg0 = 26;
931897Sstever@eecs.umich.edu    const int KernelReg1 = 27;
941897Sstever@eecs.umich.edu    const int GlobalPointerReg = 28;
954961Ssaidi@eecs.umich.edu    const int StackPointerReg = 29;
964961Ssaidi@eecs.umich.edu    const int FramePointerReg = 30;
974961Ssaidi@eecs.umich.edu    const int ReturnAddressReg = 31;
984961Ssaidi@eecs.umich.edu
994961Ssaidi@eecs.umich.edu    const int SyscallNumReg = ReturnValueReg1;
1004961Ssaidi@eecs.umich.edu    const int SyscallPseudoReturnReg = ReturnValueReg1;
1014961Ssaidi@eecs.umich.edu    const int SyscallSuccessReg = ArgumentReg3;
1024961Ssaidi@eecs.umich.edu
1034961Ssaidi@eecs.umich.edu    const int LogVMPageSize = 13;	// 8K bytes
1044961Ssaidi@eecs.umich.edu    const int VMPageSize = (1 << LogVMPageSize);
1054961Ssaidi@eecs.umich.edu
1064961Ssaidi@eecs.umich.edu    const int BranchPredAddrShiftAmt = 2; // instructions are 4-byte aligned
1074961Ssaidi@eecs.umich.edu
1084961Ssaidi@eecs.umich.edu    const int MachineBytes = 4;
1091897Sstever@eecs.umich.edu    const int WordBytes = 4;
1108319Ssteve.reinhardt@amd.com    const int HalfwordBytes = 2;
1111897Sstever@eecs.umich.edu    const int ByteBytes = 1;
1128319Ssteve.reinhardt@amd.com
1138319Ssteve.reinhardt@amd.com    // These help enumerate all the registers for dependence tracking.
1148816Sgblack@eecs.umich.edu    const int FP_Base_DepTag = 34;
1158319Ssteve.reinhardt@amd.com    const int Ctrl_Base_DepTag = 257;
1168319Ssteve.reinhardt@amd.com
1178319Ssteve.reinhardt@amd.com    const int ANNOTE_NONE = 0;
1188811Sandreas.hansson@arm.com    const uint32_t ITOUCH_ANNOTE = 0xffffffff;
1194961Ssaidi@eecs.umich.edu
1208319Ssteve.reinhardt@amd.com};
1218811Sandreas.hansson@arm.com
1228814Sgblack@eecs.umich.eduusing namespace MipsISA;
1238319Ssteve.reinhardt@amd.com
1248811Sandreas.hansson@arm.com#endif // __ARCH_MIPS_ISA_TRAITS_HH__
1258811Sandreas.hansson@arm.com