asi.cc revision 3123:34edfd0ff545
1/*
2 * Copyright (c) 2006 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * Authors: Gabe Black
29 */
30
31#include "arch/sparc/asi.hh"
32
33namespace SparcISA
34{
35    bool AsiIsBlock(ASI asi)
36    {
37        return
38            (asi == ASI_BLK_AIUP) ||
39            (asi == ASI_BLK_AIUS) ||
40            (asi == ASI_BLK_AIUPL) ||
41            (asi == ASI_BLK_AIUSL) ||
42            (asi == ASI_BLK_P) ||
43            (asi == ASI_BLK_S) ||
44            (asi == ASI_BLK_PL) ||
45            (asi == ASI_BLK_SL);
46    }
47
48    bool AsiIsPrimary(ASI asi)
49    {
50        return
51            (asi == ASI_AIUP) ||
52            (asi == ASI_BLK_AIUP) ||
53            (asi == ASI_AIUPL) ||
54            (asi == ASI_BLK_AIUPL) ||
55            (asi == ASI_LDTX_AIUP) ||
56            (asi == ASI_LDTX_AIUPL) ||
57            (asi == ASI_P) ||
58            (asi == ASI_PNF) ||
59            (asi == ASI_PL) ||
60            (asi == ASI_PNFL) ||
61            (asi == ASI_PST8_P) ||
62            (asi == ASI_PST16_P) ||
63            (asi == ASI_PST32_P) ||
64            (asi == ASI_PST8_PL) ||
65            (asi == ASI_PST16_PL) ||
66            (asi == ASI_PST32_PL) ||
67            (asi == ASI_FL8_P) ||
68            (asi == ASI_FL16_P) ||
69            (asi == ASI_FL8_PL) ||
70            (asi == ASI_FL16_PL) ||
71            (asi == ASI_LDTX_P) ||
72            (asi == ASI_LDTX_PL) ||
73            (asi == ASI_BLK_P) ||
74            (asi == ASI_BLK_PL);
75    }
76
77    bool AsiIsSecondary(ASI asi)
78    {
79        return
80            (asi == ASI_AIUS) ||
81            (asi == ASI_BLK_AIUS) ||
82            (asi == ASI_AIUSL) ||
83            (asi == ASI_BLK_AIUSL) ||
84            (asi == ASI_LDTX_AIUS) ||
85            (asi == ASI_LDTX_AIUSL) ||
86            (asi == ASI_S) ||
87            (asi == ASI_SNF) ||
88            (asi == ASI_SL) ||
89            (asi == ASI_SNFL) ||
90            (asi == ASI_PST8_S) ||
91            (asi == ASI_PST16_S) ||
92            (asi == ASI_PST32_S) ||
93            (asi == ASI_PST8_SL) ||
94            (asi == ASI_PST16_SL) ||
95            (asi == ASI_PST32_SL) ||
96            (asi == ASI_FL8_S) ||
97            (asi == ASI_FL16_S) ||
98            (asi == ASI_FL8_SL) ||
99            (asi == ASI_FL16_SL) ||
100            (asi == ASI_LDTX_S) ||
101            (asi == ASI_LDTX_SL) ||
102            (asi == ASI_BLK_S) ||
103            (asi == ASI_BLK_SL);
104    }
105
106    bool AsiNucleus(ASI asi)
107    {
108        return
109            (asi == ASI_N) ||
110            (asi == ASI_NL) ||
111            (asi == ASI_LDTX_N) ||
112            (asi == ASI_LDTX_NL);
113    }
114
115    bool AsiIsAsIfUser(ASI asi)
116    {
117        return
118            (asi == ASI_AIUP) ||
119            (asi == ASI_AIUS) ||
120            (asi == ASI_BLK_AIUP) ||
121            (asi == ASI_BLK_AIUS) ||
122            (asi == ASI_AIUPL) ||
123            (asi == ASI_AIUSL) ||
124            (asi == ASI_BLK_AIUPL) ||
125            (asi == ASI_BLK_AIUSL) ||
126            (asi == ASI_LDTX_AIUP) ||
127            (asi == ASI_LDTX_AIUS) ||
128            (asi == ASI_LDTX_AIUPL) ||
129            (asi == ASI_LDTX_AIUSL);
130    }
131
132    bool AsiIsIO(ASI asi)
133    {
134        return
135            (asi == ASI_REAL_IO) ||
136            (asi == ASI_REAL_IO_L);
137    }
138
139    bool AsiIsReal(ASI asi)
140    {
141        return
142            (asi == ASI_REAL) ||
143            (asi == ASI_REAL_IO) ||
144            (asi == ASI_REAL_L) ||
145            (asi == ASI_REAL_IO_L) ||
146            (asi == ASI_LDTX_REAL) ||
147            (asi == ASI_LDTX_REAL_L) ||
148            (asi == ASI_MMU_REAL);
149    }
150
151    bool AsiIsLittle(ASI asi)
152    {
153        return
154            (asi == ASI_NL) ||
155            (asi == ASI_AIUPL) ||
156            (asi == ASI_AIUSL) ||
157            (asi == ASI_REAL_L) ||
158            (asi == ASI_REAL_IO_L) ||
159            (asi == ASI_BLK_AIUPL) ||
160            (asi == ASI_BLK_AIUSL) ||
161            (asi == ASI_LDTX_AIUPL) ||
162            (asi == ASI_LDTX_AIUSL) ||
163            (asi == ASI_LDTX_REAL_L) ||
164            (asi == ASI_LDTX_NL) ||
165            (asi == ASI_PL) ||
166            (asi == ASI_SL) ||
167            (asi == ASI_PNFL) ||
168            (asi == ASI_SNFL) ||
169            (asi == ASI_PST8_PL) ||
170            (asi == ASI_PST8_SL) ||
171            (asi == ASI_PST16_PL) ||
172            (asi == ASI_PST16_SL) ||
173            (asi == ASI_PST32_PL) ||
174            (asi == ASI_PST32_SL) ||
175            (asi == ASI_FL8_PL) ||
176            (asi == ASI_FL8_SL) ||
177            (asi == ASI_FL16_PL) ||
178            (asi == ASI_FL16_SL) ||
179            (asi == ASI_LDTX_PL) ||
180            (asi == ASI_LDTX_SL) ||
181            (asi == ASI_BLK_PL) ||
182            (asi == ASI_BLK_SL);
183    }
184
185    bool AsiIsTwin(ASI asi)
186    {
187        return
188            (asi == ASI_LDTX_AIUP) ||
189            (asi == ASI_LDTX_AIUS) ||
190            (asi == ASI_LDTX_REAL) ||
191            (asi == ASI_LDTX_N) ||
192            (asi == ASI_LDTX_AIUPL) ||
193            (asi == ASI_LDTX_AIUSL) ||
194            (asi == ASI_LDTX_REAL_L) ||
195            (asi == ASI_LDTX_NL) ||
196            (asi == ASI_LDTX_P) ||
197            (asi == ASI_LDTX_S) ||
198            (asi == ASI_LDTX_PL) ||
199            (asi == ASI_LDTX_SL);
200    }
201
202    bool AsiIsPartialStore(ASI asi)
203    {
204        return
205            (asi == ASI_PST8_P) ||
206            (asi == ASI_PST8_S) ||
207            (asi == ASI_PST16_P) ||
208            (asi == ASI_PST16_S) ||
209            (asi == ASI_PST32_P) ||
210            (asi == ASI_PST32_S) ||
211            (asi == ASI_PST8_PL) ||
212            (asi == ASI_PST8_SL) ||
213            (asi == ASI_PST16_PL) ||
214            (asi == ASI_PST16_SL) ||
215            (asi == ASI_PST32_PL) ||
216            (asi == ASI_PST32_SL);
217    }
218
219    bool AsiIsFloatingLoad(ASI asi)
220    {
221        return
222            (asi == ASI_FL8_P) ||
223            (asi == ASI_FL8_S) ||
224            (asi == ASI_FL16_P) ||
225            (asi == ASI_FL16_S) ||
226            (asi == ASI_FL8_PL) ||
227            (asi == ASI_FL8_SL) ||
228            (asi == ASI_FL16_PL) ||
229            (asi == ASI_FL16_SL);
230    }
231
232    bool AsiIsNoFault(ASI asi)
233    {
234        return
235            (asi == ASI_PNF) ||
236            (asi == ASI_SNF) ||
237            (asi == ASI_PNFL) ||
238            (asi == ASI_SNFL);
239    }
240
241    bool AsiIsScratchPad(ASI asi)
242    {
243        return
244            (asi == ASI_SCRATCHPAD) ||
245            (asi == ASI_HYP_SCRATCHPAD);
246    }
247
248    bool AsiIsCmt(ASI asi)
249    {
250        return
251            (asi == ASI_CMT_PER_STRAND) ||
252            (asi == ASI_CMT_SHARED);
253    }
254
255    bool AsiIsQueue(ASI asi)
256    {
257        return asi == ASI_QUEUE;
258    }
259
260    bool AsiIsDtlb(ASI asi)
261    {
262        return
263            (asi == ASI_DTLB_DATA_IN_REG) ||
264            (asi == ASI_DTLB_DATA_ACCESS_REG) ||
265            (asi == ASI_DTLB_TAG_READ_REG);
266    }
267
268    bool AsiIsMmu(ASI asi)
269    {
270        return
271            (asi == ASI_MMU_CONTEXTID) ||
272            (asi == ASI_IMMU) ||
273            (asi == ASI_MMU_REAL) ||
274            (asi == ASI_MMU) ||
275            (asi == ASI_DMMU) ||
276            (asi == ASI_UMMU) ||
277            (asi == ASI_DMMU_DEMAP);
278    }
279}
280