xref: /netbsd-src/external/gpl3/gdb.old/dist/include/opcode/mn10200.h (revision 8b657b0747480f8989760d71343d6dd33f8d4cf9)
1a5a4af3bSchristos /* mn10200.h -- Header file for Matsushita 10200 opcode table
2*8b657b07Schristos    Copyright (C) 1996-2022 Free Software Foundation, Inc.
3a5a4af3bSchristos    Written by Jeff Law, Cygnus Support
4a5a4af3bSchristos 
5a5a4af3bSchristos    This file is part of GDB, GAS, and the GNU binutils.
6a5a4af3bSchristos 
7a5a4af3bSchristos    GDB, GAS, and the GNU binutils are free software; you can redistribute
8a5a4af3bSchristos    them and/or modify them under the terms of the GNU General Public
9a5a4af3bSchristos    License as published by the Free Software Foundation; either version 3,
10a5a4af3bSchristos    or (at your option) any later version.
11a5a4af3bSchristos 
12a5a4af3bSchristos    GDB, GAS, and the GNU binutils are distributed in the hope that they
13a5a4af3bSchristos    will be useful, but WITHOUT ANY WARRANTY; without even the implied
14a5a4af3bSchristos    warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
15a5a4af3bSchristos    the GNU General Public License for more details.
16a5a4af3bSchristos 
17a5a4af3bSchristos    You should have received a copy of the GNU General Public License
18a5a4af3bSchristos    along with this file; see the file COPYING3.  If not, write to the Free
19a5a4af3bSchristos    Software Foundation, 51 Franklin Street - Fifth Floor, Boston,
20a5a4af3bSchristos    MA 02110-1301, USA.  */
21a5a4af3bSchristos 
22a5a4af3bSchristos #ifndef MN10200_H
23a5a4af3bSchristos #define MN10200_H
24a5a4af3bSchristos 
25a5a4af3bSchristos /* The opcode table is an array of struct mn10200_opcode.  */
26a5a4af3bSchristos 
27a5a4af3bSchristos struct mn10200_opcode
28a5a4af3bSchristos {
29a5a4af3bSchristos   /* The opcode name.  */
30a5a4af3bSchristos   const char *name;
31a5a4af3bSchristos 
32a5a4af3bSchristos   /* The opcode itself.  Those bits which will be filled in with
33a5a4af3bSchristos      operands are zeroes.  */
34a5a4af3bSchristos   unsigned long opcode;
35a5a4af3bSchristos 
36a5a4af3bSchristos   /* The opcode mask.  This is used by the disassembler.  This is a
37a5a4af3bSchristos      mask containing ones indicating those bits which must match the
38a5a4af3bSchristos      opcode field, and zeroes indicating those bits which need not
39a5a4af3bSchristos      match (and are presumably filled in by operands).  */
40a5a4af3bSchristos   unsigned long mask;
41a5a4af3bSchristos 
42a5a4af3bSchristos   /* The format of this opcode.  */
43a5a4af3bSchristos   unsigned char format;
44a5a4af3bSchristos 
45a5a4af3bSchristos   /* An array of operand codes.  Each code is an index into the
46a5a4af3bSchristos      operand table.  They appear in the order which the operands must
47a5a4af3bSchristos      appear in assembly code, and are terminated by a zero.  */
48a5a4af3bSchristos   unsigned char operands[8];
49a5a4af3bSchristos };
50a5a4af3bSchristos 
51a5a4af3bSchristos /* The table itself is sorted by major opcode number, and is otherwise
52a5a4af3bSchristos    in the order in which the disassembler should consider
53a5a4af3bSchristos    instructions.  */
54a5a4af3bSchristos extern const struct mn10200_opcode mn10200_opcodes[];
55a5a4af3bSchristos extern const int mn10200_num_opcodes;
56a5a4af3bSchristos 
57a5a4af3bSchristos 
58a5a4af3bSchristos /* The operands table is an array of struct mn10200_operand.  */
59a5a4af3bSchristos 
60a5a4af3bSchristos struct mn10200_operand
61a5a4af3bSchristos {
62a5a4af3bSchristos   /* The number of bits in the operand.  */
63a5a4af3bSchristos   int bits;
64a5a4af3bSchristos 
65a5a4af3bSchristos   /* How far the operand is left shifted in the instruction.  */
66a5a4af3bSchristos   int shift;
67a5a4af3bSchristos 
68a5a4af3bSchristos   /* One bit syntax flags.  */
69a5a4af3bSchristos   int flags;
70a5a4af3bSchristos };
71a5a4af3bSchristos 
72a5a4af3bSchristos /* Elements in the table are retrieved by indexing with values from
73a5a4af3bSchristos    the operands field of the mn10200_opcodes table.  */
74a5a4af3bSchristos 
75a5a4af3bSchristos extern const struct mn10200_operand mn10200_operands[];
76a5a4af3bSchristos 
77a5a4af3bSchristos /* Values defined for the flags field of a struct mn10200_operand.  */
78a5a4af3bSchristos #define MN10200_OPERAND_DREG 0x1
79a5a4af3bSchristos 
80a5a4af3bSchristos #define MN10200_OPERAND_AREG 0x2
81a5a4af3bSchristos 
82a5a4af3bSchristos #define MN10200_OPERAND_PSW 0x4
83a5a4af3bSchristos 
84a5a4af3bSchristos #define MN10200_OPERAND_MDR 0x8
85a5a4af3bSchristos 
86a5a4af3bSchristos #define MN10200_OPERAND_SIGNED 0x10
87a5a4af3bSchristos 
88a5a4af3bSchristos #define MN10200_OPERAND_PROMOTE 0x20
89a5a4af3bSchristos 
90a5a4af3bSchristos #define MN10200_OPERAND_PAREN 0x40
91a5a4af3bSchristos 
92a5a4af3bSchristos #define MN10200_OPERAND_REPEATED 0x80
93a5a4af3bSchristos 
94a5a4af3bSchristos #define MN10200_OPERAND_EXTENDED 0x100
95a5a4af3bSchristos 
96a5a4af3bSchristos #define MN10200_OPERAND_NOCHECK 0x200
97a5a4af3bSchristos 
98a5a4af3bSchristos #define MN10200_OPERAND_PCREL 0x400
99a5a4af3bSchristos 
100a5a4af3bSchristos #define MN10200_OPERAND_MEMADDR 0x800
101a5a4af3bSchristos 
102a5a4af3bSchristos #define MN10200_OPERAND_RELAX 0x1000
103a5a4af3bSchristos 
104a5a4af3bSchristos #define FMT_1 1
105a5a4af3bSchristos #define FMT_2 2
106a5a4af3bSchristos #define FMT_3 3
107a5a4af3bSchristos #define FMT_4 4
108a5a4af3bSchristos #define FMT_5 5
109a5a4af3bSchristos #define FMT_6 6
110a5a4af3bSchristos #define FMT_7 7
111a5a4af3bSchristos #endif /* MN10200_H */
112