Commit | Line | Data |
---|---|---|
fe944acf | 1 | /* nfp.h. NFP opcode list. |
b3adc24a | 2 | Copyright (C) 2017-2020 Free Software Foundation, Inc. |
fe944acf FT |
3 | Contributed by Francois H. Theron <francois.theron@netronome.com> |
4 | ||
5 | This file is part of the GNU opcodes library. | |
6 | ||
7 | GDB, GAS, and the GNU binutils are free software; you can redistribute | |
8 | them and/or modify them under the terms of the GNU General Public | |
9 | License as published by the Free Software Foundation; either version 3, | |
10 | or (at your option) any later version. | |
11 | ||
12 | GDB, GAS, and the GNU binutils are distributed in the hope that they | |
13 | will be useful, but WITHOUT ANY WARRANTY; without even the implied | |
14 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | |
15 | the GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this file; see the file COPYING3. If not, write to the Free | |
19 | Software Foundation, 51 Franklin Street - Fifth Floor, Boston, | |
20 | MA 02110-1301, USA. */ | |
21 | ||
22 | #ifndef _NFP_H_ | |
23 | #define _NFP_H_ | |
24 | ||
25 | #include "bfd.h" | |
1678bd35 | 26 | #include "bfd_stdint.h" |
fe944acf FT |
27 | #include "elf/nfp.h" |
28 | ||
29 | #ifdef __cplusplus | |
30 | extern "C" | |
31 | { | |
32 | #endif | |
33 | ||
1678bd35 | 34 | /* We use ME versions for most of this rather than NFP family and revision |
fe944acf FT |
35 | numbers. The version numbers are currently 2.7 and 2.8 and to avoid long |
36 | names with many underscores we'll just use 27 and 28 until some feature | |
37 | number makes it necessary to do something different. */ | |
38 | ||
1678bd35 FT |
39 | #define NFP_ME27_INSTR_MASK_CMD ((uint64_t) 0x008000000000) |
40 | #define NFP_ME27_INSTR_CMD ((uint64_t) 0x000000000000) | |
fe944acf FT |
41 | #define NFP_ME27_INSTR_IS_CMD(instr) \ |
42 | ((instr & NFP_ME27_INSTR_MASK_CMD) == NFP_ME27_INSTR_CMD) | |
43 | ||
1678bd35 FT |
44 | #define NFP_ME27_INSTR_MASK_ALU_SHF ((uint64_t) 0x1ee000000000) |
45 | #define NFP_ME27_INSTR_ALU_SHF ((uint64_t) 0x008000000000) | |
fe944acf FT |
46 | #define NFP_ME27_INSTR_IS_ALU_SHF(instr) \ |
47 | ((instr & NFP_ME27_INSTR_MASK_ALU_SHF) == NFP_ME27_INSTR_ALU_SHF) | |
48 | ||
1678bd35 FT |
49 | #define NFP_ME27_INSTR_MASK_ALU ((uint64_t) 0x1ee000000000) |
50 | #define NFP_ME27_INSTR_ALU ((uint64_t) 0x00a000000000) | |
fe944acf FT |
51 | #define NFP_ME27_INSTR_IS_ALU(instr) \ |
52 | ((instr & NFP_ME27_INSTR_MASK_ALU) == NFP_ME27_INSTR_ALU) | |
53 | ||
1678bd35 FT |
54 | #define NFP_ME27_INSTR_MASK_IMMED ((uint64_t) 0x1ff900000000) |
55 | #define NFP_ME27_INSTR_IMMED ((uint64_t) 0x00f000000000) | |
fe944acf FT |
56 | #define NFP_ME27_INSTR_IS_IMMED(instr) \ |
57 | ((instr & NFP_ME27_INSTR_MASK_IMMED) == NFP_ME27_INSTR_IMMED) | |
58 | ||
1678bd35 FT |
59 | #define NFP_ME27_INSTR_MASK_LD_FIELD ((uint64_t) 0x1ffa00e00000) |
60 | #define NFP_ME27_INSTR_LD_FIELD ((uint64_t) 0x00c000000000) | |
fe944acf FT |
61 | #define NFP_ME27_INSTR_IS_LD_FIELD(instr) \ |
62 | ((instr & NFP_ME27_INSTR_MASK_LD_FIELD) == NFP_ME27_INSTR_LD_FIELD) | |
63 | ||
1678bd35 FT |
64 | #define NFP_ME27_INSTR_MASK_CTX_ARB ((uint64_t) 0x00f800000000) |
65 | #define NFP_ME27_INSTR_CTX_ARB ((uint64_t) 0x00e000000000) | |
fe944acf FT |
66 | #define NFP_ME27_INSTR_IS_CTX_ARB(instr) \ |
67 | ((instr & NFP_ME27_INSTR_MASK_CTX_ARB) == NFP_ME27_INSTR_CTX_ARB) | |
68 | ||
1678bd35 FT |
69 | #define NFP_ME27_INSTR_MASK_LOCAL_CSR ((uint64_t) 0x1ffe00100000) |
70 | #define NFP_ME27_INSTR_LOCAL_CSR ((uint64_t) 0x00fc00000000) | |
fe944acf FT |
71 | #define NFP_ME27_INSTR_IS_LOCAL_CSR(instr) \ |
72 | ((instr & NFP_ME27_INSTR_MASK_LOCAL_CSR) == NFP_ME27_INSTR_LOCAL_CSR) | |
73 | ||
1678bd35 FT |
74 | #define NFP_ME27_INSTR_MASK_BRANCH ((uint64_t) 0x00f8000c3ce0) |
75 | #define NFP_ME27_INSTR_BRANCH ((uint64_t) 0x00d800000020) | |
fe944acf FT |
76 | #define NFP_ME27_INSTR_IS_BRANCH(instr) \ |
77 | ((instr & NFP_ME27_INSTR_MASK_BRANCH) == NFP_ME27_INSTR_BRANCH) | |
78 | ||
1678bd35 FT |
79 | #define NFP_ME27_INSTR_MASK_BR_BYTE ((uint64_t) 0x00f800000000) |
80 | #define NFP_ME27_INSTR_BR_BYTE ((uint64_t) 0x00c800000000) | |
fe944acf FT |
81 | #define NFP_ME27_INSTR_IS_BR_BYTE(instr) \ |
82 | ((instr & NFP_ME27_INSTR_MASK_BR_BYTE) == NFP_ME27_INSTR_BR_BYTE) | |
83 | ||
1678bd35 FT |
84 | #define NFP_ME27_INSTR_MASK_BR_BIT ((uint64_t) 0x00f800080300) |
85 | #define NFP_ME27_INSTR_BR_BIT ((uint64_t) 0x00d000000000) | |
fe944acf FT |
86 | #define NFP_ME27_INSTR_IS_BR_BIT(instr) \ |
87 | ((instr & NFP_ME27_INSTR_MASK_BR_BIT) == NFP_ME27_INSTR_BR_BIT) | |
88 | ||
1678bd35 FT |
89 | #define NFP_ME27_INSTR_MASK_BR_ALU ((uint64_t) 0x1fff80000000) |
90 | #define NFP_ME27_INSTR_BR_ALU ((uint64_t) 0x00e800000000) | |
fe944acf FT |
91 | #define NFP_ME27_INSTR_IS_BR_ALU(instr) \ |
92 | ((instr & NFP_ME27_INSTR_MASK_BR_ALU) == NFP_ME27_INSTR_BR_ALU) | |
93 | ||
1678bd35 FT |
94 | #define NFP_ME27_INSTR_MASK_MULT ((uint64_t) 0x1efe3f000000) |
95 | #define NFP_ME27_INSTR_MULT ((uint64_t) 0x00f800000000) | |
fe944acf FT |
96 | #define NFP_ME27_INSTR_IS_MULT(instr) \ |
97 | ((instr & NFP_ME27_INSTR_MASK_MULT) == NFP_ME27_INSTR_MULT) | |
98 | ||
99 | ||
1678bd35 FT |
100 | #define NFP_ME28_INSTR_MASK_CMD ((uint64_t) 0x008000000000) |
101 | #define NFP_ME28_INSTR_CMD ((uint64_t) 0x000000000000) | |
fe944acf FT |
102 | #define NFP_ME28_INSTR_IS_CMD(instr) \ |
103 | ((instr & NFP_ME28_INSTR_MASK_CMD) == NFP_ME28_INSTR_CMD) | |
104 | ||
1678bd35 FT |
105 | #define NFP_ME28_INSTR_MASK_ALU_SHF ((uint64_t) 0x00e000000000) |
106 | #define NFP_ME28_INSTR_ALU_SHF ((uint64_t) 0x008000000000) | |
fe944acf FT |
107 | #define NFP_ME28_INSTR_IS_ALU_SHF(instr) \ |
108 | ((instr & NFP_ME28_INSTR_MASK_ALU_SHF) == NFP_ME28_INSTR_ALU_SHF) | |
109 | ||
1678bd35 FT |
110 | #define NFP_ME28_INSTR_MASK_ALU ((uint64_t) 0x00e000000000) |
111 | #define NFP_ME28_INSTR_ALU ((uint64_t) 0x00a000000000) | |
fe944acf FT |
112 | #define NFP_ME28_INSTR_IS_ALU(instr) \ |
113 | ((instr & NFP_ME28_INSTR_MASK_ALU) == NFP_ME28_INSTR_ALU) | |
114 | ||
1678bd35 FT |
115 | #define NFP_ME28_INSTR_MASK_IMMED ((uint64_t) 0x01f900000000) |
116 | #define NFP_ME28_INSTR_IMMED ((uint64_t) 0x00f000000000) | |
fe944acf FT |
117 | #define NFP_ME28_INSTR_IS_IMMED(instr) \ |
118 | ((instr & NFP_ME28_INSTR_MASK_IMMED) == NFP_ME28_INSTR_IMMED) | |
119 | ||
1678bd35 FT |
120 | #define NFP_ME28_INSTR_MASK_LD_FIELD ((uint64_t) 0x01fa00e00000) |
121 | #define NFP_ME28_INSTR_LD_FIELD ((uint64_t) 0x00c000000000) | |
fe944acf FT |
122 | #define NFP_ME28_INSTR_IS_LD_FIELD(instr) \ |
123 | ((instr & NFP_ME28_INSTR_MASK_LD_FIELD) == NFP_ME28_INSTR_LD_FIELD) | |
124 | ||
1678bd35 FT |
125 | #define NFP_ME28_INSTR_MASK_CTX_ARB ((uint64_t) 0x00f800000000) |
126 | #define NFP_ME28_INSTR_CTX_ARB ((uint64_t) 0x00e000000000) | |
fe944acf FT |
127 | #define NFP_ME28_INSTR_IS_CTX_ARB(instr) \ |
128 | ((instr & NFP_ME28_INSTR_MASK_CTX_ARB) == NFP_ME28_INSTR_CTX_ARB) | |
129 | ||
1678bd35 FT |
130 | #define NFP_ME28_INSTR_MASK_LOCAL_CSR ((uint64_t) 0x01fe00100000) |
131 | #define NFP_ME28_INSTR_LOCAL_CSR ((uint64_t) 0x00fc00000000) | |
fe944acf FT |
132 | #define NFP_ME28_INSTR_IS_LOCAL_CSR(instr) \ |
133 | ((instr & NFP_ME28_INSTR_MASK_LOCAL_CSR) == NFP_ME28_INSTR_LOCAL_CSR) | |
134 | ||
1678bd35 FT |
135 | #define NFP_ME28_INSTR_MASK_BRANCH ((uint64_t) 0x00f8000c3ce0) |
136 | #define NFP_ME28_INSTR_BRANCH ((uint64_t) 0x00d800000020) | |
fe944acf FT |
137 | #define NFP_ME28_INSTR_IS_BRANCH(instr) \ |
138 | ((instr & NFP_ME28_INSTR_MASK_BRANCH) == NFP_ME28_INSTR_BRANCH) | |
139 | ||
1678bd35 FT |
140 | #define NFP_ME28_INSTR_MASK_BR_BYTE ((uint64_t) 0x00f800000000) |
141 | #define NFP_ME28_INSTR_BR_BYTE ((uint64_t) 0x00c800000000) | |
fe944acf FT |
142 | #define NFP_ME28_INSTR_IS_BR_BYTE(instr) \ |
143 | ((instr & NFP_ME28_INSTR_MASK_BR_BYTE) == NFP_ME28_INSTR_BR_BYTE) | |
144 | ||
1678bd35 FT |
145 | #define NFP_ME28_INSTR_MASK_BR_BIT ((uint64_t) 0x00f800080300) |
146 | #define NFP_ME28_INSTR_BR_BIT ((uint64_t) 0x00d000000000) | |
fe944acf FT |
147 | #define NFP_ME28_INSTR_IS_BR_BIT(instr) \ |
148 | ((instr & NFP_ME28_INSTR_MASK_BR_BIT) == NFP_ME28_INSTR_BR_BIT) | |
149 | ||
1678bd35 FT |
150 | #define NFP_ME28_INSTR_MASK_BR_ALU ((uint64_t) 0x00ff80000000) |
151 | #define NFP_ME28_INSTR_BR_ALU ((uint64_t) 0x00e800000000) | |
fe944acf FT |
152 | #define NFP_ME28_INSTR_IS_BR_ALU(instr) \ |
153 | ((instr & NFP_ME28_INSTR_MASK_BR_ALU) == NFP_ME28_INSTR_BR_ALU) | |
154 | ||
1678bd35 FT |
155 | #define NFP_ME28_INSTR_MASK_MULT ((uint64_t) 0x00fe3f000000) |
156 | #define NFP_ME28_INSTR_MULT ((uint64_t) 0x00f800000000) | |
fe944acf FT |
157 | #define NFP_ME28_INSTR_IS_MULT(instr) \ |
158 | ((instr & NFP_ME28_INSTR_MASK_MULT) == NFP_ME28_INSTR_MULT) | |
159 | ||
160 | typedef struct | |
161 | { | |
162 | int cpp_target; | |
163 | int cpp_action; | |
164 | int cpp_token; | |
165 | unsigned int len_fixed; | |
166 | unsigned int len_mask; | |
167 | const char *mnemonic; | |
168 | } | |
169 | nfp_cmd_mnemonic; | |
170 | ||
171 | #ifdef __cplusplus | |
172 | } | |
173 | #endif | |
174 | ||
175 | #endif /* _NFP_H_ */ |