xref: /openbsd-src/gnu/usr.bin/binutils/opcodes/openrisc-desc.h (revision cf2f2c5620d6d9a4fd01930983c4b9a1f76d7aa3)
1d2201f2fSdrahn /* CPU data header for openrisc.
2d2201f2fSdrahn 
3d2201f2fSdrahn THIS FILE IS MACHINE GENERATED WITH CGEN.
4d2201f2fSdrahn 
5d2201f2fSdrahn Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
6d2201f2fSdrahn 
7d2201f2fSdrahn This file is part of the GNU Binutils and/or GDB, the GNU debugger.
8d2201f2fSdrahn 
9d2201f2fSdrahn This program is free software; you can redistribute it and/or modify
10d2201f2fSdrahn it under the terms of the GNU General Public License as published by
11d2201f2fSdrahn the Free Software Foundation; either version 2, or (at your option)
12d2201f2fSdrahn any later version.
13d2201f2fSdrahn 
14d2201f2fSdrahn This program is distributed in the hope that it will be useful,
15d2201f2fSdrahn but WITHOUT ANY WARRANTY; without even the implied warranty of
16d2201f2fSdrahn MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17d2201f2fSdrahn GNU General Public License for more details.
18d2201f2fSdrahn 
19d2201f2fSdrahn You should have received a copy of the GNU General Public License along
20d2201f2fSdrahn with this program; if not, write to the Free Software Foundation, Inc.,
21d2201f2fSdrahn 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22d2201f2fSdrahn 
23d2201f2fSdrahn */
24d2201f2fSdrahn 
25d2201f2fSdrahn #ifndef OPENRISC_CPU_H
26d2201f2fSdrahn #define OPENRISC_CPU_H
27d2201f2fSdrahn 
28d2201f2fSdrahn #define CGEN_ARCH openrisc
29d2201f2fSdrahn 
30d2201f2fSdrahn /* Given symbol S, return openrisc_cgen_<S>.  */
31d2201f2fSdrahn #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
32d2201f2fSdrahn #define CGEN_SYM(s) openrisc##_cgen_##s
33d2201f2fSdrahn #else
34d2201f2fSdrahn #define CGEN_SYM(s) openrisc/**/_cgen_/**/s
35d2201f2fSdrahn #endif
36d2201f2fSdrahn 
37d2201f2fSdrahn 
38d2201f2fSdrahn /* Selected cpu families.  */
39d2201f2fSdrahn #define HAVE_CPU_OPENRISCBF
40d2201f2fSdrahn 
41d2201f2fSdrahn #define CGEN_INSN_LSB0_P 1
42d2201f2fSdrahn 
43d2201f2fSdrahn /* Minimum size of any insn (in bytes).  */
44d2201f2fSdrahn #define CGEN_MIN_INSN_SIZE 4
45d2201f2fSdrahn 
46d2201f2fSdrahn /* Maximum size of any insn (in bytes).  */
47d2201f2fSdrahn #define CGEN_MAX_INSN_SIZE 4
48d2201f2fSdrahn 
49d2201f2fSdrahn #define CGEN_INT_INSN_P 1
50d2201f2fSdrahn 
51d2201f2fSdrahn /* Maximum number of syntax elements in an instruction.  */
52d2201f2fSdrahn #define CGEN_ACTUAL_MAX_SYNTAX_ELEMENTS 14
53d2201f2fSdrahn 
54d2201f2fSdrahn /* CGEN_MNEMONIC_OPERANDS is defined if mnemonics have operands.
55d2201f2fSdrahn    e.g. In "b,a foo" the ",a" is an operand.  If mnemonics have operands
56d2201f2fSdrahn    we can't hash on everything up to the space.  */
57d2201f2fSdrahn #define CGEN_MNEMONIC_OPERANDS
58d2201f2fSdrahn 
59d2201f2fSdrahn /* Maximum number of fields in an instruction.  */
60d2201f2fSdrahn #define CGEN_ACTUAL_MAX_IFMT_OPERANDS 9
61d2201f2fSdrahn 
62d2201f2fSdrahn /* Enums.  */
63d2201f2fSdrahn 
64d2201f2fSdrahn /* Enum declaration for exception vectors.  */
65d2201f2fSdrahn typedef enum e_exception {
66d2201f2fSdrahn   E_RESET, E_BUSERR, E_DPF, E_IPF
67d2201f2fSdrahn  , E_EXTINT, E_ALIGN, E_ILLEGAL, E_PEINT
68d2201f2fSdrahn  , E_DTLBMISS, E_ITLBMISS, E_RRANGE, E_SYSCALL
69d2201f2fSdrahn  , E_BREAK, E_RESERVED
70d2201f2fSdrahn } E_EXCEPTION;
71d2201f2fSdrahn 
72d2201f2fSdrahn /* Enum declaration for FIXME.  */
73d2201f2fSdrahn typedef enum insn_class {
74d2201f2fSdrahn   OP1_0, OP1_1, OP1_2, OP1_3
75d2201f2fSdrahn } INSN_CLASS;
76d2201f2fSdrahn 
77d2201f2fSdrahn /* Enum declaration for FIXME.  */
78d2201f2fSdrahn typedef enum insn_sub {
79d2201f2fSdrahn   OP2_0, OP2_1, OP2_2, OP2_3
80d2201f2fSdrahn  , OP2_4, OP2_5, OP2_6, OP2_7
81d2201f2fSdrahn  , OP2_8, OP2_9, OP2_10, OP2_11
82d2201f2fSdrahn  , OP2_12, OP2_13, OP2_14, OP2_15
83d2201f2fSdrahn } INSN_SUB;
84d2201f2fSdrahn 
85d2201f2fSdrahn /* Enum declaration for FIXME.  */
86d2201f2fSdrahn typedef enum insn_op3 {
87d2201f2fSdrahn   OP3_0, OP3_1, OP3_2, OP3_3
88d2201f2fSdrahn } INSN_OP3;
89d2201f2fSdrahn 
90d2201f2fSdrahn /* Enum declaration for FIXME.  */
91d2201f2fSdrahn typedef enum insn_op4 {
92d2201f2fSdrahn   OP4_0, OP4_1, OP4_2, OP4_3
93d2201f2fSdrahn  , OP4_4, OP4_5, OP4_6, OP4_7
94d2201f2fSdrahn } INSN_OP4;
95d2201f2fSdrahn 
96d2201f2fSdrahn /* Enum declaration for FIXME.  */
97d2201f2fSdrahn typedef enum insn_op5 {
98d2201f2fSdrahn   OP5_0, OP5_1, OP5_2, OP5_3
99d2201f2fSdrahn  , OP5_4, OP5_5, OP5_6, OP5_7
100d2201f2fSdrahn  , OP5_8, OP5_9, OP5_10, OP5_11
101d2201f2fSdrahn  , OP5_12, OP5_13, OP5_14, OP5_15
102d2201f2fSdrahn  , OP5_16, OP5_17, OP5_18, OP5_19
103d2201f2fSdrahn  , OP5_20, OP5_21, OP5_22, OP5_23
104d2201f2fSdrahn  , OP5_24, OP5_25, OP5_26, OP5_27
105d2201f2fSdrahn  , OP5_28, OP5_29, OP5_30, OP5_31
106d2201f2fSdrahn } INSN_OP5;
107d2201f2fSdrahn 
108d2201f2fSdrahn /* Enum declaration for FIXME.  */
109d2201f2fSdrahn typedef enum insn_op6 {
110d2201f2fSdrahn   OP6_0, OP6_1, OP6_2, OP6_3
111d2201f2fSdrahn  , OP6_4, OP6_5, OP6_6, OP6_7
112d2201f2fSdrahn } INSN_OP6;
113d2201f2fSdrahn 
114d2201f2fSdrahn /* Enum declaration for FIXME.  */
115d2201f2fSdrahn typedef enum insn_op7 {
116d2201f2fSdrahn   OP7_0, OP7_1, OP7_2, OP7_3
117d2201f2fSdrahn  , OP7_4, OP7_5, OP7_6, OP7_7
118d2201f2fSdrahn  , OP7_8, OP7_9, OP7_10, OP7_11
119d2201f2fSdrahn  , OP7_12, OP7_13, OP7_14, OP7_15
120d2201f2fSdrahn } INSN_OP7;
121d2201f2fSdrahn 
122d2201f2fSdrahn /* Attributes.  */
123d2201f2fSdrahn 
124d2201f2fSdrahn /* Enum declaration for machine type selection.  */
125d2201f2fSdrahn typedef enum mach_attr {
126d2201f2fSdrahn   MACH_BASE, MACH_OPENRISC, MACH_OR1300, MACH_MAX
127d2201f2fSdrahn } MACH_ATTR;
128d2201f2fSdrahn 
129d2201f2fSdrahn /* Enum declaration for instruction set selection.  */
130d2201f2fSdrahn typedef enum isa_attr {
131d2201f2fSdrahn   ISA_OR32, ISA_MAX
132d2201f2fSdrahn } ISA_ATTR;
133d2201f2fSdrahn 
134d2201f2fSdrahn /* Enum declaration for if this model has caches.  */
135d2201f2fSdrahn typedef enum has_cache_attr {
136d2201f2fSdrahn   HAS_CACHE_DATA_CACHE, HAS_CACHE_INSN_CACHE
137d2201f2fSdrahn } HAS_CACHE_ATTR;
138d2201f2fSdrahn 
139d2201f2fSdrahn /* Number of architecture variants.  */
140d2201f2fSdrahn #define MAX_ISAS  1
141d2201f2fSdrahn #define MAX_MACHS ((int) MACH_MAX)
142d2201f2fSdrahn 
143d2201f2fSdrahn /* Ifield support.  */
144d2201f2fSdrahn 
145d2201f2fSdrahn extern const struct cgen_ifld openrisc_cgen_ifld_table[];
146d2201f2fSdrahn 
147d2201f2fSdrahn /* Ifield attribute indices.  */
148d2201f2fSdrahn 
149d2201f2fSdrahn /* Enum declaration for cgen_ifld attrs.  */
150d2201f2fSdrahn typedef enum cgen_ifld_attr {
151d2201f2fSdrahn   CGEN_IFLD_VIRTUAL, CGEN_IFLD_PCREL_ADDR, CGEN_IFLD_ABS_ADDR, CGEN_IFLD_RESERVED
152d2201f2fSdrahn  , CGEN_IFLD_SIGN_OPT, CGEN_IFLD_SIGNED, CGEN_IFLD_END_BOOLS, CGEN_IFLD_START_NBOOLS = 31
153d2201f2fSdrahn  , CGEN_IFLD_MACH, CGEN_IFLD_END_NBOOLS
154d2201f2fSdrahn } CGEN_IFLD_ATTR;
155d2201f2fSdrahn 
156d2201f2fSdrahn /* Number of non-boolean elements in cgen_ifld_attr.  */
157d2201f2fSdrahn #define CGEN_IFLD_NBOOL_ATTRS (CGEN_IFLD_END_NBOOLS - CGEN_IFLD_START_NBOOLS - 1)
158d2201f2fSdrahn 
159d2201f2fSdrahn /* Enum declaration for openrisc ifield types.  */
160d2201f2fSdrahn typedef enum ifield_type {
161d2201f2fSdrahn   OPENRISC_F_NIL, OPENRISC_F_ANYOF, OPENRISC_F_CLASS, OPENRISC_F_SUB
162d2201f2fSdrahn  , OPENRISC_F_R1, OPENRISC_F_R2, OPENRISC_F_R3, OPENRISC_F_SIMM16
163d2201f2fSdrahn  , OPENRISC_F_UIMM16, OPENRISC_F_UIMM5, OPENRISC_F_HI16, OPENRISC_F_LO16
164d2201f2fSdrahn  , OPENRISC_F_OP1, OPENRISC_F_OP2, OPENRISC_F_OP3, OPENRISC_F_OP4
165d2201f2fSdrahn  , OPENRISC_F_OP5, OPENRISC_F_OP6, OPENRISC_F_OP7, OPENRISC_F_I16_1
166d2201f2fSdrahn  , OPENRISC_F_I16_2, OPENRISC_F_DISP26, OPENRISC_F_ABS26, OPENRISC_F_I16NC
167d2201f2fSdrahn  , OPENRISC_F_F_15_8, OPENRISC_F_F_10_3, OPENRISC_F_F_4_1, OPENRISC_F_F_7_3
168d2201f2fSdrahn  , OPENRISC_F_F_10_7, OPENRISC_F_F_10_11, OPENRISC_F_MAX
169d2201f2fSdrahn } IFIELD_TYPE;
170d2201f2fSdrahn 
171d2201f2fSdrahn #define MAX_IFLD ((int) OPENRISC_F_MAX)
172d2201f2fSdrahn 
173d2201f2fSdrahn /* Hardware attribute indices.  */
174d2201f2fSdrahn 
175d2201f2fSdrahn /* Enum declaration for cgen_hw attrs.  */
176d2201f2fSdrahn typedef enum cgen_hw_attr {
177d2201f2fSdrahn   CGEN_HW_VIRTUAL, CGEN_HW_CACHE_ADDR, CGEN_HW_PC, CGEN_HW_PROFILE
178d2201f2fSdrahn  , CGEN_HW_END_BOOLS, CGEN_HW_START_NBOOLS = 31, CGEN_HW_MACH, CGEN_HW_END_NBOOLS
179d2201f2fSdrahn } CGEN_HW_ATTR;
180d2201f2fSdrahn 
181d2201f2fSdrahn /* Number of non-boolean elements in cgen_hw_attr.  */
182d2201f2fSdrahn #define CGEN_HW_NBOOL_ATTRS (CGEN_HW_END_NBOOLS - CGEN_HW_START_NBOOLS - 1)
183d2201f2fSdrahn 
184d2201f2fSdrahn /* Enum declaration for openrisc hardware types.  */
185d2201f2fSdrahn typedef enum cgen_hw_type {
186d2201f2fSdrahn   HW_H_MEMORY, HW_H_SINT, HW_H_UINT, HW_H_ADDR
187d2201f2fSdrahn  , HW_H_IADDR, HW_H_PC, HW_H_GR, HW_H_SR
188d2201f2fSdrahn  , HW_H_HI16, HW_H_LO16, HW_H_CBIT, HW_H_DELAY_INSN
189d2201f2fSdrahn  , HW_MAX
190d2201f2fSdrahn } CGEN_HW_TYPE;
191d2201f2fSdrahn 
192d2201f2fSdrahn #define MAX_HW ((int) HW_MAX)
193d2201f2fSdrahn 
194d2201f2fSdrahn /* Operand attribute indices.  */
195d2201f2fSdrahn 
196d2201f2fSdrahn /* Enum declaration for cgen_operand attrs.  */
197d2201f2fSdrahn typedef enum cgen_operand_attr {
198d2201f2fSdrahn   CGEN_OPERAND_VIRTUAL, CGEN_OPERAND_PCREL_ADDR, CGEN_OPERAND_ABS_ADDR, CGEN_OPERAND_SIGN_OPT
199d2201f2fSdrahn  , CGEN_OPERAND_SIGNED, CGEN_OPERAND_NEGATIVE, CGEN_OPERAND_RELAX, CGEN_OPERAND_SEM_ONLY
200d2201f2fSdrahn  , CGEN_OPERAND_END_BOOLS, CGEN_OPERAND_START_NBOOLS = 31, CGEN_OPERAND_MACH, CGEN_OPERAND_END_NBOOLS
201d2201f2fSdrahn } CGEN_OPERAND_ATTR;
202d2201f2fSdrahn 
203d2201f2fSdrahn /* Number of non-boolean elements in cgen_operand_attr.  */
204d2201f2fSdrahn #define CGEN_OPERAND_NBOOL_ATTRS (CGEN_OPERAND_END_NBOOLS - CGEN_OPERAND_START_NBOOLS - 1)
205d2201f2fSdrahn 
206d2201f2fSdrahn /* Enum declaration for openrisc operand types.  */
207d2201f2fSdrahn typedef enum cgen_operand_type {
208d2201f2fSdrahn   OPENRISC_OPERAND_PC, OPENRISC_OPERAND_SR, OPENRISC_OPERAND_CBIT, OPENRISC_OPERAND_SIMM_16
209d2201f2fSdrahn  , OPENRISC_OPERAND_UIMM_16, OPENRISC_OPERAND_DISP_26, OPENRISC_OPERAND_ABS_26, OPENRISC_OPERAND_UIMM_5
210d2201f2fSdrahn  , OPENRISC_OPERAND_RD, OPENRISC_OPERAND_RA, OPENRISC_OPERAND_RB, OPENRISC_OPERAND_OP_F_23
211d2201f2fSdrahn  , OPENRISC_OPERAND_OP_F_3, OPENRISC_OPERAND_HI16, OPENRISC_OPERAND_LO16, OPENRISC_OPERAND_UI16NC
212d2201f2fSdrahn  , OPENRISC_OPERAND_MAX
213d2201f2fSdrahn } CGEN_OPERAND_TYPE;
214d2201f2fSdrahn 
215d2201f2fSdrahn /* Number of operands types.  */
216d2201f2fSdrahn #define MAX_OPERANDS 16
217d2201f2fSdrahn 
218d2201f2fSdrahn /* Maximum number of operands referenced by any insn.  */
219d2201f2fSdrahn #define MAX_OPERAND_INSTANCES 8
220d2201f2fSdrahn 
221d2201f2fSdrahn /* Insn attribute indices.  */
222d2201f2fSdrahn 
223d2201f2fSdrahn /* Enum declaration for cgen_insn attrs.  */
224d2201f2fSdrahn typedef enum cgen_insn_attr {
225d2201f2fSdrahn   CGEN_INSN_ALIAS, CGEN_INSN_VIRTUAL, CGEN_INSN_UNCOND_CTI, CGEN_INSN_COND_CTI
226*cf2f2c56Smiod  , CGEN_INSN_SKIP_CTI, CGEN_INSN_DELAY_SLOT, CGEN_INSN_RELAXABLE, CGEN_INSN_RELAXED
227d2201f2fSdrahn  , CGEN_INSN_NO_DIS, CGEN_INSN_PBB, CGEN_INSN_NOT_IN_DELAY_SLOT, CGEN_INSN_END_BOOLS
228d2201f2fSdrahn  , CGEN_INSN_START_NBOOLS = 31, CGEN_INSN_MACH, CGEN_INSN_END_NBOOLS
229d2201f2fSdrahn } CGEN_INSN_ATTR;
230d2201f2fSdrahn 
231d2201f2fSdrahn /* Number of non-boolean elements in cgen_insn_attr.  */
232d2201f2fSdrahn #define CGEN_INSN_NBOOL_ATTRS (CGEN_INSN_END_NBOOLS - CGEN_INSN_START_NBOOLS - 1)
233d2201f2fSdrahn 
234d2201f2fSdrahn /* cgen.h uses things we just defined.  */
235d2201f2fSdrahn #include "opcode/cgen.h"
236d2201f2fSdrahn 
237d2201f2fSdrahn /* Attributes.  */
238d2201f2fSdrahn extern const CGEN_ATTR_TABLE openrisc_cgen_hardware_attr_table[];
239d2201f2fSdrahn extern const CGEN_ATTR_TABLE openrisc_cgen_ifield_attr_table[];
240d2201f2fSdrahn extern const CGEN_ATTR_TABLE openrisc_cgen_operand_attr_table[];
241d2201f2fSdrahn extern const CGEN_ATTR_TABLE openrisc_cgen_insn_attr_table[];
242d2201f2fSdrahn 
243d2201f2fSdrahn /* Hardware decls.  */
244d2201f2fSdrahn 
245d2201f2fSdrahn extern CGEN_KEYWORD openrisc_cgen_opval_h_gr;
246d2201f2fSdrahn 
247d2201f2fSdrahn 
248d2201f2fSdrahn 
249d2201f2fSdrahn 
250d2201f2fSdrahn #endif /* OPENRISC_CPU_H */
251