ev5.hh revision 5568
11758SN/A/*
21762SN/A * Copyright (c) 2002-2005 The Regents of The University of Michigan
31758SN/A * All rights reserved.
41758SN/A *
51758SN/A * Redistribution and use in source and binary forms, with or without
61758SN/A * modification, are permitted provided that the following conditions are
71758SN/A * met: redistributions of source code must retain the above copyright
81758SN/A * notice, this list of conditions and the following disclaimer;
91758SN/A * redistributions in binary form must reproduce the above copyright
101758SN/A * notice, this list of conditions and the following disclaimer in the
111758SN/A * documentation and/or other materials provided with the distribution;
121758SN/A * neither the name of the copyright holders nor the names of its
131758SN/A * contributors may be used to endorse or promote products derived from
141758SN/A * this software without specific prior written permission.
151758SN/A *
161758SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
171758SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
181758SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
191758SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
201758SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
211758SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
221758SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
231758SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
241758SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
251758SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
261758SN/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 *          Nathan Binkert
302665Ssaidi@eecs.umich.edu *          Ali Saidi
311758SN/A */
322SN/A
331147SN/A#ifndef __ARCH_ALPHA_EV5_HH__
341147SN/A#define __ARCH_ALPHA_EV5_HH__
352SN/A
361858SN/A#include "config/alpha_tlaser.hh"
372107SN/A#include "arch/alpha/isa_traits.hh"
381858SN/A
395566Snate@binkert.orgnamespace AlphaISA {
402107SN/A
411858SN/A#if ALPHA_TLASER
421147SN/Aconst uint64_t AsnMask = ULL(0x7f);
43924SN/A#else
441147SN/Aconst uint64_t AsnMask = ULL(0xff);
45924SN/A#endif
46924SN/A
471147SN/Aconst int VAddrImplBits = 43;
481147SN/Aconst Addr VAddrImplMask = (ULL(1) << VAddrImplBits) - 1;
491147SN/Aconst Addr VAddrUnImplMask = ~VAddrImplMask;
501147SN/Ainline Addr VAddrImpl(Addr a) { return a & VAddrImplMask; }
515568Snate@binkert.orginline Addr VAddrVPN(Addr a) { return a >> PageShift; }
525568Snate@binkert.orginline Addr VAddrOffset(Addr a) { return a & PageOffset; }
531147SN/Ainline Addr VAddrSpaceEV5(Addr a) { return a >> 41 & 0x3; }
541147SN/Ainline Addr VAddrSpaceEV6(Addr a) { return a >> 41 & 0x7f; }
55924SN/A
561858SN/A#if ALPHA_TLASER
571147SN/Ainline bool PAddrIprSpace(Addr a) { return a >= ULL(0xFFFFF00000); }
581147SN/Aconst int PAddrImplBits = 40;
59924SN/A#else
601147SN/Ainline bool PAddrIprSpace(Addr a) { return a >= ULL(0xFFFFFF00000); }
611147SN/Aconst int PAddrImplBits = 44; // for Tsunami
62924SN/A#endif
631147SN/Aconst Addr PAddrImplMask = (ULL(1) << PAddrImplBits) - 1;
641147SN/Aconst Addr PAddrUncachedBit39 = ULL(0x8000000000);
651147SN/Aconst Addr PAddrUncachedBit40 = ULL(0x10000000000);
661147SN/Aconst Addr PAddrUncachedBit43 = ULL(0x80000000000);
671147SN/Aconst Addr PAddrUncachedMask = ULL(0x807ffffffff); // Clear PA<42:35>
681805SN/Ainline Addr Phys2K0Seg(Addr addr)
691805SN/A{
701858SN/A#if !ALPHA_TLASER
711805SN/A    if (addr & PAddrUncachedBit43) {
721805SN/A        addr &= PAddrUncachedMask;
731805SN/A        addr |= PAddrUncachedBit40;
741805SN/A    }
751805SN/A#endif
765568Snate@binkert.org    return addr | K0SegBase;
771805SN/A}
78924SN/A
791147SN/Ainline int DTB_ASN_ASN(uint64_t reg) { return reg >> 57 & AsnMask; }
801147SN/Ainline Addr DTB_PTE_PPN(uint64_t reg)
815568Snate@binkert.org{ return reg >> 32 & (ULL(1) << PAddrImplBits - PageShift) - 1; }
821147SN/Ainline int DTB_PTE_XRE(uint64_t reg) { return reg >> 8 & 0xf; }
831147SN/Ainline int DTB_PTE_XWE(uint64_t reg) { return reg >> 12 & 0xf; }
841147SN/Ainline int DTB_PTE_FONR(uint64_t reg) { return reg >> 1 & 0x1; }
851147SN/Ainline int DTB_PTE_FONW(uint64_t reg) { return reg >> 2 & 0x1; }
861147SN/Ainline int DTB_PTE_GH(uint64_t reg) { return reg >> 5 & 0x3; }
871147SN/Ainline int DTB_PTE_ASMA(uint64_t reg) { return reg >> 4 & 0x1; }
882SN/A
891147SN/Ainline int ITB_ASN_ASN(uint64_t reg) { return reg >> 4 & AsnMask; }
901147SN/Ainline Addr ITB_PTE_PPN(uint64_t reg)
915568Snate@binkert.org{ return reg >> 32 & (ULL(1) << PAddrImplBits - PageShift) - 1; }
921147SN/Ainline int ITB_PTE_XRE(uint64_t reg) { return reg >> 8 & 0xf; }
931147SN/Ainline bool ITB_PTE_FONR(uint64_t reg) { return reg >> 1 & 0x1; }
941147SN/Ainline bool ITB_PTE_FONW(uint64_t reg) { return reg >> 2 & 0x1; }
951147SN/Ainline int ITB_PTE_GH(uint64_t reg) { return reg >> 5 & 0x3; }
961147SN/Ainline bool ITB_PTE_ASMA(uint64_t reg) { return reg >> 4 & 0x1; }
972SN/A
981147SN/Ainline uint64_t MCSR_SP(uint64_t reg) { return reg >> 1 & 0x3; }
992SN/A
1001147SN/Ainline bool ICSR_SDE(uint64_t reg) { return reg >> 30 & 0x1; }
1011147SN/Ainline int ICSR_SPE(uint64_t reg) { return reg >> 28 & 0x3; }
1021147SN/Ainline bool ICSR_FPE(uint64_t reg) { return reg >> 26 & 0x1; }
1032SN/A
1041147SN/Ainline uint64_t ALT_MODE_AM(uint64_t reg) { return reg >> 3 & 0x3; }
1051147SN/Ainline uint64_t DTB_CM_CM(uint64_t reg) { return reg >> 3 & 0x3; }
1061147SN/Ainline uint64_t ICM_CM(uint64_t reg) { return reg >> 3 & 0x3; }
1072SN/A
1081147SN/Aconst uint64_t MM_STAT_BAD_VA_MASK = ULL(0x0020);
1091147SN/Aconst uint64_t MM_STAT_DTB_MISS_MASK = ULL(0x0010);
1101147SN/Aconst uint64_t MM_STAT_FONW_MASK = ULL(0x0008);
1111147SN/Aconst uint64_t MM_STAT_FONR_MASK = ULL(0x0004);
1121147SN/Aconst uint64_t MM_STAT_ACV_MASK = ULL(0x0002);
1131147SN/Aconst uint64_t MM_STAT_WR_MASK = ULL(0x0001);
1145568Snate@binkert.orginline int Opcode(MachInst inst) { return inst >> 26 & 0x3f; }
1155568Snate@binkert.orginline int Ra(MachInst inst) { return inst >> 21 & 0x1f; }
1162SN/A
1171147SN/Aconst Addr PalBase = 0x4000;
1181147SN/Aconst Addr PalMax = 0x10000;
1192SN/A
1205566Snate@binkert.org} // namespace AlphaISA
1212SN/A
1221147SN/A#endif // __ARCH_ALPHA_EV5_HH__
123