isa_traits.hh revision 3804
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 *
282972Sgblack@eecs.umich.edu * Authors: Gabe Black
293804Ssaidi@eecs.umich.edu *          Ali Saidi
302023SN/A */
312023SN/A
322023SN/A#ifndef __ARCH_SPARC_ISA_TRAITS_HH__
332023SN/A#define __ARCH_SPARC_ISA_TRAITS_HH__
342023SN/A
352972Sgblack@eecs.umich.edu#include "arch/sparc/types.hh"
362225SN/A#include "base/misc.hh"
372225SN/A#include "config/full_system.hh"
382225SN/A#include "sim/host.hh"
392225SN/A
402680Sktlim@umich.educlass ThreadContext;
412023SN/Aclass FastCPU;
422023SN/A//class FullCPU;
432225SN/Aclass Checkpoint;
442023SN/A
452225SN/Aclass StaticInst;
462225SN/Aclass StaticInstPtr;
472023SN/A
482458SN/Anamespace BigEndianGuest {}
492023SN/A
502458SN/Anamespace SparcISA
512458SN/A{
522972Sgblack@eecs.umich.edu    class RegFile;
532972Sgblack@eecs.umich.edu
542972Sgblack@eecs.umich.edu    //This makes sure the big endian versions of certain functions are used.
552972Sgblack@eecs.umich.edu    using namespace BigEndianGuest;
562972Sgblack@eecs.umich.edu
573437Sgblack@eecs.umich.edu    // SPARC has a delay slot
583093Sksewell@umich.edu    #define ISA_HAS_DELAY_SLOT 1
593093Sksewell@umich.edu
603414Sgblack@eecs.umich.edu    // SPARC NOP (sethi %(hi(0), g0)
613414Sgblack@eecs.umich.edu    const MachInst NoopMachInst = 0x01000000;
622972Sgblack@eecs.umich.edu
633437Sgblack@eecs.umich.edu    const int NumRegularIntRegs = 32;
643437Sgblack@eecs.umich.edu    const int NumMicroIntRegs = 1;
653437Sgblack@eecs.umich.edu    const int NumIntRegs =
663437Sgblack@eecs.umich.edu        NumRegularIntRegs +
673437Sgblack@eecs.umich.edu        NumMicroIntRegs;
682972Sgblack@eecs.umich.edu    const int NumFloatRegs = 64;
692972Sgblack@eecs.umich.edu    const int NumMiscRegs = 40;
702469SN/A
712469SN/A    // These enumerate all the registers for dependence tracking.
722469SN/A    enum DependenceTags {
732469SN/A        // 0..31 are the integer regs 0..31
742972Sgblack@eecs.umich.edu        // 32..95 are the FP regs 0..31, i.e. use (reg + FP_Base_DepTag)
752972Sgblack@eecs.umich.edu        FP_Base_DepTag = NumIntRegs,
763601Sgblack@eecs.umich.edu        Ctrl_Base_DepTag = NumIntRegs + NumMicroIntRegs + NumFloatRegs,
772469SN/A    };
782469SN/A
792023SN/A
802972Sgblack@eecs.umich.edu    // MAXTL - maximum trap level
812972Sgblack@eecs.umich.edu    const int MaxPTL = 2;
822972Sgblack@eecs.umich.edu    const int MaxTL  = 6;
832972Sgblack@eecs.umich.edu    const int MaxGL  = 3;
842972Sgblack@eecs.umich.edu    const int MaxPGL = 2;
852458SN/A
862972Sgblack@eecs.umich.edu    // NWINDOWS - number of register windows, can be 3 to 32
873421Sgblack@eecs.umich.edu    const int NWindows = 8;
882458SN/A
892458SN/A    // semantically meaningful register indices
902458SN/A    const int ZeroReg = 0;	// architecturally meaningful
912458SN/A    // the rest of these depend on the ABI
922458SN/A    const int StackPointerReg = 14;
932458SN/A    const int ReturnAddressReg = 31; // post call, precall is 15
942458SN/A    const int ReturnValueReg = 8; // Post return, 24 is pre-return.
952458SN/A    const int FramePointerReg = 30;
962458SN/A    const int ArgumentReg0 = 8;
972458SN/A    const int ArgumentReg1 = 9;
982458SN/A    const int ArgumentReg2 = 10;
992458SN/A    const int ArgumentReg3 = 11;
1002458SN/A    const int ArgumentReg4 = 12;
1012458SN/A    const int ArgumentReg5 = 13;
1022510SN/A    // Some OS syscall use a second register (o1) to return a second value
1032458SN/A    const int SyscallPseudoReturnReg = ArgumentReg1;
1042458SN/A
1052458SN/A    //XXX These numbers are bogus
1062525SN/A    const int MaxInstSrcRegs = 8;
1072561SN/A    const int MaxInstDestRegs = 9;
1082458SN/A
1092458SN/A    //8K. This value is implmentation specific; and should probably
1102458SN/A    //be somewhere else.
1112458SN/A    const int LogVMPageSize = 13;
1122458SN/A    const int VMPageSize = (1 << LogVMPageSize);
1132458SN/A
1142458SN/A    //Why does both the previous set of constants and this one exist?
1152458SN/A    const int PageShift = 13;
1162458SN/A    const int PageBytes = ULL(1) << PageShift;
1172458SN/A
1182458SN/A    const int BranchPredAddrShiftAmt = 2;
1192458SN/A
1202474SN/A    const int MachineBytes = 8;
1212458SN/A    const int WordBytes = 4;
1222458SN/A    const int HalfwordBytes = 2;
1232458SN/A    const int ByteBytes = 1;
1242458SN/A
1252458SN/A    void serialize(std::ostream & os);
1262458SN/A
1272458SN/A    void unserialize(Checkpoint *cp, const std::string &section);
1282458SN/A
1292469SN/A    StaticInstPtr decodeInst(ExtMachInst);
1302458SN/A
1312458SN/A    // return a no-op instruction... used for instruction fetch faults
1322458SN/A    extern const MachInst NoopMachInst;
1333804Ssaidi@eecs.umich.edu
1343804Ssaidi@eecs.umich.edu#if FULL_SYSTEM
1353804Ssaidi@eecs.umich.edu    ////////// Interrupt Stuff ///////////
1363804Ssaidi@eecs.umich.edu    enum InterruptLevels
1373804Ssaidi@eecs.umich.edu    {
1383804Ssaidi@eecs.umich.edu       INTLEVEL_MIN = 1,
1393804Ssaidi@eecs.umich.edu       INTLEVEL_MAX = 15,
1403804Ssaidi@eecs.umich.edu
1413804Ssaidi@eecs.umich.edu       NumInterruptLevels = INTLEVEL_MAX - INTLEVEL_MIN
1423804Ssaidi@eecs.umich.edu    };
1433804Ssaidi@eecs.umich.edu
1443804Ssaidi@eecs.umich.edu    // I don't know what it's for, so I don't
1453804Ssaidi@eecs.umich.edu    // know what SPARC's value should be
1463804Ssaidi@eecs.umich.edu    // For loading... XXX This maybe could be USegEnd?? --ali
1473804Ssaidi@eecs.umich.edu    const Addr LoadAddrMask = ULL(0xffffffffff);
1483804Ssaidi@eecs.umich.edu
1493804Ssaidi@eecs.umich.edu    /////////// TLB Stuff ////////////
1503804Ssaidi@eecs.umich.edu    const Addr StartVAddrHole = ULL(0x0000800000000000);
1513804Ssaidi@eecs.umich.edu    const Addr EndVAddrHole = ULL(0xFFFF7FFFFFFFFFFF);
1523804Ssaidi@eecs.umich.edu    const Addr VAddrAMask = ULL(0xFFFFFFFF);
1533804Ssaidi@eecs.umich.edu    const Addr PAddrImplMask = ULL(0x000000FFFFFFFFFF);
1543804Ssaidi@eecs.umich.edu    const Addr BytesInPageMask = ULL(0x1FFF);
1553804Ssaidi@eecs.umich.edu
1563804Ssaidi@eecs.umich.edu#endif
1572458SN/A}
1582458SN/A
1592023SN/A#endif // __ARCH_SPARC_ISA_TRAITS_HH__
160