isa_traits.hh revision 5228
12SN/A/*
21458SN/A * Copyright (c) 2003-2005 The Regents of The University of Michigan
32SN/A * All rights reserved.
42SN/A *
52SN/A * Redistribution and use in source and binary forms, with or without
62SN/A * modification, are permitted provided that the following conditions are
72SN/A * met: redistributions of source code must retain the above copyright
82SN/A * notice, this list of conditions and the following disclaimer;
92SN/A * redistributions in binary form must reproduce the above copyright
102SN/A * notice, this list of conditions and the following disclaimer in the
112SN/A * documentation and/or other materials provided with the distribution;
122SN/A * neither the name of the copyright holders nor the names of its
132SN/A * contributors may be used to endorse or promote products derived from
142SN/A * this software without specific prior written permission.
152SN/A *
162SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665Ssaidi@eecs.umich.edu *
282665Ssaidi@eecs.umich.edu * Authors: Steve Reinhardt
292665Ssaidi@eecs.umich.edu *          Gabe Black
302SN/A */
312SN/A
321147SN/A#ifndef __ARCH_ALPHA_ISA_TRAITS_HH__
331147SN/A#define __ARCH_ALPHA_ISA_TRAITS_HH__
342SN/A
352037SN/Anamespace LittleEndianGuest {}
362037SN/A
373457Sgblack@eecs.umich.edu#include "arch/alpha/ipr.hh"
385228Sgblack@eecs.umich.edu#include "arch/alpha/max_inst_regs.hh"
392428SN/A#include "arch/alpha/types.hh"
401858SN/A#include "config/full_system.hh"
4156SN/A#include "sim/host.hh"
422SN/A
432107SN/Aclass StaticInstPtr;
442SN/A
452972Sgblack@eecs.umich.edunamespace AlphaISA
462972Sgblack@eecs.umich.edu{
472972Sgblack@eecs.umich.edu    using namespace LittleEndianGuest;
485228Sgblack@eecs.umich.edu    using AlphaISAInst::MaxInstSrcRegs;
495228Sgblack@eecs.umich.edu    using AlphaISAInst::MaxInstDestRegs;
502238SN/A
512972Sgblack@eecs.umich.edu    // These enumerate all the registers for dependence tracking.
522972Sgblack@eecs.umich.edu    enum DependenceTags {
532972Sgblack@eecs.umich.edu        // 0..31 are the integer regs 0..31
542972Sgblack@eecs.umich.edu        // 32..63 are the FP regs 0..31, i.e. use (reg + FP_Base_DepTag)
552972Sgblack@eecs.umich.edu        FP_Base_DepTag = 40,
563586Sgblack@eecs.umich.edu        Ctrl_Base_DepTag = 72
572972Sgblack@eecs.umich.edu    };
582238SN/A
592972Sgblack@eecs.umich.edu    StaticInstPtr decodeInst(ExtMachInst);
602238SN/A
613093Sksewell@umich.edu    // Alpha Does NOT have a delay slot
623093Sksewell@umich.edu    #define ISA_HAS_DELAY_SLOT 0
633093Sksewell@umich.edu
642972Sgblack@eecs.umich.edu    const Addr PageShift = 13;
652972Sgblack@eecs.umich.edu    const Addr PageBytes = ULL(1) << PageShift;
662972Sgblack@eecs.umich.edu    const Addr PageMask = ~(PageBytes - 1);
672972Sgblack@eecs.umich.edu    const Addr PageOffset = PageBytes - 1;
682972Sgblack@eecs.umich.edu
692972Sgblack@eecs.umich.edu
702972Sgblack@eecs.umich.edu    ////////////////////////////////////////////////////////////////////////
712972Sgblack@eecs.umich.edu    //
722972Sgblack@eecs.umich.edu    //  Translation stuff
732972Sgblack@eecs.umich.edu    //
742972Sgblack@eecs.umich.edu
754997Sgblack@eecs.umich.edu    const Addr PteShift = 3;
762972Sgblack@eecs.umich.edu    const Addr NPtePageShift = PageShift - PteShift;
772972Sgblack@eecs.umich.edu    const Addr NPtePage = ULL(1) << NPtePageShift;
782972Sgblack@eecs.umich.edu    const Addr PteMask = NPtePage - 1;
792972Sgblack@eecs.umich.edu
802972Sgblack@eecs.umich.edu    // User Virtual
812972Sgblack@eecs.umich.edu    const Addr USegBase = ULL(0x0);
822972Sgblack@eecs.umich.edu    const Addr USegEnd = ULL(0x000003ffffffffff);
832972Sgblack@eecs.umich.edu
842972Sgblack@eecs.umich.edu    // Kernel Direct Mapped
852972Sgblack@eecs.umich.edu    const Addr K0SegBase = ULL(0xfffffc0000000000);
862972Sgblack@eecs.umich.edu    const Addr K0SegEnd = ULL(0xfffffdffffffffff);
872972Sgblack@eecs.umich.edu
882972Sgblack@eecs.umich.edu    // Kernel Virtual
892972Sgblack@eecs.umich.edu    const Addr K1SegBase = ULL(0xfffffe0000000000);
902972Sgblack@eecs.umich.edu    const Addr K1SegEnd = ULL(0xffffffffffffffff);
912972Sgblack@eecs.umich.edu
922972Sgblack@eecs.umich.edu    // For loading... XXX This maybe could be USegEnd?? --ali
932972Sgblack@eecs.umich.edu    const Addr LoadAddrMask = ULL(0xffffffffff);
942972Sgblack@eecs.umich.edu
954997Sgblack@eecs.umich.edu#if FULL_SYSTEM
964997Sgblack@eecs.umich.edu
972972Sgblack@eecs.umich.edu    ////////////////////////////////////////////////////////////////////////
982972Sgblack@eecs.umich.edu    //
992972Sgblack@eecs.umich.edu    //  Interrupt levels
1002972Sgblack@eecs.umich.edu    //
1012972Sgblack@eecs.umich.edu    enum InterruptLevels
1022972Sgblack@eecs.umich.edu    {
1032972Sgblack@eecs.umich.edu        INTLEVEL_SOFTWARE_MIN = 4,
1042972Sgblack@eecs.umich.edu        INTLEVEL_SOFTWARE_MAX = 19,
1052972Sgblack@eecs.umich.edu
1062972Sgblack@eecs.umich.edu        INTLEVEL_EXTERNAL_MIN = 20,
1072972Sgblack@eecs.umich.edu        INTLEVEL_EXTERNAL_MAX = 34,
1082972Sgblack@eecs.umich.edu
1092972Sgblack@eecs.umich.edu        INTLEVEL_IRQ0 = 20,
1102972Sgblack@eecs.umich.edu        INTLEVEL_IRQ1 = 21,
1112972Sgblack@eecs.umich.edu        INTINDEX_ETHERNET = 0,
1122972Sgblack@eecs.umich.edu        INTINDEX_SCSI = 1,
1132972Sgblack@eecs.umich.edu        INTLEVEL_IRQ2 = 22,
1142972Sgblack@eecs.umich.edu        INTLEVEL_IRQ3 = 23,
1152972Sgblack@eecs.umich.edu
1162972Sgblack@eecs.umich.edu        INTLEVEL_SERIAL = 33,
1172972Sgblack@eecs.umich.edu
1182972Sgblack@eecs.umich.edu        NumInterruptLevels = INTLEVEL_EXTERNAL_MAX
1192972Sgblack@eecs.umich.edu    };
1202972Sgblack@eecs.umich.edu
1214997Sgblack@eecs.umich.edu#endif
1224997Sgblack@eecs.umich.edu
1232972Sgblack@eecs.umich.edu    // EV5 modes
1242972Sgblack@eecs.umich.edu    enum mode_type
1252972Sgblack@eecs.umich.edu    {
1262972Sgblack@eecs.umich.edu        mode_kernel = 0,		// kernel
1272972Sgblack@eecs.umich.edu        mode_executive = 1,		// executive (unused by unix)
1282972Sgblack@eecs.umich.edu        mode_supervisor = 2,	// supervisor (unused by unix)
1292972Sgblack@eecs.umich.edu        mode_user = 3,		// user mode
1302972Sgblack@eecs.umich.edu        mode_number			// number of modes
1312972Sgblack@eecs.umich.edu    };
1322238SN/A
1332972Sgblack@eecs.umich.edu    // Constants Related to the number of registers
1342512SN/A
1352972Sgblack@eecs.umich.edu    const int NumIntArchRegs = 32;
1362972Sgblack@eecs.umich.edu    const int NumPALShadowRegs = 8;
1372972Sgblack@eecs.umich.edu    const int NumFloatArchRegs = 32;
1382972Sgblack@eecs.umich.edu    // @todo: Figure out what this number really should be.
1393964Sgblack@eecs.umich.edu    const int NumMiscArchRegs = 77;
1402SN/A
1412972Sgblack@eecs.umich.edu    const int NumIntRegs = NumIntArchRegs + NumPALShadowRegs;
1422972Sgblack@eecs.umich.edu    const int NumFloatRegs = NumFloatArchRegs;
1432972Sgblack@eecs.umich.edu    const int NumMiscRegs = NumMiscArchRegs;
1442449SN/A
1452972Sgblack@eecs.umich.edu    const int TotalNumRegs = NumIntRegs + NumFloatRegs +
1462972Sgblack@eecs.umich.edu        NumMiscRegs + NumInternalProcRegs;
1472227SN/A
1482972Sgblack@eecs.umich.edu    const int TotalDataRegs = NumIntRegs + NumFloatRegs;
1492SN/A
1502972Sgblack@eecs.umich.edu    // semantically meaningful register indices
1512972Sgblack@eecs.umich.edu    const int ZeroReg = 31;	// architecturally meaningful
1522972Sgblack@eecs.umich.edu    // the rest of these depend on the ABI
1532972Sgblack@eecs.umich.edu    const int StackPointerReg = 30;
1542972Sgblack@eecs.umich.edu    const int GlobalPointerReg = 29;
1552972Sgblack@eecs.umich.edu    const int ProcedureValueReg = 27;
1562972Sgblack@eecs.umich.edu    const int ReturnAddressReg = 26;
1572972Sgblack@eecs.umich.edu    const int ReturnValueReg = 0;
1582972Sgblack@eecs.umich.edu    const int FramePointerReg = 15;
1594772Sgblack@eecs.umich.edu
1604772Sgblack@eecs.umich.edu    const int ArgumentReg[] = {16, 17, 18, 19, 20, 21};
1614772Sgblack@eecs.umich.edu    const int NumArgumentRegs = sizeof(ArgumentReg) / sizeof(const int);
1624772Sgblack@eecs.umich.edu
1632972Sgblack@eecs.umich.edu    const int SyscallNumReg = ReturnValueReg;
1644772Sgblack@eecs.umich.edu    const int SyscallPseudoReturnReg = ArgumentReg[4];
1652972Sgblack@eecs.umich.edu    const int SyscallSuccessReg = 19;
1662972Sgblack@eecs.umich.edu
1672972Sgblack@eecs.umich.edu    const int LogVMPageSize = 13;	// 8K bytes
1682972Sgblack@eecs.umich.edu    const int VMPageSize = (1 << LogVMPageSize);
1692972Sgblack@eecs.umich.edu
1702972Sgblack@eecs.umich.edu    const int BranchPredAddrShiftAmt = 2; // instructions are 4-byte aligned
1712972Sgblack@eecs.umich.edu
1722972Sgblack@eecs.umich.edu    const int MachineBytes = 8;
1732972Sgblack@eecs.umich.edu    const int WordBytes = 4;
1742972Sgblack@eecs.umich.edu    const int HalfwordBytes = 2;
1752972Sgblack@eecs.umich.edu    const int ByteBytes = 1;
1762972Sgblack@eecs.umich.edu
1772972Sgblack@eecs.umich.edu    // return a no-op instruction... used for instruction fetch faults
1782972Sgblack@eecs.umich.edu    // Alpha UNOP (ldq_u r31,0(r0))
1792972Sgblack@eecs.umich.edu    const ExtMachInst NoopMachInst = 0x2ffe0000;
1802972Sgblack@eecs.umich.edu
1812264SN/A};
1822107SN/A
1831147SN/A#endif // __ARCH_ALPHA_ISA_TRAITS_HH__
184