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