]>
Commit | Line | Data |
---|---|---|
3d1d21b0 MH |
1 | /* d10v.h -- Header file for D10V opcode table |
2 | Copyright 1996 Free Software Foundation, Inc. | |
3 | Written by Martin Hunt (hunt@cygnus.com), Cygnus Support | |
4 | ||
5 | This file is part of GDB, GAS, and the GNU binutils. | |
6 | ||
7 | GDB, GAS, and the GNU binutils are free software; you can redistribute | |
8 | them and/or modify them under the terms of the GNU General Public | |
9 | License as published by the Free Software Foundation; either version | |
10 | 1, or (at your option) any later version. | |
11 | ||
12 | GDB, GAS, and the GNU binutils are distributed in the hope that they | |
13 | will be useful, but WITHOUT ANY WARRANTY; without even the implied | |
14 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | |
15 | the GNU General Public 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 Free | |
19 | Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
20 | ||
21 | #ifndef D10V_H | |
22 | #define D10V_H | |
23 | ||
24 | /* Format Specifier */ | |
25 | #define FM00 0 | |
26 | #define FM01 0x40000000 | |
27 | #define FM10 0x80000000 | |
28 | #define FM11 0xC0000000 | |
29 | ||
30 | #define NOP 0x5e00 | |
8da1e5a7 | 31 | #define OPCODE_DIVS 0x14002800 |
3d1d21b0 MH |
32 | |
33 | /* The opcode table is an array of struct d10v_opcode. */ | |
34 | ||
35 | struct d10v_opcode | |
36 | { | |
37 | /* The opcode name. */ | |
38 | const char *name; | |
39 | ||
40 | /* the opcode format */ | |
41 | int format; | |
42 | ||
8da1e5a7 | 43 | /* These numbers were picked so we can do if( i & SHORT_OPCODE) */ |
3d1d21b0 MH |
44 | #define SHORT_OPCODE 1 |
45 | #define LONG_OPCODE 8 | |
46 | #define SHORT_2 1 /* short with 2 operands */ | |
47 | #define SHORT_B 3 /* short with 8-bit branch */ | |
48 | #define LONG_B 8 /* long with 16-bit branch */ | |
49 | #define LONG_L 10 /* long with 3 operands */ | |
50 | #define LONG_R 12 /* reserved */ | |
51 | ||
8da1e5a7 MH |
52 | /* just a placeholder for variable-length instructions */ |
53 | /* for example, "bra" will be a fake for "bra.s" and bra.l" */ | |
54 | /* which will immediately follow in the opcode table. */ | |
55 | #define OPCODE_FAKE 32 | |
56 | ||
3d1d21b0 MH |
57 | /* the number of cycles */ |
58 | int cycles; | |
59 | ||
60 | /* the execution unit(s) used */ | |
61 | int unit; | |
62 | #define EITHER 0 | |
63 | #define IU 1 | |
64 | #define MU 2 | |
65 | #define BOTH 3 | |
66 | ||
67 | /* execution type; parallel or sequential */ | |
68 | int exec_type; | |
8da1e5a7 MH |
69 | #define PARONLY 1 /* parallel only */ |
70 | #define SEQ 2 /* must be sequential */ | |
71 | #define PAR 3 /* may be parallel */ | |
72 | #define BRANCH_LINK 4 /* subroutine call. sequential and aligned */ | |
3d1d21b0 MH |
73 | |
74 | /* the opcode */ | |
75 | long opcode; | |
76 | ||
77 | /* mask. if( (i & mask) == opcode ) then match */ | |
78 | long mask; | |
79 | ||
80 | /* An array of operand codes. Each code is an index into the | |
81 | operand table. They appear in the order which the operands must | |
82 | appear in assembly code, and are terminated by a zero. */ | |
83 | unsigned char operands[6]; | |
84 | }; | |
85 | ||
86 | /* The table itself is sorted by major opcode number, and is otherwise | |
87 | in the order in which the disassembler should consider | |
88 | instructions. */ | |
89 | extern const struct d10v_opcode d10v_opcodes[]; | |
90 | extern const int d10v_num_opcodes; | |
91 | ||
92 | /* The operands table is an array of struct d10v_operand. */ | |
93 | struct d10v_operand | |
94 | { | |
95 | /* The number of bits in the operand. */ | |
96 | int bits; | |
97 | ||
98 | /* How far the operand is left shifted in the instruction. */ | |
99 | int shift; | |
100 | ||
101 | /* One bit syntax flags. */ | |
102 | int flags; | |
103 | }; | |
104 | ||
105 | /* Elements in the table are retrieved by indexing with values from | |
106 | the operands field of the d10v_opcodes table. */ | |
107 | ||
108 | extern const struct d10v_operand d10v_operands[]; | |
109 | ||
110 | /* Values defined for the flags field of a struct d10v_operand. */ | |
111 | ||
112 | /* the operand must be an even number */ | |
113 | #define OPERAND_EVEN (1) | |
114 | ||
115 | /* the operand must be an odd number */ | |
116 | #define OPERAND_ODD (2) | |
117 | ||
118 | /* this is the destination register; it will be modified */ | |
119 | /* this is used by the optimizer */ | |
120 | #define OPERAND_DEST (4) | |
121 | ||
122 | /* number or symbol */ | |
123 | #define OPERAND_NUM (8) | |
124 | ||
125 | /* address or label */ | |
126 | #define OPERAND_ADDR (0x10) | |
127 | ||
128 | /* register */ | |
129 | #define OPERAND_REG (0x20) | |
130 | ||
131 | /* postincrement + */ | |
132 | #define OPERAND_PLUS (0x40) | |
133 | ||
134 | /* postdecrement - */ | |
135 | #define OPERAND_MINUS (0x80) | |
136 | ||
137 | /* @ */ | |
138 | #define OPERAND_ATSIGN (0x100) | |
139 | ||
140 | /* @( */ | |
141 | #define OPERAND_ATPAR (0x200) | |
142 | ||
143 | /* accumulator */ | |
144 | #define OPERAND_ACC (0x400) | |
145 | ||
146 | /* flag register */ | |
147 | #define OPERAND_FLAG (0x800) | |
148 | ||
149 | /* control register */ | |
150 | #define OPERAND_CONTROL (0x1000) | |
151 | ||
152 | /* predecrement mode '@-sp' */ | |
153 | #define OPERAND_ATMINUS (0x2000) | |
154 | ||
8da1e5a7 MH |
155 | /* signed number */ |
156 | #define OPERAND_SIGNED (0x4000) | |
157 | ||
c38655b9 MH |
158 | /* Structure to hold information about predefined registers. */ |
159 | struct pd_reg | |
160 | { | |
161 | char *name; /* name to recognize */ | |
162 | char *pname; /* name to print for this register */ | |
163 | int value; | |
164 | }; | |
165 | ||
166 | extern const struct pd_reg pre_defined_registers[]; | |
167 | int reg_name_cnt(); | |
168 | ||
169 | /* an expressionS only has one register type, so we fake it */ | |
170 | /* by setting high bits to indicate type */ | |
171 | #define REGISTER_MASK 0xFF | |
172 | ||
3d1d21b0 | 173 | #endif /* D10V_H */ |