| 1 | /* moxie-opc.c -- Definitions for moxie opcodes. |
| 2 | Copyright (C) 2009-2015 Free Software Foundation, Inc. |
| 3 | Contributed by Anthony Green (green@moxielogic.com). |
| 4 | |
| 5 | This file is part of the GNU opcodes library. |
| 6 | |
| 7 | This library is free software; you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by |
| 9 | the Free Software Foundation; either version 3, or (at your option) |
| 10 | any later version. |
| 11 | |
| 12 | It is distributed in the hope that it will be useful, but WITHOUT |
| 13 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 14 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
| 15 | 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 COPYING. If not, write to the |
| 19 | Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, |
| 20 | MA 02110-1301, USA. */ |
| 21 | |
| 22 | #include "sysdep.h" |
| 23 | #include "opcode/moxie.h" |
| 24 | |
| 25 | /* The moxie processor's 16-bit instructions come in two forms: |
| 26 | |
| 27 | FORM 1 instructions start with a 0 bit... |
| 28 | |
| 29 | 0oooooooaaaabbbb |
| 30 | 0 F |
| 31 | |
| 32 | ooooooo - form 1 opcode number |
| 33 | aaaa - operand A |
| 34 | bbbb - operand B |
| 35 | |
| 36 | FORM 2 instructions start with bits "10"... |
| 37 | |
| 38 | 10ooaaaavvvvvvvv |
| 39 | 0 F |
| 40 | |
| 41 | oo - form 2 opcode number |
| 42 | aaaa - operand A |
| 43 | vvvvvvvv - 8-bit immediate value |
| 44 | |
| 45 | FORM 3 instructions start with a bits "11"... |
| 46 | |
| 47 | 11oooovvvvvvvvvv |
| 48 | 0 F |
| 49 | |
| 50 | oooo - form 3 opcode number |
| 51 | vvvvvvvvvv - 10-bit immediate value. */ |
| 52 | |
| 53 | const moxie_opc_info_t moxie_form1_opc_info[128] = |
| 54 | { |
| 55 | { 0x00, MOXIE_BAD, "bad" }, // Reserved as bad. |
| 56 | { 0x01, MOXIE_F1_A4, "ldi.l" }, |
| 57 | { 0x02, MOXIE_F1_AB, "mov" }, |
| 58 | { 0x03, MOXIE_F1_M, "jsra" }, |
| 59 | { 0x04, MOXIE_F1_NARG, "ret" }, |
| 60 | { 0x05, MOXIE_F1_AB, "add" }, |
| 61 | { 0x06, MOXIE_F1_AB, "push" }, |
| 62 | { 0x07, MOXIE_F1_AB, "pop" }, |
| 63 | { 0x08, MOXIE_F1_A4, "lda.l" }, |
| 64 | { 0x09, MOXIE_F1_4A, "sta.l" }, |
| 65 | { 0x0a, MOXIE_F1_ABi, "ld.l" }, |
| 66 | { 0x0b, MOXIE_F1_AiB, "st.l" }, |
| 67 | { 0x0c, MOXIE_F1_ABi2, "ldo.l" }, |
| 68 | { 0x0d, MOXIE_F1_AiB2, "sto.l" }, |
| 69 | { 0x0e, MOXIE_F1_AB, "cmp" }, |
| 70 | { 0x0f, MOXIE_F1_NARG, "nop" }, |
| 71 | { 0x10, MOXIE_F1_AB, "sex.b" }, |
| 72 | { 0x11, MOXIE_F1_AB, "sex.s" }, |
| 73 | { 0x12, MOXIE_F1_AB, "zex.b" }, |
| 74 | { 0x13, MOXIE_F1_AB, "zex.s" }, |
| 75 | { 0x14, MOXIE_F1_AB, "umul.x" }, |
| 76 | { 0x15, MOXIE_F1_AB, "mul.x" }, |
| 77 | { 0x16, MOXIE_BAD, "bad" }, |
| 78 | { 0x17, MOXIE_BAD, "bad" }, |
| 79 | { 0x18, MOXIE_BAD, "bad" }, |
| 80 | { 0x19, MOXIE_F1_A, "jsr" }, |
| 81 | { 0x1a, MOXIE_F1_M, "jmpa" }, |
| 82 | { 0x1b, MOXIE_F1_A4, "ldi.b" }, |
| 83 | { 0x1c, MOXIE_F1_ABi, "ld.b" }, |
| 84 | { 0x1d, MOXIE_F1_A4, "lda.b" }, |
| 85 | { 0x1e, MOXIE_F1_AiB, "st.b" }, |
| 86 | { 0x1f, MOXIE_F1_4A, "sta.b" }, |
| 87 | { 0x20, MOXIE_F1_A4, "ldi.s" }, |
| 88 | { 0x21, MOXIE_F1_ABi, "ld.s" }, |
| 89 | { 0x22, MOXIE_F1_A4, "lda.s" }, |
| 90 | { 0x23, MOXIE_F1_AiB, "st.s" }, |
| 91 | { 0x24, MOXIE_F1_4A, "sta.s" }, |
| 92 | { 0x25, MOXIE_F1_A, "jmp" }, |
| 93 | { 0x26, MOXIE_F1_AB, "and" }, |
| 94 | { 0x27, MOXIE_F1_AB, "lshr" }, |
| 95 | { 0x28, MOXIE_F1_AB, "ashl" }, |
| 96 | { 0x29, MOXIE_F1_AB, "sub" }, |
| 97 | { 0x2a, MOXIE_F1_AB, "neg" }, |
| 98 | { 0x2b, MOXIE_F1_AB, "or" }, |
| 99 | { 0x2c, MOXIE_F1_AB, "not" }, |
| 100 | { 0x2d, MOXIE_F1_AB, "ashr" }, |
| 101 | { 0x2e, MOXIE_F1_AB, "xor" }, |
| 102 | { 0x2f, MOXIE_F1_AB, "mul" }, |
| 103 | { 0x30, MOXIE_F1_4, "swi" }, |
| 104 | { 0x31, MOXIE_F1_AB, "div" }, |
| 105 | { 0x32, MOXIE_F1_AB, "udiv" }, |
| 106 | { 0x33, MOXIE_F1_AB, "mod" }, |
| 107 | { 0x34, MOXIE_F1_AB, "umod" }, |
| 108 | { 0x35, MOXIE_F1_NARG, "brk" }, |
| 109 | { 0x36, MOXIE_F1_ABi2, "ldo.b" }, |
| 110 | { 0x37, MOXIE_F1_AiB2, "sto.b" }, |
| 111 | { 0x38, MOXIE_F1_ABi2, "ldo.s" }, |
| 112 | { 0x39, MOXIE_F1_AiB2, "sto.s" }, |
| 113 | { 0x3a, MOXIE_BAD, "bad" }, |
| 114 | { 0x3b, MOXIE_BAD, "bad" }, |
| 115 | { 0x3c, MOXIE_BAD, "bad" }, |
| 116 | { 0x3d, MOXIE_BAD, "bad" }, |
| 117 | { 0x3e, MOXIE_BAD, "bad" }, |
| 118 | { 0x3f, MOXIE_BAD, "bad" }, |
| 119 | { 0x40, MOXIE_BAD, "bad" }, |
| 120 | { 0x41, MOXIE_BAD, "bad" }, |
| 121 | { 0x42, MOXIE_BAD, "bad" }, |
| 122 | { 0x43, MOXIE_BAD, "bad" }, |
| 123 | { 0x44, MOXIE_BAD, "bad" }, |
| 124 | { 0x45, MOXIE_BAD, "bad" }, |
| 125 | { 0x46, MOXIE_BAD, "bad" }, |
| 126 | { 0x47, MOXIE_BAD, "bad" }, |
| 127 | { 0x48, MOXIE_BAD, "bad" }, |
| 128 | { 0x49, MOXIE_BAD, "bad" }, |
| 129 | { 0x4a, MOXIE_BAD, "bad" }, |
| 130 | { 0x4b, MOXIE_BAD, "bad" }, |
| 131 | { 0x4c, MOXIE_BAD, "bad" }, |
| 132 | { 0x4d, MOXIE_BAD, "bad" }, |
| 133 | { 0x4e, MOXIE_BAD, "bad" }, |
| 134 | { 0x4f, MOXIE_BAD, "bad" }, |
| 135 | { 0x50, MOXIE_BAD, "bad" }, |
| 136 | { 0x51, MOXIE_BAD, "bad" }, |
| 137 | { 0x52, MOXIE_BAD, "bad" }, |
| 138 | { 0x53, MOXIE_BAD, "bad" }, |
| 139 | { 0x54, MOXIE_BAD, "bad" }, |
| 140 | { 0x55, MOXIE_BAD, "bad" }, |
| 141 | { 0x56, MOXIE_BAD, "bad" }, |
| 142 | { 0x57, MOXIE_BAD, "bad" }, |
| 143 | { 0x58, MOXIE_BAD, "bad" }, |
| 144 | { 0x59, MOXIE_BAD, "bad" }, |
| 145 | { 0x5a, MOXIE_BAD, "bad" }, |
| 146 | { 0x5b, MOXIE_BAD, "bad" }, |
| 147 | { 0x5c, MOXIE_BAD, "bad" }, |
| 148 | { 0x5d, MOXIE_BAD, "bad" }, |
| 149 | { 0x5e, MOXIE_BAD, "bad" }, |
| 150 | { 0x5f, MOXIE_BAD, "bad" }, |
| 151 | { 0x60, MOXIE_BAD, "bad" }, |
| 152 | { 0x61, MOXIE_BAD, "bad" }, |
| 153 | { 0x62, MOXIE_BAD, "bad" }, |
| 154 | { 0x63, MOXIE_BAD, "bad" }, |
| 155 | { 0x64, MOXIE_BAD, "bad" }, |
| 156 | { 0x65, MOXIE_BAD, "bad" }, |
| 157 | { 0x66, MOXIE_BAD, "bad" }, |
| 158 | { 0x67, MOXIE_BAD, "bad" }, |
| 159 | { 0x68, MOXIE_BAD, "bad" }, |
| 160 | { 0x69, MOXIE_BAD, "bad" }, |
| 161 | { 0x6a, MOXIE_BAD, "bad" }, |
| 162 | { 0x6b, MOXIE_BAD, "bad" }, |
| 163 | { 0x6c, MOXIE_BAD, "bad" }, |
| 164 | { 0x6d, MOXIE_BAD, "bad" }, |
| 165 | { 0x6e, MOXIE_BAD, "bad" }, |
| 166 | { 0x6f, MOXIE_BAD, "bad" }, |
| 167 | { 0x70, MOXIE_BAD, "bad" }, |
| 168 | { 0x71, MOXIE_BAD, "bad" }, |
| 169 | { 0x72, MOXIE_BAD, "bad" }, |
| 170 | { 0x73, MOXIE_BAD, "bad" }, |
| 171 | { 0x74, MOXIE_BAD, "bad" }, |
| 172 | { 0x75, MOXIE_BAD, "bad" }, |
| 173 | { 0x76, MOXIE_BAD, "bad" }, |
| 174 | { 0x77, MOXIE_BAD, "bad" }, |
| 175 | { 0x78, MOXIE_BAD, "bad" }, |
| 176 | { 0x79, MOXIE_BAD, "bad" }, |
| 177 | { 0x7a, MOXIE_BAD, "bad" }, |
| 178 | { 0x7b, MOXIE_BAD, "bad" }, |
| 179 | { 0x7c, MOXIE_BAD, "bad" }, |
| 180 | { 0x7d, MOXIE_BAD, "bad" }, |
| 181 | { 0x7e, MOXIE_BAD, "bad" }, |
| 182 | { 0x7f, MOXIE_BAD, "bad" } |
| 183 | }; |
| 184 | |
| 185 | const moxie_opc_info_t moxie_form2_opc_info[4] = |
| 186 | { |
| 187 | { 0x00, MOXIE_F2_A8V, "inc" }, |
| 188 | { 0x01, MOXIE_F2_A8V, "dec" }, |
| 189 | { 0x02, MOXIE_F2_A8V, "gsr" }, |
| 190 | { 0x03, MOXIE_F2_A8V, "ssr" } |
| 191 | }; |
| 192 | |
| 193 | const moxie_opc_info_t moxie_form3_opc_info[16] = |
| 194 | { |
| 195 | { 0x00, MOXIE_F3_PCREL,"beq" }, |
| 196 | { 0x01, MOXIE_F3_PCREL,"bne" }, |
| 197 | { 0x02, MOXIE_F3_PCREL,"blt" }, |
| 198 | { 0x03, MOXIE_F3_PCREL,"bgt" }, |
| 199 | { 0x04, MOXIE_F3_PCREL,"bltu" }, |
| 200 | { 0x05, MOXIE_F3_PCREL,"bgtu" }, |
| 201 | { 0x06, MOXIE_F3_PCREL,"bge" }, |
| 202 | { 0x07, MOXIE_F3_PCREL,"ble" }, |
| 203 | { 0x08, MOXIE_F3_PCREL,"bgeu" }, |
| 204 | { 0x09, MOXIE_F3_PCREL,"bleu" }, |
| 205 | { 0x0a, MOXIE_BAD, "bad" }, |
| 206 | { 0x0b, MOXIE_BAD, "bad" }, |
| 207 | { 0x0c, MOXIE_BAD, "bad" }, |
| 208 | { 0x0d, MOXIE_BAD, "bad" }, |
| 209 | { 0x0e, MOXIE_BAD, "bad" }, |
| 210 | { 0x0f, MOXIE_BAD, "bad" } // Reserved as bad. |
| 211 | }; |