14559860eSchristos /* nfp.h. NFP opcode list. 2*aab831ceSchristos Copyright (C) 2017-2024 Free Software Foundation, Inc. 34559860eSchristos Contributed by Francois H. Theron <francois.theron@netronome.com> 44559860eSchristos 54559860eSchristos This file is part of the GNU opcodes library. 64559860eSchristos 74559860eSchristos GDB, GAS, and the GNU binutils are free software; you can redistribute 84559860eSchristos them and/or modify them under the terms of the GNU General Public 94559860eSchristos License as published by the Free Software Foundation; either version 3, 104559860eSchristos or (at your option) any later version. 114559860eSchristos 124559860eSchristos GDB, GAS, and the GNU binutils are distributed in the hope that they 134559860eSchristos will be useful, but WITHOUT ANY WARRANTY; without even the implied 144559860eSchristos warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 154559860eSchristos the GNU General Public License for more details. 164559860eSchristos 174559860eSchristos You should have received a copy of the GNU General Public License 184559860eSchristos along with this file; see the file COPYING3. If not, write to the Free 194559860eSchristos Software Foundation, 51 Franklin Street - Fifth Floor, Boston, 204559860eSchristos MA 02110-1301, USA. */ 214559860eSchristos 224559860eSchristos #ifndef _NFP_H_ 234559860eSchristos #define _NFP_H_ 244559860eSchristos 254559860eSchristos #include "bfd.h" 264b169a6bSchristos #include <stdint.h> 274559860eSchristos #include "elf/nfp.h" 284559860eSchristos 294559860eSchristos #ifdef __cplusplus 304559860eSchristos extern "C" 314559860eSchristos { 324559860eSchristos #endif 334559860eSchristos 344559860eSchristos /* We use ME versions for most of this rather than NFP family and revision 354559860eSchristos numbers. The version numbers are currently 2.7 and 2.8 and to avoid long 364559860eSchristos names with many underscores we'll just use 27 and 28 until some feature 374559860eSchristos number makes it necessary to do something different. */ 384559860eSchristos 394559860eSchristos #define NFP_ME27_INSTR_MASK_CMD ((uint64_t) 0x008000000000) 404559860eSchristos #define NFP_ME27_INSTR_CMD ((uint64_t) 0x000000000000) 414559860eSchristos #define NFP_ME27_INSTR_IS_CMD(instr) \ 424559860eSchristos ((instr & NFP_ME27_INSTR_MASK_CMD) == NFP_ME27_INSTR_CMD) 434559860eSchristos 444559860eSchristos #define NFP_ME27_INSTR_MASK_ALU_SHF ((uint64_t) 0x1ee000000000) 454559860eSchristos #define NFP_ME27_INSTR_ALU_SHF ((uint64_t) 0x008000000000) 464559860eSchristos #define NFP_ME27_INSTR_IS_ALU_SHF(instr) \ 474559860eSchristos ((instr & NFP_ME27_INSTR_MASK_ALU_SHF) == NFP_ME27_INSTR_ALU_SHF) 484559860eSchristos 494559860eSchristos #define NFP_ME27_INSTR_MASK_ALU ((uint64_t) 0x1ee000000000) 504559860eSchristos #define NFP_ME27_INSTR_ALU ((uint64_t) 0x00a000000000) 514559860eSchristos #define NFP_ME27_INSTR_IS_ALU(instr) \ 524559860eSchristos ((instr & NFP_ME27_INSTR_MASK_ALU) == NFP_ME27_INSTR_ALU) 534559860eSchristos 544559860eSchristos #define NFP_ME27_INSTR_MASK_IMMED ((uint64_t) 0x1ff900000000) 554559860eSchristos #define NFP_ME27_INSTR_IMMED ((uint64_t) 0x00f000000000) 564559860eSchristos #define NFP_ME27_INSTR_IS_IMMED(instr) \ 574559860eSchristos ((instr & NFP_ME27_INSTR_MASK_IMMED) == NFP_ME27_INSTR_IMMED) 584559860eSchristos 594559860eSchristos #define NFP_ME27_INSTR_MASK_LD_FIELD ((uint64_t) 0x1ffa00e00000) 604559860eSchristos #define NFP_ME27_INSTR_LD_FIELD ((uint64_t) 0x00c000000000) 614559860eSchristos #define NFP_ME27_INSTR_IS_LD_FIELD(instr) \ 624559860eSchristos ((instr & NFP_ME27_INSTR_MASK_LD_FIELD) == NFP_ME27_INSTR_LD_FIELD) 634559860eSchristos 644559860eSchristos #define NFP_ME27_INSTR_MASK_CTX_ARB ((uint64_t) 0x00f800000000) 654559860eSchristos #define NFP_ME27_INSTR_CTX_ARB ((uint64_t) 0x00e000000000) 664559860eSchristos #define NFP_ME27_INSTR_IS_CTX_ARB(instr) \ 674559860eSchristos ((instr & NFP_ME27_INSTR_MASK_CTX_ARB) == NFP_ME27_INSTR_CTX_ARB) 684559860eSchristos 694559860eSchristos #define NFP_ME27_INSTR_MASK_LOCAL_CSR ((uint64_t) 0x1ffe00100000) 704559860eSchristos #define NFP_ME27_INSTR_LOCAL_CSR ((uint64_t) 0x00fc00000000) 714559860eSchristos #define NFP_ME27_INSTR_IS_LOCAL_CSR(instr) \ 724559860eSchristos ((instr & NFP_ME27_INSTR_MASK_LOCAL_CSR) == NFP_ME27_INSTR_LOCAL_CSR) 734559860eSchristos 744559860eSchristos #define NFP_ME27_INSTR_MASK_BRANCH ((uint64_t) 0x00f8000c3ce0) 754559860eSchristos #define NFP_ME27_INSTR_BRANCH ((uint64_t) 0x00d800000020) 764559860eSchristos #define NFP_ME27_INSTR_IS_BRANCH(instr) \ 774559860eSchristos ((instr & NFP_ME27_INSTR_MASK_BRANCH) == NFP_ME27_INSTR_BRANCH) 784559860eSchristos 794559860eSchristos #define NFP_ME27_INSTR_MASK_BR_BYTE ((uint64_t) 0x00f800000000) 804559860eSchristos #define NFP_ME27_INSTR_BR_BYTE ((uint64_t) 0x00c800000000) 814559860eSchristos #define NFP_ME27_INSTR_IS_BR_BYTE(instr) \ 824559860eSchristos ((instr & NFP_ME27_INSTR_MASK_BR_BYTE) == NFP_ME27_INSTR_BR_BYTE) 834559860eSchristos 844559860eSchristos #define NFP_ME27_INSTR_MASK_BR_BIT ((uint64_t) 0x00f800080300) 854559860eSchristos #define NFP_ME27_INSTR_BR_BIT ((uint64_t) 0x00d000000000) 864559860eSchristos #define NFP_ME27_INSTR_IS_BR_BIT(instr) \ 874559860eSchristos ((instr & NFP_ME27_INSTR_MASK_BR_BIT) == NFP_ME27_INSTR_BR_BIT) 884559860eSchristos 894559860eSchristos #define NFP_ME27_INSTR_MASK_BR_ALU ((uint64_t) 0x1fff80000000) 904559860eSchristos #define NFP_ME27_INSTR_BR_ALU ((uint64_t) 0x00e800000000) 914559860eSchristos #define NFP_ME27_INSTR_IS_BR_ALU(instr) \ 924559860eSchristos ((instr & NFP_ME27_INSTR_MASK_BR_ALU) == NFP_ME27_INSTR_BR_ALU) 934559860eSchristos 944559860eSchristos #define NFP_ME27_INSTR_MASK_MULT ((uint64_t) 0x1efe3f000000) 954559860eSchristos #define NFP_ME27_INSTR_MULT ((uint64_t) 0x00f800000000) 964559860eSchristos #define NFP_ME27_INSTR_IS_MULT(instr) \ 974559860eSchristos ((instr & NFP_ME27_INSTR_MASK_MULT) == NFP_ME27_INSTR_MULT) 984559860eSchristos 994559860eSchristos 1004559860eSchristos #define NFP_ME28_INSTR_MASK_CMD ((uint64_t) 0x008000000000) 1014559860eSchristos #define NFP_ME28_INSTR_CMD ((uint64_t) 0x000000000000) 1024559860eSchristos #define NFP_ME28_INSTR_IS_CMD(instr) \ 1034559860eSchristos ((instr & NFP_ME28_INSTR_MASK_CMD) == NFP_ME28_INSTR_CMD) 1044559860eSchristos 1054559860eSchristos #define NFP_ME28_INSTR_MASK_ALU_SHF ((uint64_t) 0x00e000000000) 1064559860eSchristos #define NFP_ME28_INSTR_ALU_SHF ((uint64_t) 0x008000000000) 1074559860eSchristos #define NFP_ME28_INSTR_IS_ALU_SHF(instr) \ 1084559860eSchristos ((instr & NFP_ME28_INSTR_MASK_ALU_SHF) == NFP_ME28_INSTR_ALU_SHF) 1094559860eSchristos 1104559860eSchristos #define NFP_ME28_INSTR_MASK_ALU ((uint64_t) 0x00e000000000) 1114559860eSchristos #define NFP_ME28_INSTR_ALU ((uint64_t) 0x00a000000000) 1124559860eSchristos #define NFP_ME28_INSTR_IS_ALU(instr) \ 1134559860eSchristos ((instr & NFP_ME28_INSTR_MASK_ALU) == NFP_ME28_INSTR_ALU) 1144559860eSchristos 1154559860eSchristos #define NFP_ME28_INSTR_MASK_IMMED ((uint64_t) 0x01f900000000) 1164559860eSchristos #define NFP_ME28_INSTR_IMMED ((uint64_t) 0x00f000000000) 1174559860eSchristos #define NFP_ME28_INSTR_IS_IMMED(instr) \ 1184559860eSchristos ((instr & NFP_ME28_INSTR_MASK_IMMED) == NFP_ME28_INSTR_IMMED) 1194559860eSchristos 1204559860eSchristos #define NFP_ME28_INSTR_MASK_LD_FIELD ((uint64_t) 0x01fa00e00000) 1214559860eSchristos #define NFP_ME28_INSTR_LD_FIELD ((uint64_t) 0x00c000000000) 1224559860eSchristos #define NFP_ME28_INSTR_IS_LD_FIELD(instr) \ 1234559860eSchristos ((instr & NFP_ME28_INSTR_MASK_LD_FIELD) == NFP_ME28_INSTR_LD_FIELD) 1244559860eSchristos 1254559860eSchristos #define NFP_ME28_INSTR_MASK_CTX_ARB ((uint64_t) 0x00f800000000) 1264559860eSchristos #define NFP_ME28_INSTR_CTX_ARB ((uint64_t) 0x00e000000000) 1274559860eSchristos #define NFP_ME28_INSTR_IS_CTX_ARB(instr) \ 1284559860eSchristos ((instr & NFP_ME28_INSTR_MASK_CTX_ARB) == NFP_ME28_INSTR_CTX_ARB) 1294559860eSchristos 1304559860eSchristos #define NFP_ME28_INSTR_MASK_LOCAL_CSR ((uint64_t) 0x01fe00100000) 1314559860eSchristos #define NFP_ME28_INSTR_LOCAL_CSR ((uint64_t) 0x00fc00000000) 1324559860eSchristos #define NFP_ME28_INSTR_IS_LOCAL_CSR(instr) \ 1334559860eSchristos ((instr & NFP_ME28_INSTR_MASK_LOCAL_CSR) == NFP_ME28_INSTR_LOCAL_CSR) 1344559860eSchristos 1354559860eSchristos #define NFP_ME28_INSTR_MASK_BRANCH ((uint64_t) 0x00f8000c3ce0) 1364559860eSchristos #define NFP_ME28_INSTR_BRANCH ((uint64_t) 0x00d800000020) 1374559860eSchristos #define NFP_ME28_INSTR_IS_BRANCH(instr) \ 1384559860eSchristos ((instr & NFP_ME28_INSTR_MASK_BRANCH) == NFP_ME28_INSTR_BRANCH) 1394559860eSchristos 1404559860eSchristos #define NFP_ME28_INSTR_MASK_BR_BYTE ((uint64_t) 0x00f800000000) 1414559860eSchristos #define NFP_ME28_INSTR_BR_BYTE ((uint64_t) 0x00c800000000) 1424559860eSchristos #define NFP_ME28_INSTR_IS_BR_BYTE(instr) \ 1434559860eSchristos ((instr & NFP_ME28_INSTR_MASK_BR_BYTE) == NFP_ME28_INSTR_BR_BYTE) 1444559860eSchristos 1454559860eSchristos #define NFP_ME28_INSTR_MASK_BR_BIT ((uint64_t) 0x00f800080300) 1464559860eSchristos #define NFP_ME28_INSTR_BR_BIT ((uint64_t) 0x00d000000000) 1474559860eSchristos #define NFP_ME28_INSTR_IS_BR_BIT(instr) \ 1484559860eSchristos ((instr & NFP_ME28_INSTR_MASK_BR_BIT) == NFP_ME28_INSTR_BR_BIT) 1494559860eSchristos 1504559860eSchristos #define NFP_ME28_INSTR_MASK_BR_ALU ((uint64_t) 0x00ff80000000) 1514559860eSchristos #define NFP_ME28_INSTR_BR_ALU ((uint64_t) 0x00e800000000) 1524559860eSchristos #define NFP_ME28_INSTR_IS_BR_ALU(instr) \ 1534559860eSchristos ((instr & NFP_ME28_INSTR_MASK_BR_ALU) == NFP_ME28_INSTR_BR_ALU) 1544559860eSchristos 1554559860eSchristos #define NFP_ME28_INSTR_MASK_MULT ((uint64_t) 0x00fe3f000000) 1564559860eSchristos #define NFP_ME28_INSTR_MULT ((uint64_t) 0x00f800000000) 1574559860eSchristos #define NFP_ME28_INSTR_IS_MULT(instr) \ 1584559860eSchristos ((instr & NFP_ME28_INSTR_MASK_MULT) == NFP_ME28_INSTR_MULT) 1594559860eSchristos 1604559860eSchristos typedef struct 1614559860eSchristos { 1624559860eSchristos int cpp_target; 1634559860eSchristos int cpp_action; 1644559860eSchristos int cpp_token; 1654559860eSchristos unsigned int len_fixed; 1664559860eSchristos unsigned int len_mask; 1674559860eSchristos const char *mnemonic; 1684559860eSchristos } 1694559860eSchristos nfp_cmd_mnemonic; 1704559860eSchristos 1714559860eSchristos #ifdef __cplusplus 1724559860eSchristos } 1734559860eSchristos #endif 1744559860eSchristos 1754559860eSchristos #endif /* _NFP_H_ */ 176