xref: /netbsd-src/external/gpl3/gdb.old/dist/include/opcode/nfp.h (revision 6881a4007f077b54e5f51159c52b9b25f57deb0d)
1 /* nfp.h.  NFP opcode list.
2    Copyright (C) 2017-2022 Free Software Foundation, Inc.
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"
26 #include <stdint.h>
27 #include "elf/nfp.h"
28 
29 #ifdef __cplusplus
30 extern "C"
31 {
32 #endif
33 
34 /* We use ME versions for most of this rather than NFP family and revision
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 
39 #define NFP_ME27_INSTR_MASK_CMD	        ((uint64_t) 0x008000000000)
40 #define NFP_ME27_INSTR_CMD		((uint64_t) 0x000000000000)
41 #define NFP_ME27_INSTR_IS_CMD(instr) \
42 	((instr & NFP_ME27_INSTR_MASK_CMD) == NFP_ME27_INSTR_CMD)
43 
44 #define NFP_ME27_INSTR_MASK_ALU_SHF	((uint64_t) 0x1ee000000000)
45 #define NFP_ME27_INSTR_ALU_SHF		((uint64_t) 0x008000000000)
46 #define NFP_ME27_INSTR_IS_ALU_SHF(instr) \
47 	((instr & NFP_ME27_INSTR_MASK_ALU_SHF) == NFP_ME27_INSTR_ALU_SHF)
48 
49 #define NFP_ME27_INSTR_MASK_ALU	        ((uint64_t) 0x1ee000000000)
50 #define NFP_ME27_INSTR_ALU		((uint64_t) 0x00a000000000)
51 #define NFP_ME27_INSTR_IS_ALU(instr) \
52 		((instr & NFP_ME27_INSTR_MASK_ALU) == NFP_ME27_INSTR_ALU)
53 
54 #define NFP_ME27_INSTR_MASK_IMMED	((uint64_t) 0x1ff900000000)
55 #define NFP_ME27_INSTR_IMMED		((uint64_t) 0x00f000000000)
56 #define NFP_ME27_INSTR_IS_IMMED(instr) \
57 	((instr & NFP_ME27_INSTR_MASK_IMMED) == NFP_ME27_INSTR_IMMED)
58 
59 #define NFP_ME27_INSTR_MASK_LD_FIELD	((uint64_t) 0x1ffa00e00000)
60 #define NFP_ME27_INSTR_LD_FIELD	        ((uint64_t) 0x00c000000000)
61 #define NFP_ME27_INSTR_IS_LD_FIELD(instr) \
62 	((instr & NFP_ME27_INSTR_MASK_LD_FIELD) == NFP_ME27_INSTR_LD_FIELD)
63 
64 #define NFP_ME27_INSTR_MASK_CTX_ARB	((uint64_t) 0x00f800000000)
65 #define NFP_ME27_INSTR_CTX_ARB		((uint64_t) 0x00e000000000)
66 #define NFP_ME27_INSTR_IS_CTX_ARB(instr) \
67 	((instr & NFP_ME27_INSTR_MASK_CTX_ARB) == NFP_ME27_INSTR_CTX_ARB)
68 
69 #define NFP_ME27_INSTR_MASK_LOCAL_CSR	((uint64_t) 0x1ffe00100000)
70 #define NFP_ME27_INSTR_LOCAL_CSR	((uint64_t) 0x00fc00000000)
71 #define NFP_ME27_INSTR_IS_LOCAL_CSR(instr) \
72 	((instr & NFP_ME27_INSTR_MASK_LOCAL_CSR) == NFP_ME27_INSTR_LOCAL_CSR)
73 
74 #define NFP_ME27_INSTR_MASK_BRANCH	((uint64_t) 0x00f8000c3ce0)
75 #define NFP_ME27_INSTR_BRANCH		((uint64_t) 0x00d800000020)
76 #define NFP_ME27_INSTR_IS_BRANCH(instr) \
77 	((instr & NFP_ME27_INSTR_MASK_BRANCH) == NFP_ME27_INSTR_BRANCH)
78 
79 #define NFP_ME27_INSTR_MASK_BR_BYTE	((uint64_t) 0x00f800000000)
80 #define NFP_ME27_INSTR_BR_BYTE		((uint64_t) 0x00c800000000)
81 #define NFP_ME27_INSTR_IS_BR_BYTE(instr) \
82 	((instr & NFP_ME27_INSTR_MASK_BR_BYTE) == NFP_ME27_INSTR_BR_BYTE)
83 
84 #define NFP_ME27_INSTR_MASK_BR_BIT	((uint64_t) 0x00f800080300)
85 #define NFP_ME27_INSTR_BR_BIT		((uint64_t) 0x00d000000000)
86 #define NFP_ME27_INSTR_IS_BR_BIT(instr) \
87 	((instr & NFP_ME27_INSTR_MASK_BR_BIT) == NFP_ME27_INSTR_BR_BIT)
88 
89 #define NFP_ME27_INSTR_MASK_BR_ALU	((uint64_t) 0x1fff80000000)
90 #define NFP_ME27_INSTR_BR_ALU		((uint64_t) 0x00e800000000)
91 #define NFP_ME27_INSTR_IS_BR_ALU(instr) \
92 	((instr & NFP_ME27_INSTR_MASK_BR_ALU) == NFP_ME27_INSTR_BR_ALU)
93 
94 #define NFP_ME27_INSTR_MASK_MULT	((uint64_t) 0x1efe3f000000)
95 #define NFP_ME27_INSTR_MULT		((uint64_t) 0x00f800000000)
96 #define NFP_ME27_INSTR_IS_MULT(instr) \
97 	((instr & NFP_ME27_INSTR_MASK_MULT) == NFP_ME27_INSTR_MULT)
98 
99 
100 #define NFP_ME28_INSTR_MASK_CMD	        ((uint64_t) 0x008000000000)
101 #define NFP_ME28_INSTR_CMD		((uint64_t) 0x000000000000)
102 #define NFP_ME28_INSTR_IS_CMD(instr) \
103 	((instr & NFP_ME28_INSTR_MASK_CMD) == NFP_ME28_INSTR_CMD)
104 
105 #define NFP_ME28_INSTR_MASK_ALU_SHF	((uint64_t) 0x00e000000000)
106 #define NFP_ME28_INSTR_ALU_SHF		((uint64_t) 0x008000000000)
107 #define NFP_ME28_INSTR_IS_ALU_SHF(instr) \
108 	((instr & NFP_ME28_INSTR_MASK_ALU_SHF) == NFP_ME28_INSTR_ALU_SHF)
109 
110 #define NFP_ME28_INSTR_MASK_ALU	        ((uint64_t) 0x00e000000000)
111 #define NFP_ME28_INSTR_ALU		((uint64_t) 0x00a000000000)
112 #define NFP_ME28_INSTR_IS_ALU(instr) \
113 	((instr & NFP_ME28_INSTR_MASK_ALU) == NFP_ME28_INSTR_ALU)
114 
115 #define NFP_ME28_INSTR_MASK_IMMED	((uint64_t) 0x01f900000000)
116 #define NFP_ME28_INSTR_IMMED		((uint64_t) 0x00f000000000)
117 #define NFP_ME28_INSTR_IS_IMMED(instr) \
118 	((instr & NFP_ME28_INSTR_MASK_IMMED) == NFP_ME28_INSTR_IMMED)
119 
120 #define NFP_ME28_INSTR_MASK_LD_FIELD	((uint64_t) 0x01fa00e00000)
121 #define NFP_ME28_INSTR_LD_FIELD	        ((uint64_t) 0x00c000000000)
122 #define NFP_ME28_INSTR_IS_LD_FIELD(instr) \
123 	((instr & NFP_ME28_INSTR_MASK_LD_FIELD) == NFP_ME28_INSTR_LD_FIELD)
124 
125 #define NFP_ME28_INSTR_MASK_CTX_ARB	((uint64_t) 0x00f800000000)
126 #define NFP_ME28_INSTR_CTX_ARB		((uint64_t) 0x00e000000000)
127 #define NFP_ME28_INSTR_IS_CTX_ARB(instr) \
128 	((instr & NFP_ME28_INSTR_MASK_CTX_ARB) == NFP_ME28_INSTR_CTX_ARB)
129 
130 #define NFP_ME28_INSTR_MASK_LOCAL_CSR	((uint64_t) 0x01fe00100000)
131 #define NFP_ME28_INSTR_LOCAL_CSR	((uint64_t) 0x00fc00000000)
132 #define NFP_ME28_INSTR_IS_LOCAL_CSR(instr) \
133 	((instr & NFP_ME28_INSTR_MASK_LOCAL_CSR) == NFP_ME28_INSTR_LOCAL_CSR)
134 
135 #define NFP_ME28_INSTR_MASK_BRANCH	((uint64_t) 0x00f8000c3ce0)
136 #define NFP_ME28_INSTR_BRANCH		((uint64_t) 0x00d800000020)
137 #define NFP_ME28_INSTR_IS_BRANCH(instr) \
138 	((instr & NFP_ME28_INSTR_MASK_BRANCH) == NFP_ME28_INSTR_BRANCH)
139 
140 #define NFP_ME28_INSTR_MASK_BR_BYTE	((uint64_t) 0x00f800000000)
141 #define NFP_ME28_INSTR_BR_BYTE		((uint64_t) 0x00c800000000)
142 #define NFP_ME28_INSTR_IS_BR_BYTE(instr) \
143 	((instr & NFP_ME28_INSTR_MASK_BR_BYTE) == NFP_ME28_INSTR_BR_BYTE)
144 
145 #define NFP_ME28_INSTR_MASK_BR_BIT	((uint64_t) 0x00f800080300)
146 #define NFP_ME28_INSTR_BR_BIT		((uint64_t) 0x00d000000000)
147 #define NFP_ME28_INSTR_IS_BR_BIT(instr) \
148 	((instr & NFP_ME28_INSTR_MASK_BR_BIT) == NFP_ME28_INSTR_BR_BIT)
149 
150 #define NFP_ME28_INSTR_MASK_BR_ALU	((uint64_t) 0x00ff80000000)
151 #define NFP_ME28_INSTR_BR_ALU		((uint64_t) 0x00e800000000)
152 #define NFP_ME28_INSTR_IS_BR_ALU(instr) \
153 	((instr & NFP_ME28_INSTR_MASK_BR_ALU) == NFP_ME28_INSTR_BR_ALU)
154 
155 #define NFP_ME28_INSTR_MASK_MULT	((uint64_t) 0x00fe3f000000)
156 #define NFP_ME28_INSTR_MULT		((uint64_t) 0x00f800000000)
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_ */
176