1 |
1181 |
sfurman |
/* Table of opcodes for the OpenRISC 1000 ISA.
|
2 |
1183 |
sfurman |
Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
|
3 |
1181 |
sfurman |
Contributed by Damjan Lampret (lampret@opencores.org).
|
4 |
|
|
|
5 |
1183 |
sfurman |
This file is part of or1k_gen_isa, or1ksim, GDB and GAS.
|
6 |
1181 |
sfurman |
|
7 |
1183 |
sfurman |
This program 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 2 of the License, or
|
10 |
|
|
(at your option) any later version.
|
11 |
1181 |
sfurman |
|
12 |
1183 |
sfurman |
This program is distributed in the hope that it will be useful,
|
13 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
|
|
GNU General Public License for more details.
|
16 |
1181 |
sfurman |
|
17 |
1183 |
sfurman |
You should have received a copy of the GNU General Public License
|
18 |
|
|
along with this program; if not, write to the Free Software
|
19 |
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
20 |
1181 |
sfurman |
|
21 |
|
|
/* We treat all letters the same in encode/decode routines so
|
22 |
1183 |
sfurman |
we need to assign some characteristics to them like signess etc.*/
|
23 |
1181 |
sfurman |
|
24 |
|
|
#ifndef OR32_H_ISA
|
25 |
|
|
#define OR32_H_ISA
|
26 |
|
|
|
27 |
|
|
#define NUM_UNSIGNED (0)
|
28 |
|
|
#define NUM_SIGNED (1)
|
29 |
|
|
|
30 |
|
|
#ifndef PARAMS
|
31 |
|
|
#define PARAMS(x) x
|
32 |
|
|
#endif
|
33 |
|
|
|
34 |
1183 |
sfurman |
#ifndef CONST
|
35 |
|
|
#define CONST const
|
36 |
|
|
#endif
|
37 |
|
|
|
38 |
1181 |
sfurman |
#define MAX_GPRS 32
|
39 |
|
|
#define PAGE_SIZE 4096
|
40 |
|
|
#undef __HALF_WORD_INSN__
|
41 |
|
|
|
42 |
|
|
#define OPERAND_DELIM (',')
|
43 |
|
|
|
44 |
|
|
#define OR32_IF_DELAY (1)
|
45 |
|
|
#define OR32_W_FLAG (2)
|
46 |
|
|
#define OR32_R_FLAG (4)
|
47 |
|
|
|
48 |
1183 |
sfurman |
struct or32_letter {
|
49 |
1181 |
sfurman |
char letter;
|
50 |
|
|
int sign;
|
51 |
1183 |
sfurman |
/* int reloc; relocation per letter ??*/
|
52 |
1181 |
sfurman |
};
|
53 |
|
|
|
54 |
|
|
/* Main instruction specification array. */
|
55 |
1183 |
sfurman |
struct or32_opcode {
|
56 |
1181 |
sfurman |
/* Name of the instruction. */
|
57 |
|
|
char *name;
|
58 |
|
|
|
59 |
|
|
/* A string of characters which describe the operands.
|
60 |
|
|
Valid characters are:
|
61 |
|
|
,() Itself. Characters appears in the assembly code.
|
62 |
|
|
rA Register operand.
|
63 |
|
|
rB Register operand.
|
64 |
|
|
rD Register operand.
|
65 |
|
|
I An immediate operand, range -32768 to 32767.
|
66 |
|
|
J An immediate operand, range . (unused)
|
67 |
|
|
K An immediate operand, range 0 to 65535.
|
68 |
|
|
L An immediate operand, range 0 to 63.
|
69 |
|
|
M An immediate operand, range . (unused)
|
70 |
|
|
N An immediate operand, range -33554432 to 33554431.
|
71 |
1183 |
sfurman |
O An immediate operand, range . (unused) */
|
72 |
1181 |
sfurman |
char *args;
|
73 |
1183 |
sfurman |
|
74 |
|
|
/* Opcode and operand encoding. */
|
75 |
1181 |
sfurman |
char *encoding;
|
76 |
1183 |
sfurman |
|
77 |
|
|
#if defined HAS_EXECUTION && !SIMPLE_EXECUTION
|
78 |
|
|
char *function_name;
|
79 |
|
|
#else /* defined HAS_EXECUTION && !SIMPLE_EXECUTION */
|
80 |
|
|
void (*exec)(void);
|
81 |
|
|
#endif /* defined HAS_EXECUTION && !SIMPLE_EXECUTION */
|
82 |
|
|
|
83 |
1181 |
sfurman |
unsigned int flags;
|
84 |
|
|
};
|
85 |
|
|
|
86 |
|
|
#define OPTYPE_LAST (0x80000000)
|
87 |
|
|
#define OPTYPE_OP (0x40000000)
|
88 |
|
|
#define OPTYPE_REG (0x20000000)
|
89 |
|
|
#define OPTYPE_SIG (0x10000000)
|
90 |
|
|
#define OPTYPE_DIS (0x08000000)
|
91 |
|
|
#define OPTYPE_DST (0x04000000)
|
92 |
|
|
#define OPTYPE_SBIT (0x00001F00)
|
93 |
|
|
#define OPTYPE_SHR (0x0000001F)
|
94 |
|
|
#define OPTYPE_SBIT_SHR (8)
|
95 |
|
|
|
96 |
|
|
/* MM: Data how to decode operands. */
|
97 |
1183 |
sfurman |
extern struct insn_op_struct {
|
98 |
1181 |
sfurman |
unsigned long type;
|
99 |
|
|
unsigned long data;
|
100 |
|
|
} **op_start;
|
101 |
|
|
|
102 |
|
|
#ifdef HAS_EXECUTION
|
103 |
1183 |
sfurman |
extern void l_invalid PARAMS((void));
|
104 |
|
|
extern void l_sfne PARAMS((void));
|
105 |
|
|
extern void l_bf PARAMS((void));
|
106 |
|
|
extern void l_add PARAMS((void));
|
107 |
|
|
extern void l_sw PARAMS((void));
|
108 |
|
|
extern void l_sb PARAMS((void));
|
109 |
|
|
extern void l_sh PARAMS((void));
|
110 |
|
|
extern void l_lwz PARAMS((void));
|
111 |
|
|
extern void l_lbs PARAMS((void));
|
112 |
|
|
extern void l_lbz PARAMS((void));
|
113 |
|
|
extern void l_lhs PARAMS((void));
|
114 |
|
|
extern void l_lhz PARAMS((void));
|
115 |
|
|
extern void l_movhi PARAMS((void));
|
116 |
|
|
extern void l_and PARAMS((void));
|
117 |
|
|
extern void l_or PARAMS((void));
|
118 |
|
|
extern void l_xor PARAMS((void));
|
119 |
|
|
extern void l_sub PARAMS((void));
|
120 |
|
|
extern void l_mul PARAMS((void));
|
121 |
|
|
extern void l_div PARAMS((void));
|
122 |
|
|
extern void l_divu PARAMS((void));
|
123 |
|
|
extern void l_sll PARAMS((void));
|
124 |
|
|
extern void l_sra PARAMS((void));
|
125 |
|
|
extern void l_srl PARAMS((void));
|
126 |
|
|
extern void l_j PARAMS((void));
|
127 |
|
|
extern void l_jal PARAMS((void));
|
128 |
|
|
extern void l_jalr PARAMS((void));
|
129 |
|
|
extern void l_jr PARAMS((void));
|
130 |
|
|
extern void l_rfe PARAMS((void));
|
131 |
|
|
extern void l_nop PARAMS((void));
|
132 |
|
|
extern void l_bnf PARAMS((void));
|
133 |
|
|
extern void l_sfeq PARAMS((void));
|
134 |
|
|
extern void l_sfgts PARAMS((void));
|
135 |
|
|
extern void l_sfges PARAMS((void));
|
136 |
|
|
extern void l_sflts PARAMS((void));
|
137 |
|
|
extern void l_sfles PARAMS((void));
|
138 |
|
|
extern void l_sfgtu PARAMS((void));
|
139 |
|
|
extern void l_sfgeu PARAMS((void));
|
140 |
|
|
extern void l_sfltu PARAMS((void));
|
141 |
|
|
extern void l_sfleu PARAMS((void));
|
142 |
|
|
extern void l_extbs PARAMS((void));
|
143 |
|
|
extern void l_extbz PARAMS((void));
|
144 |
|
|
extern void l_exths PARAMS((void));
|
145 |
|
|
extern void l_exthz PARAMS((void));
|
146 |
|
|
extern void l_extws PARAMS((void));
|
147 |
|
|
extern void l_extwz PARAMS((void));
|
148 |
|
|
extern void l_mtspr PARAMS((void));
|
149 |
|
|
extern void l_mfspr PARAMS((void));
|
150 |
|
|
extern void l_sys PARAMS((void));
|
151 |
|
|
extern void l_trap PARAMS((void)); /* CZ 21/06/01 */
|
152 |
|
|
extern void l_macrc PARAMS((void));
|
153 |
|
|
extern void l_mac PARAMS((void));
|
154 |
|
|
extern void l_msb PARAMS((void));
|
155 |
|
|
extern void l_invalid PARAMS((void));
|
156 |
|
|
extern void l_cmov PARAMS ((void));
|
157 |
|
|
extern void l_cust1 PARAMS ((void));
|
158 |
|
|
extern void l_cust2 PARAMS ((void));
|
159 |
|
|
extern void l_cust3 PARAMS ((void));
|
160 |
|
|
extern void l_cust4 PARAMS ((void));
|
161 |
|
|
extern void lf_add_s PARAMS ((void));
|
162 |
|
|
extern void lf_div_s PARAMS ((void));
|
163 |
|
|
extern void lf_ftoi_s PARAMS ((void));
|
164 |
|
|
extern void lf_itof_s PARAMS ((void));
|
165 |
|
|
extern void lf_madd_s PARAMS ((void));
|
166 |
|
|
extern void lf_mul_s PARAMS ((void));
|
167 |
|
|
extern void lf_rem_s PARAMS ((void));
|
168 |
|
|
extern void lf_sfeq_s PARAMS ((void));
|
169 |
|
|
extern void lf_sfge_s PARAMS ((void));
|
170 |
|
|
extern void lf_sfgt_s PARAMS ((void));
|
171 |
|
|
extern void lf_sfle_s PARAMS ((void));
|
172 |
|
|
extern void lf_sflt_s PARAMS ((void));
|
173 |
|
|
extern void lf_sfne_s PARAMS ((void));
|
174 |
|
|
extern void lf_sub_s PARAMS((void));
|
175 |
1181 |
sfurman |
#endif
|
176 |
1183 |
sfurman |
extern void l_none PARAMS((void));
|
177 |
1181 |
sfurman |
|
178 |
1183 |
sfurman |
extern CONST struct or32_letter or32_letters[];
|
179 |
1181 |
sfurman |
|
180 |
1183 |
sfurman |
extern CONST struct or32_opcode or32_opcodes[];
|
181 |
1181 |
sfurman |
|
182 |
1183 |
sfurman |
extern CONST int num_opcodes;
|
183 |
1181 |
sfurman |
|
184 |
1183 |
sfurman |
/* Calculates instruction length in bytes. Always 4 for OR32. */
|
185 |
|
|
extern int insn_len PARAMS((int insn_index));
|
186 |
1181 |
sfurman |
|
187 |
1183 |
sfurman |
/* Is individual insn's operand signed or unsigned? */
|
188 |
|
|
extern int letter_signed PARAMS((char l));
|
189 |
1181 |
sfurman |
|
190 |
1183 |
sfurman |
/* Number of letters in the individual lettered operand. */
|
191 |
|
|
extern int letter_range PARAMS((char l));
|
192 |
1181 |
sfurman |
|
193 |
|
|
/* MM: Returns index of given instruction name. */
|
194 |
1183 |
sfurman |
extern int insn_index PARAMS((char *insn));
|
195 |
1181 |
sfurman |
|
196 |
|
|
/* MM: Returns instruction name from index. */
|
197 |
1183 |
sfurman |
extern CONST char *insn_name PARAMS ((int index));
|
198 |
1181 |
sfurman |
|
199 |
|
|
/* MM: Constructs new FSM, based on or32_opcodes. */
|
200 |
|
|
extern void build_automata PARAMS ((void));
|
201 |
|
|
|
202 |
|
|
/* MM: Destructs FSM. */
|
203 |
|
|
extern void destruct_automata PARAMS ((void));
|
204 |
|
|
|
205 |
|
|
/* MM: Decodes instruction using FSM. Call build_automata first. */
|
206 |
1183 |
sfurman |
extern int insn_decode PARAMS((unsigned int insn));
|
207 |
1181 |
sfurman |
|
208 |
|
|
/* Disassemble one instruction from insn to disassemble.
|
209 |
|
|
Return the size of the instruction. */
|
210 |
1183 |
sfurman |
int disassemble_insn (unsigned long insn);
|
211 |
1181 |
sfurman |
|
212 |
1183 |
sfurman |
/* Disassemble one instruction from insn index.
|
213 |
|
|
Return the size of the instruction. */
|
214 |
|
|
int disassemble_index (unsigned long insn, int index);
|
215 |
|
|
|
216 |
|
|
/* FOR INTERNAL USE ONLY */
|
217 |
|
|
/* Automatically does zero- or sign- extension and also finds correct
|
218 |
|
|
sign bit position if sign extension is correct extension. Which extension
|
219 |
|
|
is proper is figured out from letter description. */
|
220 |
|
|
unsigned long extend_imm(unsigned long imm, char l);
|
221 |
|
|
|
222 |
|
|
/* Extracts value from opcode */
|
223 |
|
|
unsigned long or32_extract(char param_ch, char *enc_initial, unsigned long insn);
|
224 |
|
|
|
225 |
1181 |
sfurman |
#endif
|
226 |
1183 |
sfurman |
|