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