isa_traits.hh revision 2972
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;
437047Snate@binkert.org
447047Snate@binkert.orgnamespace MipsISA
457047Snate@binkert.org{
467047Snate@binkert.org    using namespace LittleEndianGuest;
478127Sgblack@eecs.umich.edu
488127Sgblack@eecs.umich.edu    StaticInstPtr decodeInst(ExtMachInst);
498127Sgblack@eecs.umich.edu
508127Sgblack@eecs.umich.edu    const Addr PageShift = 13;
518127Sgblack@eecs.umich.edu    const Addr PageBytes = ULL(1) << PageShift;
528127Sgblack@eecs.umich.edu    const Addr PageMask = ~(PageBytes - 1);
537047Snate@binkert.org    const Addr PageOffset = PageBytes - 1;
548319Ssteve.reinhardt@amd.com
558319Ssteve.reinhardt@amd.com    // return a no-op instruction... used for instruction fetch faults
568319Ssteve.reinhardt@amd.com    const ExtMachInst NoopMachInst = 0x00000000;
578319Ssteve.reinhardt@amd.com
588319Ssteve.reinhardt@amd.com    // Constants Related to the number of registers
598319Ssteve.reinhardt@amd.com    const int NumIntArchRegs = 32;
608319Ssteve.reinhardt@amd.com    const int NumIntSpecialRegs = 2;
617047Snate@binkert.org    const int NumFloatArchRegs = 32;
628319Ssteve.reinhardt@amd.com    const int NumFloatSpecialRegs = 5;
638319Ssteve.reinhardt@amd.com    const int NumControlRegs = 265;
647047Snate@binkert.org    const int NumInternalProcRegs = 0;
657047Snate@binkert.org
668319Ssteve.reinhardt@amd.com    const int NumIntRegs = NumIntArchRegs + NumIntSpecialRegs;        //HI & LO Regs
678319Ssteve.reinhardt@amd.com    const int NumFloatRegs = NumFloatArchRegs + NumFloatSpecialRegs;//
688319Ssteve.reinhardt@amd.com    const int NumMiscRegs = NumControlRegs;
697047Snate@binkert.org
707047Snate@binkert.org    const int TotalNumRegs = NumIntRegs + NumFloatRegs +
717047Snate@binkert.org    NumMiscRegs + 0/*NumInternalProcRegs*/;
721897Sstever@eecs.umich.edu
731897Sstever@eecs.umich.edu    const int TotalDataRegs = NumIntRegs + NumFloatRegs;
741897Sstever@eecs.umich.edu
751897Sstever@eecs.umich.edu    // Static instruction parameters
768319Ssteve.reinhardt@amd.com    const int MaxInstSrcRegs = 3;
778319Ssteve.reinhardt@amd.com    const int MaxInstDestRegs = 2;
788319Ssteve.reinhardt@amd.com
798319Ssteve.reinhardt@amd.com    // semantically meaningful register indices
808319Ssteve.reinhardt@amd.com    const int ZeroReg = 0;
818319Ssteve.reinhardt@amd.com    const int AssemblerReg = 1;
828319Ssteve.reinhardt@amd.com    const int ReturnValueReg = 2;
831897Sstever@eecs.umich.edu    const int ReturnValueReg1 = 2;
848319Ssteve.reinhardt@amd.com    const int ReturnValueReg2 = 3;
858319Ssteve.reinhardt@amd.com    const int ArgumentReg0 = 4;
868319Ssteve.reinhardt@amd.com    const int ArgumentReg1 = 5;
871897Sstever@eecs.umich.edu    const int ArgumentReg2 = 6;
887047Snate@binkert.org    const int ArgumentReg3 = 7;
897047Snate@binkert.org    const int KernelReg0 = 26;
901897Sstever@eecs.umich.edu    const int KernelReg1 = 27;
911897Sstever@eecs.umich.edu    const int GlobalPointerReg = 28;
924961Ssaidi@eecs.umich.edu    const int StackPointerReg = 29;
934961Ssaidi@eecs.umich.edu    const int FramePointerReg = 30;
944961Ssaidi@eecs.umich.edu    const int ReturnAddressReg = 31;
954961Ssaidi@eecs.umich.edu
964961Ssaidi@eecs.umich.edu    const int SyscallNumReg = ReturnValueReg1;
974961Ssaidi@eecs.umich.edu    const int SyscallPseudoReturnReg = ReturnValueReg1;
984961Ssaidi@eecs.umich.edu    const int SyscallSuccessReg = ArgumentReg3;
994961Ssaidi@eecs.umich.edu
1004961Ssaidi@eecs.umich.edu    const int LogVMPageSize = 13;	// 8K bytes
1014961Ssaidi@eecs.umich.edu    const int VMPageSize = (1 << LogVMPageSize);
1024961Ssaidi@eecs.umich.edu
1034961Ssaidi@eecs.umich.edu    const int BranchPredAddrShiftAmt = 2; // instructions are 4-byte aligned
1044961Ssaidi@eecs.umich.edu
1054961Ssaidi@eecs.umich.edu    const int MachineBytes = 4;
1061897Sstever@eecs.umich.edu    const int WordBytes = 4;
1078319Ssteve.reinhardt@amd.com    const int HalfwordBytes = 2;
1081897Sstever@eecs.umich.edu    const int ByteBytes = 1;
1098319Ssteve.reinhardt@amd.com
1108319Ssteve.reinhardt@amd.com    // These help enumerate all the registers for dependence tracking.
1118319Ssteve.reinhardt@amd.com    const int FP_Base_DepTag = 34;
1128319Ssteve.reinhardt@amd.com    const int Ctrl_Base_DepTag = 257;
1138319Ssteve.reinhardt@amd.com
1148319Ssteve.reinhardt@amd.com    const int ANNOTE_NONE = 0;
1158319Ssteve.reinhardt@amd.com    const uint32_t ITOUCH_ANNOTE = 0xffffffff;
1164961Ssaidi@eecs.umich.edu
1178319Ssteve.reinhardt@amd.com};
1188319Ssteve.reinhardt@amd.com
1198319Ssteve.reinhardt@amd.comusing namespace MipsISA;
1208319Ssteve.reinhardt@amd.com
1218319Ssteve.reinhardt@amd.com#endif // __ARCH_MIPS_ISA_TRAITS_HH__
1228319Ssteve.reinhardt@amd.com