asi.cc revision 3926
111901Sjason@lowepower.com/*
211901Sjason@lowepower.com * Copyright (c) 2006 The Regents of The University of Michigan
311901Sjason@lowepower.com * All rights reserved.
411901Sjason@lowepower.com *
511901Sjason@lowepower.com * Redistribution and use in source and binary forms, with or without
611901Sjason@lowepower.com * modification, are permitted provided that the following conditions are
711901Sjason@lowepower.com * met: redistributions of source code must retain the above copyright
811901Sjason@lowepower.com * notice, this list of conditions and the following disclaimer;
911901Sjason@lowepower.com * redistributions in binary form must reproduce the above copyright
1011901Sjason@lowepower.com * notice, this list of conditions and the following disclaimer in the
1111901Sjason@lowepower.com * documentation and/or other materials provided with the distribution;
1211901Sjason@lowepower.com * neither the name of the copyright holders nor the names of its
1311901Sjason@lowepower.com * contributors may be used to endorse or promote products derived from
1411901Sjason@lowepower.com * this software without specific prior written permission.
1511901Sjason@lowepower.com *
1611901Sjason@lowepower.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1711901Sjason@lowepower.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1811901Sjason@lowepower.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1911901Sjason@lowepower.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2011901Sjason@lowepower.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2111901Sjason@lowepower.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2211901Sjason@lowepower.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2311901Sjason@lowepower.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2411901Sjason@lowepower.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2511901Sjason@lowepower.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2611901Sjason@lowepower.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2711901Sjason@lowepower.com *
2811901Sjason@lowepower.com * Authors: Gabe Black
2911901Sjason@lowepower.com *          Ali Saidi
3011901Sjason@lowepower.com */
3111901Sjason@lowepower.com
3211901Sjason@lowepower.com#include "arch/sparc/asi.hh"
3311901Sjason@lowepower.com
3411901Sjason@lowepower.comnamespace SparcISA
3511901Sjason@lowepower.com{
3611901Sjason@lowepower.com    bool AsiIsBlock(ASI asi)
3711901Sjason@lowepower.com    {
3811901Sjason@lowepower.com        return
3912883Sjason@lowepower.com            (asi == ASI_BLK_AIUP) ||
4012883Sjason@lowepower.com            (asi == ASI_BLK_AIUS) ||
4112883Sjason@lowepower.com            (asi == ASI_BLK_AIUP_L) ||
4212883Sjason@lowepower.com            (asi == ASI_BLK_AIUS_L) ||
4312883Sjason@lowepower.com            (asi == ASI_BLK_P) ||
4412883Sjason@lowepower.com            (asi == ASI_BLK_S) ||
4512883Sjason@lowepower.com            (asi == ASI_BLK_PL) ||
4612883Sjason@lowepower.com            (asi == ASI_BLK_SL);
4712883Sjason@lowepower.com    }
4812883Sjason@lowepower.com
4912883Sjason@lowepower.com    bool AsiIsPrimary(ASI asi)
5012883Sjason@lowepower.com    {
5112883Sjason@lowepower.com        return
5211901Sjason@lowepower.com            (asi == ASI_AIUP) ||
5311901Sjason@lowepower.com            (asi == ASI_BLK_AIUP) ||
5411901Sjason@lowepower.com            (asi == ASI_AIUP_L) ||
5511901Sjason@lowepower.com            (asi == ASI_BLK_AIUP_L) ||
5611901Sjason@lowepower.com            (asi == ASI_LDTX_AIUP) ||
5711901Sjason@lowepower.com            (asi == ASI_LDTX_AIUP_L) ||
5811901Sjason@lowepower.com            (asi == ASI_P) ||
5911901Sjason@lowepower.com            (asi == ASI_PNF) ||
6011901Sjason@lowepower.com            (asi == ASI_PL) ||
6111901Sjason@lowepower.com            (asi == ASI_PNFL) ||
6211901Sjason@lowepower.com            (asi == ASI_PST8_P) ||
6311901Sjason@lowepower.com            (asi == ASI_PST16_P) ||
6411901Sjason@lowepower.com            (asi == ASI_PST32_P) ||
6511901Sjason@lowepower.com            (asi == ASI_PST8_PL) ||
6611901Sjason@lowepower.com            (asi == ASI_PST16_PL) ||
6711901Sjason@lowepower.com            (asi == ASI_PST32_PL) ||
6811901Sjason@lowepower.com            (asi == ASI_FL8_P) ||
6911901Sjason@lowepower.com            (asi == ASI_FL16_P) ||
7011901Sjason@lowepower.com            (asi == ASI_FL8_PL) ||
7111901Sjason@lowepower.com            (asi == ASI_FL16_PL) ||
7211901Sjason@lowepower.com            (asi == ASI_LDTX_P) ||
7311901Sjason@lowepower.com            (asi == ASI_LDTX_PL) ||
7411901Sjason@lowepower.com            (asi == ASI_BLK_P) ||
7511901Sjason@lowepower.com            (asi == ASI_BLK_PL);
7611901Sjason@lowepower.com    }
7711901Sjason@lowepower.com
7811901Sjason@lowepower.com    bool AsiIsSecondary(ASI asi)
7911901Sjason@lowepower.com    {
8013398Santhony.gutierrez@amd.com        return
8113398Santhony.gutierrez@amd.com            (asi == ASI_AIUS) ||
8213398Santhony.gutierrez@amd.com            (asi == ASI_BLK_AIUS) ||
8313398Santhony.gutierrez@amd.com            (asi == ASI_AIUS_L) ||
8413398Santhony.gutierrez@amd.com            (asi == ASI_BLK_AIUS_L) ||
8513398Santhony.gutierrez@amd.com            (asi == ASI_LDTX_AIUS) ||
8613398Santhony.gutierrez@amd.com            (asi == ASI_LDTX_AIUS_L) ||
8713398Santhony.gutierrez@amd.com            (asi == ASI_S) ||
8813398Santhony.gutierrez@amd.com            (asi == ASI_SNF) ||
8913398Santhony.gutierrez@amd.com            (asi == ASI_SL) ||
9013398Santhony.gutierrez@amd.com            (asi == ASI_SNFL) ||
9113398Santhony.gutierrez@amd.com            (asi == ASI_PST8_S) ||
9213398Santhony.gutierrez@amd.com            (asi == ASI_PST16_S) ||
9311901Sjason@lowepower.com            (asi == ASI_PST32_S) ||
9411901Sjason@lowepower.com            (asi == ASI_PST8_SL) ||
9511901Sjason@lowepower.com            (asi == ASI_PST16_SL) ||
9611901Sjason@lowepower.com            (asi == ASI_PST32_SL) ||
9711901Sjason@lowepower.com            (asi == ASI_FL8_S) ||
9811901Sjason@lowepower.com            (asi == ASI_FL16_S) ||
9911901Sjason@lowepower.com            (asi == ASI_FL8_SL) ||
10011901Sjason@lowepower.com            (asi == ASI_FL16_SL) ||
10112562Ssiddhesh.poyarekar@gmail.com            (asi == ASI_LDTX_S) ||
10212562Ssiddhesh.poyarekar@gmail.com            (asi == ASI_LDTX_SL) ||
10312562Ssiddhesh.poyarekar@gmail.com            (asi == ASI_BLK_S) ||
10411901Sjason@lowepower.com            (asi == ASI_BLK_SL);
10511901Sjason@lowepower.com    }
10611901Sjason@lowepower.com
10711901Sjason@lowepower.com    bool AsiIsNucleus(ASI asi)
10811901Sjason@lowepower.com    {
10911901Sjason@lowepower.com        return
11011901Sjason@lowepower.com            (asi == ASI_N) ||
11111901Sjason@lowepower.com            (asi == ASI_NL) ||
11211901Sjason@lowepower.com            (asi == ASI_LDTX_N) ||
11311901Sjason@lowepower.com            (asi == ASI_LDTX_NL);
11411901Sjason@lowepower.com    }
11511901Sjason@lowepower.com
11611901Sjason@lowepower.com    bool AsiIsAsIfUser(ASI asi)
11711901Sjason@lowepower.com    {
11811901Sjason@lowepower.com        return
11911901Sjason@lowepower.com            (asi == ASI_AIUP) ||
12011901Sjason@lowepower.com            (asi == ASI_AIUS) ||
12111901Sjason@lowepower.com            (asi == ASI_BLK_AIUP) ||
12211901Sjason@lowepower.com            (asi == ASI_BLK_AIUS) ||
12311901Sjason@lowepower.com            (asi == ASI_AIUP_L) ||
12411901Sjason@lowepower.com            (asi == ASI_AIUS_L) ||
12511901Sjason@lowepower.com            (asi == ASI_BLK_AIUP_L) ||
12611901Sjason@lowepower.com            (asi == ASI_BLK_AIUS_L) ||
12711901Sjason@lowepower.com            (asi == ASI_LDTX_AIUP) ||
12811901Sjason@lowepower.com            (asi == ASI_LDTX_AIUS) ||
12911901Sjason@lowepower.com            (asi == ASI_LDTX_AIUP_L) ||
13011901Sjason@lowepower.com            (asi == ASI_LDTX_AIUS_L);
13111901Sjason@lowepower.com    }
13211901Sjason@lowepower.com
13311901Sjason@lowepower.com    bool AsiIsIO(ASI asi)
13411901Sjason@lowepower.com    {
13511901Sjason@lowepower.com        return
13611901Sjason@lowepower.com            (asi == ASI_REAL_IO) ||
13711977Sjason@lowepower.com            (asi == ASI_REAL_IO_L);
13811977Sjason@lowepower.com    }
13911977Sjason@lowepower.com
14011977Sjason@lowepower.com    bool AsiIsReal(ASI asi)
14111901Sjason@lowepower.com    {
14211901Sjason@lowepower.com        return
14311901Sjason@lowepower.com            (asi == ASI_REAL) ||
14411901Sjason@lowepower.com            (asi == ASI_REAL_IO) ||
14511901Sjason@lowepower.com            (asi == ASI_REAL_L) ||
14611901Sjason@lowepower.com            (asi == ASI_REAL_IO_L) ||
14711901Sjason@lowepower.com            (asi == ASI_LDTX_REAL) ||
14811901Sjason@lowepower.com            (asi == ASI_LDTX_REAL_L);
14911901Sjason@lowepower.com    }
15011901Sjason@lowepower.com
15111901Sjason@lowepower.com    bool AsiIsLittle(ASI asi)
15211901Sjason@lowepower.com    {
15311901Sjason@lowepower.com        return
15411901Sjason@lowepower.com            (asi == ASI_NL) ||
15511901Sjason@lowepower.com            (asi == ASI_AIUP_L) ||
15611901Sjason@lowepower.com            (asi == ASI_AIUS_L) ||
15711901Sjason@lowepower.com            (asi == ASI_REAL_L) ||
15811901Sjason@lowepower.com            (asi == ASI_REAL_IO_L) ||
15911901Sjason@lowepower.com            (asi == ASI_BLK_AIUP_L) ||
16011901Sjason@lowepower.com            (asi == ASI_BLK_AIUS_L) ||
16111901Sjason@lowepower.com            (asi == ASI_LDTX_AIUP_L) ||
16211901Sjason@lowepower.com            (asi == ASI_LDTX_AIUS_L) ||
16311901Sjason@lowepower.com            (asi == ASI_LDTX_REAL_L) ||
16411901Sjason@lowepower.com            (asi == ASI_LDTX_NL) ||
16511901Sjason@lowepower.com            (asi == ASI_PL) ||
16611901Sjason@lowepower.com            (asi == ASI_SL) ||
16711901Sjason@lowepower.com            (asi == ASI_PNFL) ||
16811901Sjason@lowepower.com            (asi == ASI_SNFL) ||
16911901Sjason@lowepower.com            (asi == ASI_PST8_PL) ||
17011901Sjason@lowepower.com            (asi == ASI_PST8_SL) ||
17111901Sjason@lowepower.com            (asi == ASI_PST16_PL) ||
17211901Sjason@lowepower.com            (asi == ASI_PST16_SL) ||
17311901Sjason@lowepower.com            (asi == ASI_PST32_PL) ||
17411901Sjason@lowepower.com            (asi == ASI_PST32_SL) ||
17511901Sjason@lowepower.com            (asi == ASI_FL8_PL) ||
17611901Sjason@lowepower.com            (asi == ASI_FL8_SL) ||
17711901Sjason@lowepower.com            (asi == ASI_FL16_PL) ||
17811901Sjason@lowepower.com            (asi == ASI_FL16_SL) ||
17911901Sjason@lowepower.com            (asi == ASI_LDTX_PL) ||
18011901Sjason@lowepower.com            (asi == ASI_LDTX_SL) ||
18111901Sjason@lowepower.com            (asi == ASI_BLK_PL) ||
18211901Sjason@lowepower.com            (asi == ASI_BLK_SL) ||
18311901Sjason@lowepower.com            (asi == ASI_LTX_L);
18411901Sjason@lowepower.com    }
18511921Spierre-yves.peneau@lirmm.fr
18611921Spierre-yves.peneau@lirmm.fr    bool AsiIsTwin(ASI asi)
18711921Spierre-yves.peneau@lirmm.fr    {
18811921Spierre-yves.peneau@lirmm.fr        return
18911921Spierre-yves.peneau@lirmm.fr            (asi >= ASI_LDTX_AIUP &&
19011901Sjason@lowepower.com            asi <= ASI_LDTX_N &&
19111901Sjason@lowepower.com            asi != ASI_QUEUE) ||
19211901Sjason@lowepower.com            (asi >= ASI_LDTX_AIUP_L &&
19311901Sjason@lowepower.com            asi <= ASI_LDTX_NL &&
19411901Sjason@lowepower.com            asi != 0x2D) ||
19511901Sjason@lowepower.com            asi == ASI_LDTX_P ||
19612562Ssiddhesh.poyarekar@gmail.com            asi == ASI_LDTX_S ||
19712562Ssiddhesh.poyarekar@gmail.com            asi == ASI_LDTX_PL ||
19812562Ssiddhesh.poyarekar@gmail.com            asi == ASI_LDTX_SL;
19911901Sjason@lowepower.com    }
20012883Sjason@lowepower.com
20112883Sjason@lowepower.com    bool AsiIsPartialStore(ASI asi)
20212883Sjason@lowepower.com    {
20312883Sjason@lowepower.com        return
20412883Sjason@lowepower.com            (asi == ASI_PST8_P) ||
20512883Sjason@lowepower.com            (asi == ASI_PST8_S) ||
20612883Sjason@lowepower.com            (asi == ASI_PST16_P) ||
20711901Sjason@lowepower.com            (asi == ASI_PST16_S) ||
20811901Sjason@lowepower.com            (asi == ASI_PST32_P) ||
20911901Sjason@lowepower.com            (asi == ASI_PST32_S) ||
21011901Sjason@lowepower.com            (asi == ASI_PST8_PL) ||
21111901Sjason@lowepower.com            (asi == ASI_PST8_SL) ||
21211901Sjason@lowepower.com            (asi == ASI_PST16_PL) ||
21311901Sjason@lowepower.com            (asi == ASI_PST16_SL) ||
21411901Sjason@lowepower.com            (asi == ASI_PST32_PL) ||
21511901Sjason@lowepower.com            (asi == ASI_PST32_SL);
21611901Sjason@lowepower.com    }
21711901Sjason@lowepower.com
21811901Sjason@lowepower.com    bool AsiIsFloatingLoad(ASI asi)
21911901Sjason@lowepower.com    {
22011901Sjason@lowepower.com        return
22111901Sjason@lowepower.com            (asi == ASI_FL8_P) ||
22211901Sjason@lowepower.com            (asi == ASI_FL8_S) ||
22311901Sjason@lowepower.com            (asi == ASI_FL16_P) ||
22411901Sjason@lowepower.com            (asi == ASI_FL16_S) ||
22511901Sjason@lowepower.com            (asi == ASI_FL8_PL) ||
22611901Sjason@lowepower.com            (asi == ASI_FL8_SL) ||
22711901Sjason@lowepower.com            (asi == ASI_FL16_PL) ||
22811901Sjason@lowepower.com            (asi == ASI_FL16_SL);
22911901Sjason@lowepower.com    }
23011901Sjason@lowepower.com
23111901Sjason@lowepower.com    bool AsiIsNoFault(ASI asi)
23212562Ssiddhesh.poyarekar@gmail.com    {
23312562Ssiddhesh.poyarekar@gmail.com        return
23412562Ssiddhesh.poyarekar@gmail.com            (asi == ASI_PNF) ||
23511901Sjason@lowepower.com            (asi == ASI_SNF) ||
23611901Sjason@lowepower.com            (asi == ASI_PNFL) ||
23711901Sjason@lowepower.com            (asi == ASI_SNFL);
23811901Sjason@lowepower.com    }
23911901Sjason@lowepower.com
24012562Ssiddhesh.poyarekar@gmail.com    bool AsiIsScratchPad(ASI asi)
24112562Ssiddhesh.poyarekar@gmail.com    {
24212562Ssiddhesh.poyarekar@gmail.com        return
24311901Sjason@lowepower.com            (asi == ASI_SCRATCHPAD) ||
24411901Sjason@lowepower.com            (asi == ASI_HYP_SCRATCHPAD);
24511901Sjason@lowepower.com    }
24611901Sjason@lowepower.com
24711901Sjason@lowepower.com    bool AsiIsCmt(ASI asi)
24811901Sjason@lowepower.com    {
24911901Sjason@lowepower.com        return
25011901Sjason@lowepower.com            (asi == ASI_CMT_PER_STRAND);
25112562Ssiddhesh.poyarekar@gmail.com    }
25212562Ssiddhesh.poyarekar@gmail.com
25312562Ssiddhesh.poyarekar@gmail.com    bool AsiIsQueue(ASI asi)
25412562Ssiddhesh.poyarekar@gmail.com    {
25511901Sjason@lowepower.com        return asi == ASI_QUEUE;
25611901Sjason@lowepower.com    }
25711901Sjason@lowepower.com
25811901Sjason@lowepower.com    bool AsiIsInterrupt(ASI asi)
25911901Sjason@lowepower.com    {
26012562Ssiddhesh.poyarekar@gmail.com        return asi == ASI_SWVR_INTR_RECEIVE  ||
26112562Ssiddhesh.poyarekar@gmail.com               asi == ASI_SWVR_UDB_INTR_W  ||
26212562Ssiddhesh.poyarekar@gmail.com               asi == ASI_SWVR_UDB_INTR_R ;
26312562Ssiddhesh.poyarekar@gmail.com    }
26412562Ssiddhesh.poyarekar@gmail.com
26511901Sjason@lowepower.com    bool AsiIsMmu(ASI asi)
26611901Sjason@lowepower.com    {
26711901Sjason@lowepower.com        return  asi == ASI_MMU ||
26811901Sjason@lowepower.com                asi == ASI_LSU_CONTROL_REG  ||
26912562Ssiddhesh.poyarekar@gmail.com               (asi >= ASI_DMMU_CTXT_ZERO_TSB_BASE_PS0 &&
27012562Ssiddhesh.poyarekar@gmail.com                asi <= ASI_IMMU_CTXT_ZERO_CONFIG) ||
27112562Ssiddhesh.poyarekar@gmail.com               (asi >= ASI_DMMU_CTXT_NONZERO_TSB_BASE_PS0 &&
27211901Sjason@lowepower.com                asi <= ASI_IMMU_CTXT_NONZERO_CONFIG) ||
27312847Sjason@lowepower.com               (asi >= ASI_IMMU &&
27412847Sjason@lowepower.com                asi <= ASI_IMMU_TSB_PS1_PTR_REG) ||
27512847Sjason@lowepower.com               (asi >= ASI_ITLB_DATA_IN_REG  &&
27612847Sjason@lowepower.com                asi <= ASI_TLB_INVALIDATE_ALL);
27712847Sjason@lowepower.com    }
27811901Sjason@lowepower.com
27912562Ssiddhesh.poyarekar@gmail.com    bool AsiIsUnPriv(ASI asi)
28012847Sjason@lowepower.com    {
28112562Ssiddhesh.poyarekar@gmail.com        return asi >= 0x80;
28211901Sjason@lowepower.com    }
28312847Sjason@lowepower.com
28412847Sjason@lowepower.com    bool AsiIsPriv(ASI asi)
28512847Sjason@lowepower.com    {
28612847Sjason@lowepower.com        return asi <= 0x2f;
28712847Sjason@lowepower.com    }
28811901Sjason@lowepower.com
28911901Sjason@lowepower.com
29011901Sjason@lowepower.com    bool AsiIsHPriv(ASI asi)
29111901Sjason@lowepower.com    {
29211901Sjason@lowepower.com        return asi >= 0x30 && asi <= 0x7f;
29312562Ssiddhesh.poyarekar@gmail.com    }
29412562Ssiddhesh.poyarekar@gmail.com
29512562Ssiddhesh.poyarekar@gmail.com    bool AsiIsReg(ASI asi)
29611901Sjason@lowepower.com    {
29711901Sjason@lowepower.com        return AsiIsMmu(asi) || AsiIsScratchPad(asi) | AsiIsSparcError(asi);
29811901Sjason@lowepower.com    }
29911901Sjason@lowepower.com
30011901Sjason@lowepower.com    bool AsiIsSparcError(ASI asi)
30111901Sjason@lowepower.com    {
30211901Sjason@lowepower.com        return asi == ASI_SPARC_ERROR_EN_REG ||
30311901Sjason@lowepower.com               asi == ASI_SPARC_ERROR_STATUS_REG;
30411901Sjason@lowepower.com    }
30511901Sjason@lowepower.com
30611901Sjason@lowepower.com}
30711901Sjason@lowepower.com