1 1.1 christos /* mn10300.h -- Header file for Matsushita 10300 opcode table 2 1.10 christos Copyright (C) 1996-2025 Free Software Foundation, Inc. 3 1.1 christos Written by Jeff Law, Cygnus Support 4 1.1 christos 5 1.1 christos This file is part of GDB, GAS, and the GNU binutils. 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 MN10300_H 23 1.1 christos #define MN10300_H 24 1.1 christos 25 1.1 christos /* The opcode table is an array of struct mn10300_opcode. */ 26 1.1 christos 27 1.1 christos #define MN10300_MAX_OPERANDS 8 28 1.1 christos struct mn10300_opcode 29 1.1 christos { 30 1.1 christos /* The opcode name. */ 31 1.1 christos const char *name; 32 1.1 christos 33 1.1 christos /* The opcode itself. Those bits which will be filled in with 34 1.1 christos operands are zeroes. */ 35 1.1 christos unsigned long opcode; 36 1.1 christos 37 1.1 christos /* The opcode mask. This is used by the disassembler. This is a 38 1.1 christos mask containing ones indicating those bits which must match the 39 1.1 christos opcode field, and zeroes indicating those bits which need not 40 1.1 christos match (and are presumably filled in by operands). */ 41 1.1 christos unsigned long mask; 42 1.1 christos 43 1.1 christos /* A bitmask. For each operand, nonzero if it must not have the same 44 1.1 christos register specification as all other operands with a nonzero bit in 45 1.1 christos this flag. ie 0x81 would indicate that operands 7 and 0 must not 46 1.1 christos match. Note that we count operands from left to right as they appear 47 1.1 christos in the operands specification below. */ 48 1.1 christos unsigned int no_match_operands; 49 1.1 christos 50 1.1 christos /* The format of this opcode. */ 51 1.1 christos unsigned char format; 52 1.1 christos 53 1.1 christos /* Bitmask indicating what cpu variants this opcode is available on. 54 1.1 christos We assume mn10300 base opcodes are available everywhere, so we only 55 1.1 christos have to note opcodes which are available on other variants. */ 56 1.1 christos unsigned int machine; 57 1.1 christos 58 1.1 christos /* An array of operand codes. Each code is an index into the 59 1.1 christos operand table. They appear in the order which the operands must 60 1.1 christos appear in assembly code, and are terminated by a zero. */ 61 1.1 christos unsigned char operands[MN10300_MAX_OPERANDS]; 62 1.1 christos }; 63 1.1 christos 64 1.1 christos /* The table itself is sorted by major opcode number, and is otherwise 65 1.1 christos in the order in which the disassembler should consider 66 1.1 christos instructions. */ 67 1.1 christos extern const struct mn10300_opcode mn10300_opcodes[]; 68 1.1 christos extern const int mn10300_num_opcodes; 69 1.1 christos 70 1.1 christos 71 1.1 christos /* The operands table is an array of struct mn10300_operand. */ 73 1.1 christos 74 1.1 christos struct mn10300_operand 75 1.1 christos { 76 1.1 christos /* The number of bits in the operand. */ 77 1.1 christos int bits; 78 1.1 christos 79 1.1 christos /* How far the operand is left shifted in the instruction. */ 80 1.1 christos int shift; 81 1.1 christos 82 1.1 christos /* One bit syntax flags. */ 83 1.1 christos int flags; 84 1.1 christos }; 85 1.1 christos 86 1.1 christos /* Elements in the table are retrieved by indexing with values from 87 1.1 christos the operands field of the mn10300_opcodes table. */ 88 1.1 christos 89 1.1 christos extern const struct mn10300_operand mn10300_operands[]; 90 1.1 christos 91 1.1 christos /* Values defined for the flags field of a struct mn10300_operand. */ 92 1.1 christos #define MN10300_OPERAND_DREG 0x1 93 1.1 christos 94 1.1 christos #define MN10300_OPERAND_AREG 0x2 95 1.1 christos 96 1.1 christos #define MN10300_OPERAND_SP 0x4 97 1.1 christos 98 1.1 christos #define MN10300_OPERAND_PSW 0x8 99 1.1 christos 100 1.1 christos #define MN10300_OPERAND_MDR 0x10 101 1.1 christos 102 1.1 christos #define MN10300_OPERAND_SIGNED 0x20 103 1.1 christos 104 1.1 christos #define MN10300_OPERAND_PROMOTE 0x40 105 1.1 christos 106 1.1 christos #define MN10300_OPERAND_PAREN 0x80 107 1.1 christos 108 1.1 christos #define MN10300_OPERAND_REPEATED 0x100 109 1.1 christos 110 1.1 christos #define MN10300_OPERAND_EXTENDED 0x200 111 1.1 christos 112 1.1 christos #define MN10300_OPERAND_SPLIT 0x400 113 1.1 christos 114 1.1 christos #define MN10300_OPERAND_REG_LIST 0x800 115 1.1 christos 116 1.1 christos #define MN10300_OPERAND_PCREL 0x1000 117 1.1 christos 118 1.1 christos #define MN10300_OPERAND_MEMADDR 0x2000 119 1.1 christos 120 1.1 christos #define MN10300_OPERAND_RELAX 0x4000 121 1.1 christos 122 1.1 christos #define MN10300_OPERAND_USP 0x8000 123 1.1 christos 124 1.1 christos #define MN10300_OPERAND_SSP 0x10000 125 1.1 christos 126 1.1 christos #define MN10300_OPERAND_MSP 0x20000 127 1.1 christos 128 1.1 christos #define MN10300_OPERAND_PC 0x40000 129 1.1 christos 130 1.1 christos #define MN10300_OPERAND_EPSW 0x80000 131 1.1 christos 132 1.1 christos #define MN10300_OPERAND_RREG 0x100000 133 1.1 christos 134 1.1 christos #define MN10300_OPERAND_XRREG 0x200000 135 1.1 christos 136 1.1 christos #define MN10300_OPERAND_PLUS 0x400000 137 1.1 christos 138 1.1 christos #define MN10300_OPERAND_24BIT 0x800000 139 1.1 christos 140 1.1 christos #define MN10300_OPERAND_FSREG 0x1000000 141 1.1 christos 142 1.1 christos #define MN10300_OPERAND_FDREG 0x2000000 143 1.1 christos 144 1.1 christos #define MN10300_OPERAND_FPCR 0x4000000 145 1.1 christos 146 1.1 christos /* Opcode Formats. */ 147 1.1 christos #define FMT_S0 1 148 1.1 christos #define FMT_S1 2 149 1.1 christos #define FMT_S2 3 150 1.1 christos #define FMT_S4 4 151 1.1 christos #define FMT_S6 5 152 1.1 christos #define FMT_D0 6 153 1.1 christos #define FMT_D1 7 154 1.1 christos #define FMT_D2 8 155 1.1 christos #define FMT_D4 9 156 1.1 christos #define FMT_D5 10 157 1.1 christos #define FMT_D6 11 158 1.1 christos #define FMT_D7 12 159 1.1 christos #define FMT_D8 13 160 1.1 christos #define FMT_D9 14 161 1.1 christos #define FMT_D10 15 162 1.1 christos #define FMT_D3 16 163 1.1 christos 164 1.1 christos /* Variants of the mn10300 which have additional opcodes. */ 165 1.1 christos #define MN103 300 166 1.1 christos #define AM30 300 167 1.1 christos 168 1.1 christos #define AM33 330 169 1.1 christos #define AM33_2 332 170 1.1 christos 171 #endif /* MN10300_H */ 172