1 1.1 christos /* Assembler instructions for Motorola's Mcore processor 2 1.1.1.9 christos Copyright (C) 1999-2025 Free Software Foundation, Inc. 3 1.1 christos 4 1.1 christos This file is part of the GNU opcodes library. 5 1.1 christos 6 1.1 christos This library is free software; you can redistribute it and/or modify 7 1.1 christos it under the terms of the GNU General Public License as published by 8 1.1 christos the Free Software Foundation; either version 3, or (at your option) 9 1.1 christos any later version. 10 1.1 christos 11 1.1 christos It is distributed in the hope that it will be useful, but WITHOUT 12 1.1 christos ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 1.1 christos or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 14 1.1 christos License for more details. 15 1.1 christos 16 1.1 christos You should have received a copy of the GNU General Public License 17 1.1 christos along with this program; if not, write to the Free Software 18 1.1 christos Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, 19 1.1 christos MA 02110-1301, USA. */ 20 1.1 christos 21 1.1 christos #include "ansidecl.h" 22 1.1 christos 23 1.1 christos typedef enum 24 1.1 christos { 25 1.1 christos O0, OT, O1, OC, O2, X1, OI, OB, 26 1.1 christos OMa, SI, I7, LS, BR, BL, LR, LJ, 27 1.1 christos RM, RQ, JSR, JMP, OBRa, OBRb, OBRc, OBR2, 28 1.1 christos O1R1, OMb, OMc, SIa, 29 1.1 christos MULSH, OPSR, 30 1.1 christos JC, JU, JL, RSI, DO21, OB2 31 1.1 christos } 32 1.1 christos mcore_opclass; 33 1.1 christos 34 1.1 christos typedef struct inst 35 1.1 christos { 36 1.1.1.3 christos const char * name; 37 1.1 christos mcore_opclass opclass; 38 1.1 christos unsigned char transfer; 39 1.1 christos unsigned short inst; 40 1.1 christos } 41 1.1 christos mcore_opcode_info; 42 1.1 christos 43 1.1 christos #ifdef DEFINE_TABLE 44 1.1 christos const mcore_opcode_info mcore_table[] = 45 1.1 christos { 46 1.1 christos { "bkpt", O0, 0, 0x0000 }, 47 1.1 christos { "sync", O0, 0, 0x0001 }, 48 1.1 christos { "rte", O0, 1, 0x0002 }, 49 1.1 christos { "rfe", O0, 1, 0x0002 }, 50 1.1 christos { "rfi", O0, 1, 0x0003 }, 51 1.1 christos { "stop", O0, 0, 0x0004 }, 52 1.1 christos { "wait", O0, 0, 0x0005 }, 53 1.1 christos { "doze", O0, 0, 0x0006 }, 54 1.1 christos { "idly4", O0, 0, 0x0007 }, 55 1.1 christos { "trap", OT, 0, 0x0008 }, 56 1.1 christos /* SPACE: 0x000C - 0x000F */ 57 1.1 christos /* SPACE: 0x0010 - 0x001F */ 58 1.1 christos { "mvc", O1, 0, 0x0020 }, 59 1.1 christos { "mvcv", O1, 0, 0x0030 }, 60 1.1 christos { "ldq", RQ, 0, 0x0040 }, 61 1.1 christos { "stq", RQ, 0, 0x0050 }, 62 1.1 christos { "ldm", RM, 0, 0x0060 }, 63 1.1 christos { "stm", RM, 0, 0x0070 }, 64 1.1 christos { "dect", O1, 0, 0x0080 }, 65 1.1 christos { "decf", O1, 0, 0x0090 }, 66 1.1 christos { "inct", O1, 0, 0x00A0 }, 67 1.1 christos { "incf", O1, 0, 0x00B0 }, 68 1.1 christos { "jmp", JMP, 2, 0x00C0 }, 69 1.1 christos #define MCORE_INST_JMP 0x00C0 70 1.1 christos { "jsr", JSR, 0, 0x00D0 }, 71 1.1 christos #define MCORE_INST_JSR 0x00E0 72 1.1 christos { "ff1", O1, 0, 0x00E0 }, 73 1.1 christos { "brev", O1, 0, 0x00F0 }, 74 1.1 christos { "xtrb3", X1, 0, 0x0100 }, 75 1.1 christos { "xtrb2", X1, 0, 0x0110 }, 76 1.1 christos { "xtrb1", X1, 0, 0x0120 }, 77 1.1 christos { "xtrb0", X1, 0, 0x0130 }, 78 1.1 christos { "zextb", O1, 0, 0x0140 }, 79 1.1 christos { "sextb", O1, 0, 0x0150 }, 80 1.1 christos { "zexth", O1, 0, 0x0160 }, 81 1.1 christos { "sexth", O1, 0, 0x0170 }, 82 1.1 christos { "declt", O1, 0, 0x0180 }, 83 1.1 christos { "tstnbz", O1, 0, 0x0190 }, 84 1.1 christos { "decgt", O1, 0, 0x01A0 }, 85 1.1 christos { "decne", O1, 0, 0x01B0 }, 86 1.1 christos { "clrt", O1, 0, 0x01C0 }, 87 1.1 christos { "clrf", O1, 0, 0x01D0 }, 88 1.1 christos { "abs", O1, 0, 0x01E0 }, 89 1.1 christos { "not", O1, 0, 0x01F0 }, 90 1.1 christos { "movt", O2, 0, 0x0200 }, 91 1.1 christos { "mult", O2, 0, 0x0300 }, 92 1.1 christos { "loopt", BL, 0, 0x0400 }, 93 1.1 christos { "subu", O2, 0, 0x0500 }, 94 1.1 christos { "sub", O2, 0, 0x0500 }, /* Official alias. */ 95 1.1 christos { "addc", O2, 0, 0x0600 }, 96 1.1 christos { "subc", O2, 0, 0x0700 }, 97 1.1 christos /* SPACE: 0x0800-0x08ff for a diadic operation */ 98 1.1 christos /* SPACE: 0x0900-0x09ff for a diadic operation */ 99 1.1 christos { "movf", O2, 0, 0x0A00 }, 100 1.1 christos { "lsr", O2, 0, 0x0B00 }, 101 1.1 christos { "cmphs", O2, 0, 0x0C00 }, 102 1.1 christos { "cmplt", O2, 0, 0x0D00 }, 103 1.1 christos { "tst", O2, 0, 0x0E00 }, 104 1.1 christos { "cmpne", O2, 0, 0x0F00 }, 105 1.1 christos { "mfcr", OC, 0, 0x1000 }, 106 1.1 christos { "psrclr", OPSR, 0, 0x11F0 }, 107 1.1 christos { "psrset", OPSR, 0, 0x11F8 }, 108 1.1 christos { "mov", O2, 0, 0x1200 }, 109 1.1 christos { "bgenr", O2, 0, 0x1300 }, 110 1.1 christos { "rsub", O2, 0, 0x1400 }, 111 1.1 christos { "ixw", O2, 0, 0x1500 }, 112 1.1 christos { "and", O2, 0, 0x1600 }, 113 1.1 christos { "xor", O2, 0, 0x1700 }, 114 1.1 christos { "mtcr", OC, 0, 0x1800 }, 115 1.1 christos { "asr", O2, 0, 0x1A00 }, 116 1.1 christos { "lsl", O2, 0, 0x1B00 }, 117 1.1 christos { "addu", O2, 0, 0x1C00 }, 118 1.1 christos { "add", O2, 0, 0x1C00 }, /* Official alias. */ 119 1.1 christos { "ixh", O2, 0, 0x1D00 }, 120 1.1 christos { "or", O2, 0, 0x1E00 }, 121 1.1 christos { "andn", O2, 0, 0x1F00 }, 122 1.1 christos { "addi", OI, 0, 0x2000 }, 123 1.1 christos #define MCORE_INST_ADDI 0x2000 124 1.1 christos { "cmplti", OI, 0, 0x2200 }, 125 1.1 christos { "subi", OI, 0, 0x2400 }, 126 1.1 christos /* SPACE: 0x2600-0x27ff open for a register+immediate operation */ 127 1.1 christos { "rsubi", OB, 0, 0x2800 }, 128 1.1 christos { "cmpnei", OB, 0, 0x2A00 }, 129 1.1 christos { "bmaski", OMa, 0, 0x2C00 }, 130 1.1 christos { "divu", O1R1, 0, 0x2C10 }, 131 1.1.1.3 christos /* SPACE: 0x2c20 - 0x2c7f */ 132 1.1 christos { "bmaski", OMb, 0, 0x2C80 }, 133 1.1 christos { "bmaski", OMc, 0, 0x2D00 }, 134 1.1 christos { "andi", OB, 0, 0x2E00 }, 135 1.1 christos { "bclri", OB, 0, 0x3000 }, 136 1.1 christos /* SPACE: 0x3200 - 0x320f */ 137 1.1 christos { "divs", O1R1, 0, 0x3210 }, 138 1.1.1.3 christos /* SPACE: 0x3220 - 0x326f */ 139 1.1 christos { "bgeni", OBRa, 0, 0x3270 }, 140 1.1 christos { "bgeni", OBRb, 0, 0x3280 }, 141 1.1 christos { "bgeni", OBRc, 0, 0x3300 }, 142 1.1 christos { "bseti", OB, 0, 0x3400 }, 143 1.1 christos { "btsti", OB, 0, 0x3600 }, 144 1.1 christos { "xsr", O1, 0, 0x3800 }, 145 1.1 christos { "rotli", SIa, 0, 0x3800 }, 146 1.1 christos { "asrc", O1, 0, 0x3A00 }, 147 1.1 christos { "asri", SIa, 0, 0x3A00 }, 148 1.1 christos { "lslc", O1, 0, 0x3C00 }, 149 1.1 christos { "lsli", SIa, 0, 0x3C00 }, 150 1.1 christos { "lsrc", O1, 0, 0x3E00 }, 151 1.1 christos { "lsri", SIa, 0, 0x3E00 }, 152 1.1 christos /* SPACE: 0x4000 - 0x5fff */ 153 1.1 christos { "movi", I7, 0, 0x6000 }, 154 1.1 christos #define MCORE_INST_BMASKI_ALT 0x6000 155 1.1 christos #define MCORE_INST_BGENI_ALT 0x6000 156 1.1 christos { "mulsh", MULSH, 0, 0x6800 }, 157 1.1 christos { "muls.h", MULSH, 0, 0x6800 }, 158 1.1 christos /* SPACE: 0x6900 - 0x6FFF */ 159 1.1 christos { "jmpi", LJ, 1, 0x7000 }, 160 1.1 christos { "jsri", LJ, 0, 0x7F00 }, 161 1.1 christos #define MCORE_INST_JMPI 0x7000 162 1.1 christos { "lrw", LR, 0, 0x7000 }, 163 1.1 christos #define MCORE_INST_JSRI 0x7F00 164 1.1 christos { "ld", LS, 0, 0x8000 }, 165 1.1 christos { "ldw", LS, 0, 0x8000 }, 166 1.1 christos { "ld.w", LS, 0, 0x8000 }, 167 1.1 christos { "st", LS, 0, 0x9000 }, 168 1.1 christos { "stw", LS, 0, 0x9000 }, 169 1.1 christos { "st.w", LS, 0, 0x9000 }, 170 1.1 christos { "ldb", LS, 0, 0xA000 }, 171 1.1 christos { "ld.b", LS, 0, 0xA000 }, 172 1.1 christos { "stb", LS, 0, 0xB000 }, 173 1.1 christos { "st.b", LS, 0, 0xB000 }, 174 1.1 christos { "ldh", LS, 0, 0xC000 }, 175 1.1 christos { "ld.h", LS, 0, 0xC000 }, 176 1.1 christos { "sth", LS, 0, 0xD000 }, 177 1.1 christos { "st.h", LS, 0, 0xD000 }, 178 1.1 christos { "bt", BR, 0, 0xE000 }, 179 1.1 christos { "bf", BR, 0, 0xE800 }, 180 1.1 christos { "br", BR, 1, 0xF000 }, 181 1.1 christos #define MCORE_INST_BR 0xF000 182 1.1 christos { "bsr", BR, 0, 0xF800 }, 183 1.1 christos #define MCORE_INST_BSR 0xF800 184 1.1 christos 185 1.1 christos /* The following are relaxable branches */ 186 1.1 christos { "jbt", JC, 0, 0xE000 }, 187 1.1 christos { "jbf", JC, 0, 0xE800 }, 188 1.1 christos { "jbr", JU, 1, 0xF000 }, 189 1.1 christos { "jbsr", JL, 0, 0xF800 }, 190 1.1 christos 191 1.1 christos /* The following are aliases for other instructions */ 192 1.1 christos { "rts", O0, 2, 0x00CF }, /* jmp r15 */ 193 1.1 christos { "rolc", DO21, 0, 0x0600 }, /* addc rd,rd */ 194 1.1 christos { "rotlc", DO21, 0, 0x0600 }, /* addc rd,rd */ 195 1.1 christos { "setc", O0, 0, 0x0C00 }, /* cmphs r0,r0 */ 196 1.1 christos { "clrc", O0, 0, 0x0F00 }, /* cmpne r0,r0 */ 197 1.1 christos { "tstle", O1, 0, 0x2200 }, /* cmplti rd,1 */ 198 1.1 christos { "cmplei", OB, 0, 0x2200 }, /* cmplei rd,X -> cmplti rd,X+1 */ 199 1.1 christos { "neg", O1, 0, 0x2800 }, /* rsubi rd,0 */ 200 1.1 christos { "tstne", O1, 0, 0x2A00 }, /* cmpnei rd,0 */ 201 1.1 christos { "tstlt", O1, 0, 0x37F0 }, /* btsti rx,31 */ 202 1.1 christos { "mclri", OB2, 0, 0x3000 }, /* bclri rx,log2(imm) */ 203 1.1 christos { "mgeni", OBR2, 0, 0x3200 }, /* bgeni rx,log2(imm) */ 204 1.1 christos { "mseti", OB2, 0, 0x3400 }, /* bseti rx,log2(imm) */ 205 1.1 christos { "mtsti", OB2, 0, 0x3600 }, /* btsti rx,log2(imm) */ 206 1.1 christos { "rori", RSI, 0, 0x3800 }, 207 1.1 christos { "rotri", RSI, 0, 0x3800 }, 208 1.1 christos { "nop", O0, 0, 0x1200 }, /* mov r0, r0 */ 209 1.1 christos }; 210 1.1 christos #endif 211