1 /*
2  * \file       trc_core_arch_map.cpp
3  * \brief      OpenCSD : Map core names to architecture profiles
4  *
5  * \copyright  Copyright (c) 2015, ARM Limited. All Rights Reserved.
6  */
7 
8 /*
9  * Redistribution and use in source and binary forms, with or without modification,
10  * are permitted provided that the following conditions are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright notice,
16  * this list of conditions and the following disclaimer in the documentation
17  * and/or other materials provided with the distribution.
18  *
19  * 3. Neither the name of the copyright holder nor the names of its contributors
20  * may be used to endorse or promote products derived from this software without
21  * specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26  * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
27  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 #include "common/trc_core_arch_map.h"
36 
37 typedef struct _ap_map_elements {
38     const char *name;
39     ocsd_arch_profile_t ap;
40 } ap_map_elem_t;
41 
42 static ap_map_elem_t ap_map_array[] =
43 {
44     { "Cortex-A77", { ARCH_V8r3, profile_CortexA } },
45     { "Cortex-A76", { ARCH_V8r3, profile_CortexA } },
46     { "Cortex-A75", { ARCH_V8r3, profile_CortexA } },
47     { "Cortex-A73", { ARCH_V8, profile_CortexA } },
48     { "Cortex-A72", { ARCH_V8, profile_CortexA } },
49     { "Cortex-A65", { ARCH_V8r3, profile_CortexA } },
50     { "Cortex-A57", { ARCH_V8, profile_CortexA } },
51     { "Cortex-A55", { ARCH_V8r3, profile_CortexA } },
52     { "Cortex-A53", { ARCH_V8, profile_CortexA } },
53     { "Cortex-A35", { ARCH_V8, profile_CortexA } },
54     { "Cortex-A32", { ARCH_V8, profile_CortexA } },
55     { "Cortex-A17", { ARCH_V7, profile_CortexA } },
56     { "Cortex-A15", { ARCH_V7, profile_CortexA } },
57     { "Cortex-A12", { ARCH_V7, profile_CortexA } },
58     { "Cortex-A9", { ARCH_V7, profile_CortexA } },
59     { "Cortex-A8", { ARCH_V7, profile_CortexA } },
60     { "Cortex-A7", { ARCH_V7, profile_CortexA } },
61     { "Cortex-A5", { ARCH_V7, profile_CortexA } },
62     { "Cortex-R52", { ARCH_V8, profile_CortexR } },
63     { "Cortex-R8", { ARCH_V7, profile_CortexR } },
64     { "Cortex-R7", { ARCH_V7, profile_CortexR } },
65     { "Cortex-R5", { ARCH_V7, profile_CortexR } },
66     { "Cortex-R4", { ARCH_V7, profile_CortexR } },
67     { "Cortex-M33", { ARCH_V8, profile_CortexM } },
68     { "Cortex-M23", { ARCH_V8, profile_CortexM } },
69     { "Cortex-M0", { ARCH_V7, profile_CortexM } },
70     { "Cortex-M0+", { ARCH_V7, profile_CortexM } },
71     { "Cortex-M3", { ARCH_V7, profile_CortexM } },
72     { "Cortex-M4", { ARCH_V7, profile_CortexM } }
73 };
74 
75 static ap_map_elem_t arch_map_array[] =
76 {
77     { "ARMv7-A", { ARCH_V7, profile_CortexA } },
78     { "ARMv7-R", { ARCH_V7, profile_CortexR } },
79     { "ARMv7-M", { ARCH_V7, profile_CortexM } },
80     { "ARMv8-A", { ARCH_V8, profile_CortexA } },
81     { "ARMv8.3-A", { ARCH_V8r3, profile_CortexA } },
82     { "ARMv8-R", { ARCH_V8, profile_CortexR } },
83     { "ARMv8-M", { ARCH_V8, profile_CortexM } },
84 };
85 
86 CoreArchProfileMap::CoreArchProfileMap()
87 {
88     unsigned i;
89     for (i = 0; i < sizeof(ap_map_array) / sizeof(_ap_map_elements); i++)
90     {
91         core_profiles[ap_map_array[i].name] = ap_map_array[i].ap;
92     }
93     for (i = 0; i < sizeof(arch_map_array) / sizeof(_ap_map_elements); i++)
94     {
95         arch_profiles[arch_map_array[i].name] = arch_map_array[i].ap;
96     }
97 }
98 
99 /* End of File trc_core_arch_map.cpp */
100