bfd:
[binutils.git] / opcodes / moxie-opc.c
blobb493d1fb36f414b10c1cc3ed8712f8f8f1445ef4
1 /* moxie-opc.c -- Definitions for moxie opcodes.
2 Copyright 2009 Free Software Foundation, Inc.
3 Contributed by Anthony Green (green@moxielogic.com).
5 This file is part of the GNU opcodes library.
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.
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.
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. */
22 #include "sysdep.h"
23 #include "opcode/moxie.h"
25 /* The moxie processor's 16-bit instructions come in two forms:
27 FORM 1 instructions start with a 0 bit...
29 0oooooooaaaabbbb
30 0 F
32 ooooooo - form 1 opcode number
33 aaaa - operand A
34 bbbb - operand B
36 FORM 2 instructions start with bits "10"...
38 10ooaaaavvvvvvvv
39 0 F
41 oo - form 2 opcode number
42 aaaa - operand A
43 vvvvvvvv - 8-bit immediate value
45 FORM 3 instructions start with a bits "11"...
47 11oooovvvvvvvvvv
48 0 F
50 oooo - form 3 opcode number
51 vvvvvvvvvv - 10-bit immediate value. */
53 /* Note that currently two opcodes are reserved as bad, so that all
54 instructions starting with 0x00 and 0xff fault. */
56 const moxie_opc_info_t moxie_form1_opc_info[64] =
58 { 0x00, MOXIE_F1_NARG, "bad" }, // Reserved as bad.
59 { 0x01, MOXIE_F1_A4, "ldi.l" },
60 { 0x02, MOXIE_F1_AB, "mov" },
61 { 0x03, MOXIE_F1_M, "jsra" },
62 { 0x04, MOXIE_F1_NARG, "ret" },
63 { 0x05, MOXIE_F1_AB, "add.l" },
64 { 0x06, MOXIE_F1_AB, "push" },
65 { 0x07, MOXIE_F1_AB, "pop" },
66 { 0x08, MOXIE_F1_A4, "lda.l" },
67 { 0x09, MOXIE_F1_4A, "sta.l" },
68 { 0x0a, MOXIE_F1_ABi, "ld.l" },
69 { 0x0b, MOXIE_F1_AiB, "st.l" },
70 { 0x0c, MOXIE_F1_ABi4, "ldo.l" },
71 { 0x0d, MOXIE_F1_AiB4, "sto.l" },
72 { 0x0e, MOXIE_F1_AB, "cmp" },
73 { 0x0f, MOXIE_F1_NARG, "nop" },
74 { 0x10, MOXIE_F1_NARG, "bad" },
75 { 0x11, MOXIE_F1_NARG, "bad" },
76 { 0x12, MOXIE_F1_NARG, "bad" },
77 { 0x13, MOXIE_F1_NARG, "bad" },
78 { 0x14, MOXIE_F1_NARG, "bad" },
79 { 0x15, MOXIE_F1_NARG, "bad" },
80 { 0x16, MOXIE_F1_NARG, "bad" },
81 { 0x17, MOXIE_F1_NARG, "bad" },
82 { 0x18, MOXIE_F1_NARG, "bad" },
83 { 0x19, MOXIE_F1_A, "jsr" },
84 { 0x1a, MOXIE_F1_M, "jmpa" },
85 { 0x1b, MOXIE_F1_A4, "ldi.b" },
86 { 0x1c, MOXIE_F1_ABi, "ld.b" },
87 { 0x1d, MOXIE_F1_A4, "lda.b" },
88 { 0x1e, MOXIE_F1_AiB, "st.b" },
89 { 0x1f, MOXIE_F1_4A, "sta.b" },
90 { 0x20, MOXIE_F1_A4, "ldi.s" },
91 { 0x21, MOXIE_F1_ABi, "ld.s" },
92 { 0x22, MOXIE_F1_A4, "lda.s" },
93 { 0x23, MOXIE_F1_AiB, "st.s" },
94 { 0x24, MOXIE_F1_4A, "sta.s" },
95 { 0x25, MOXIE_F1_A, "jmp" },
96 { 0x26, MOXIE_F1_AB, "and" },
97 { 0x27, MOXIE_F1_AB, "lshr" },
98 { 0x28, MOXIE_F1_AB, "ashl" },
99 { 0x29, MOXIE_F1_AB, "sub.l" },
100 { 0x2a, MOXIE_F1_AB, "neg" },
101 { 0x2b, MOXIE_F1_AB, "or" },
102 { 0x2c, MOXIE_F1_AB, "not" },
103 { 0x2d, MOXIE_F1_AB, "ashr" },
104 { 0x2e, MOXIE_F1_AB, "xor" },
105 { 0x2f, MOXIE_F1_AB, "mul.l" },
106 { 0x30, MOXIE_F1_4, "swi" },
107 { 0x31, MOXIE_F1_AB, "div.l" },
108 { 0x32, MOXIE_F1_AB, "udiv.l" },
109 { 0x33, MOXIE_F1_AB, "mod.l" },
110 { 0x34, MOXIE_F1_AB, "umod.l" },
111 { 0x35, MOXIE_F1_NARG, "brk" },
112 { 0x36, MOXIE_F1_ABi4, "ldo.b" },
113 { 0x37, MOXIE_F1_AiB4, "sto.b" },
114 { 0x38, MOXIE_F1_ABi4, "ldo.s" },
115 { 0x39, MOXIE_F1_AiB4, "sto.s" },
116 { 0x3a, MOXIE_F1_NARG, "bad" },
117 { 0x3b, MOXIE_F1_NARG, "bad" },
118 { 0x3c, MOXIE_F1_NARG, "bad" },
119 { 0x3d, MOXIE_F1_NARG, "bad" },
120 { 0x3e, MOXIE_F1_NARG, "bad" },
121 { 0x3f, MOXIE_F1_NARG, "bad" }
124 const moxie_opc_info_t moxie_form2_opc_info[4] =
126 { 0x00, MOXIE_F2_A8V, "inc" },
127 { 0x01, MOXIE_F2_A8V, "dec" },
128 { 0x02, MOXIE_F2_A8V, "gsr" },
129 { 0x03, MOXIE_F2_A8V, "ssr" }
132 const moxie_opc_info_t moxie_form3_opc_info[16] =
134 { 0x00, MOXIE_F3_PCREL,"beq" },
135 { 0x01, MOXIE_F3_PCREL,"bne" },
136 { 0x02, MOXIE_F3_PCREL,"blt" },
137 { 0x03, MOXIE_F3_PCREL,"bgt" },
138 { 0x04, MOXIE_F3_PCREL,"bltu" },
139 { 0x05, MOXIE_F3_PCREL,"bgtu" },
140 { 0x06, MOXIE_F3_PCREL,"bge" },
141 { 0x07, MOXIE_F3_PCREL,"ble" },
142 { 0x08, MOXIE_F3_PCREL,"bgeu" },
143 { 0x09, MOXIE_F3_PCREL,"bleu" },
144 { 0x0a, MOXIE_F3_NARG, "bad" },
145 { 0x0b, MOXIE_F3_NARG, "bad" },
146 { 0x0c, MOXIE_F3_NARG, "bad" },
147 { 0x0d, MOXIE_F3_NARG, "bad" },
148 { 0x0e, MOXIE_F3_NARG, "bad" },
149 { 0x0f, MOXIE_F3_NARG, "bad" } // Reserved as bad.