OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [stable_0_2_0_rc1/] [gdb-5.0/] [opcodes/] [or32.h] - Blame information for rev 1344

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 133 markom
/* Table of opcodes for the OpenRISC 1000 ISA.
2 676 markom
   Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
3 133 markom
   Contributed by Damjan Lampret (lampret@opencores.org).
4
 
5 676 markom
This file is part of or1k_gen_isa, or1ksim, GDB and GAS.
6 133 markom
 
7 676 markom
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 133 markom
 
12 676 markom
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 133 markom
 
17 676 markom
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 133 markom
 
21
/* We treat all letters the same in encode/decode routines so
22 676 markom
   we need to assign some characteristics to them like signess etc.*/
23 133 markom
 
24
#ifndef OR32_H_ISA
25
#define OR32_H_ISA
26
 
27 138 markom
#define NUM_UNSIGNED (0)
28
#define NUM_SIGNED (1)
29 133 markom
 
30
#ifndef PARAMS
31
#define PARAMS(x) x
32
#endif
33
 
34
#ifndef CONST
35
#define CONST const
36
#endif
37
 
38 138 markom
#define MAX_GPRS 32
39 1256 phoenix
#define PAGE_SIZE 8192
40 138 markom
#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 676 markom
struct or32_letter {
49 371 markom
  char letter;
50
  int  sign;
51 676 markom
  /* int  reloc; relocation per letter ??*/
52 133 markom
};
53
 
54 1344 nogj
enum insn_type {
55
 it_unknown,
56
 it_exception,
57
 it_arith,
58
 it_shift,
59
 it_compare,
60
 it_branch,
61
 it_jump,
62
 it_load,
63
 it_store,
64
 it_movimm,
65
 it_move,
66
 it_extend,
67
 it_nop,
68
 it_mac,
69
 it_float };
70
 
71 138 markom
/* Main instruction specification array.  */
72 676 markom
struct or32_opcode {
73 133 markom
  /* Name of the instruction.  */
74
  char *name;
75
 
76
  /* A string of characters which describe the operands.
77
     Valid characters are:
78
     ,() Itself.  Characters appears in the assembly code.
79
     rA  Register operand.
80
     rB  Register operand.
81 1341 nogj
     rD  Register operand (destination).
82 133 markom
     I   An immediate operand, range -32768 to 32767.
83
     J   An immediate operand, range . (unused)
84
     K   An immediate operand, range 0 to 65535.
85
     L   An immediate operand, range 0 to 63.
86
     M   An immediate operand, range . (unused)
87
     N   An immediate operand, range -33554432 to 33554431.
88 676 markom
     O   An immediate operand, range . (unused) */
89 133 markom
  char *args;
90 706 markom
 
91 676 markom
  /* Opcode and operand encoding. */
92 133 markom
  char *encoding;
93 706 markom
 
94 1342 nogj
#ifdef HAS_EXECUTION
95
# if !SIMPLE_EXECUTION
96 706 markom
  char *function_name;
97 1342 nogj
# else /* !SIMPLE_EXECUTION */
98
  void (*exec)(struct iqueue_entry *);
99
# endif
100
#else  /* HAS_EXECUTION */
101
  void (*exec)(void);
102
#endif
103 706 markom
 
104 133 markom
  unsigned int flags;
105 1344 nogj
  enum insn_type func_unit;
106 133 markom
};
107
 
108 1341 nogj
/* This operand is the last in the list */
109 138 markom
#define OPTYPE_LAST (0x80000000)
110 1341 nogj
/* This operand marks the end of the operand sequence (for things like I(rD)) */
111 138 markom
#define OPTYPE_OP   (0x40000000)
112 1341 nogj
/* The operand specifies a register index */
113 138 markom
#define OPTYPE_REG  (0x20000000)
114 1341 nogj
/* The operand must be sign extended */
115 138 markom
#define OPTYPE_SIG  (0x10000000)
116 1341 nogj
/* Operand is a relative address, the `I' in `I(rD)' */
117 138 markom
#define OPTYPE_DIS  (0x08000000)
118 1341 nogj
/* The operand is a destination */
119 138 markom
#define OPTYPE_DST  (0x04000000)
120 1341 nogj
/* Which bit of the operand is the sign bit */
121 138 markom
#define OPTYPE_SBIT (0x00001F00)
122 1341 nogj
/* Amount to shift the instruction word right to get the operand */
123 138 markom
#define OPTYPE_SHR  (0x0000001F)
124
#define OPTYPE_SBIT_SHR (8)
125
 
126
/* MM: Data how to decode operands.  */
127 676 markom
extern struct insn_op_struct {
128 138 markom
  unsigned long type;
129
  unsigned long data;
130
} **op_start;
131
 
132 1342 nogj
/* Leaf flag used in automata building */
133
#define LEAF_FLAG         (0x80000000)
134
 
135
struct temp_insn_struct
136
{
137
  unsigned long insn;
138
  unsigned long insn_mask;
139
  int in_pass;
140
};
141
 
142
extern unsigned long *automata;
143
extern struct temp_insn_struct *ti;
144
 
145
#if defined(HAS_EXECUTION) && SIMPLE_EXECUTION
146
extern void l_invalid PARAMS((struct iqueue_entry *));
147
extern void l_sfne PARAMS((struct iqueue_entry *));
148
extern void l_bf PARAMS((struct iqueue_entry *));
149
extern void l_add PARAMS((struct iqueue_entry *));
150
extern void l_addc PARAMS((struct iqueue_entry *));
151
extern void l_sw PARAMS((struct iqueue_entry *));
152
extern void l_sb PARAMS((struct iqueue_entry *));
153
extern void l_sh PARAMS((struct iqueue_entry *));
154
extern void l_lwz PARAMS((struct iqueue_entry *));
155
extern void l_lbs PARAMS((struct iqueue_entry *));
156
extern void l_lbz PARAMS((struct iqueue_entry *));
157
extern void l_lhs PARAMS((struct iqueue_entry *));
158
extern void l_lhz PARAMS((struct iqueue_entry *));
159
extern void l_movhi PARAMS((struct iqueue_entry *));
160
extern void l_and PARAMS((struct iqueue_entry *));
161
extern void l_or PARAMS((struct iqueue_entry *));
162
extern void l_xor PARAMS((struct iqueue_entry *));
163
extern void l_sub PARAMS((struct iqueue_entry *));
164
extern void l_mul PARAMS((struct iqueue_entry *));
165
extern void l_div PARAMS((struct iqueue_entry *));
166
extern void l_divu PARAMS((struct iqueue_entry *));
167
extern void l_sll PARAMS((struct iqueue_entry *));
168
extern void l_sra PARAMS((struct iqueue_entry *));
169
extern void l_srl PARAMS((struct iqueue_entry *));
170
extern void l_j PARAMS((struct iqueue_entry *));
171
extern void l_jal PARAMS((struct iqueue_entry *));
172
extern void l_jalr PARAMS((struct iqueue_entry *));
173
extern void l_jr PARAMS((struct iqueue_entry *));
174
extern void l_rfe PARAMS((struct iqueue_entry *));
175
extern void l_nop PARAMS((struct iqueue_entry *));
176
extern void l_bnf PARAMS((struct iqueue_entry *));
177
extern void l_sfeq PARAMS((struct iqueue_entry *));
178
extern void l_sfgts PARAMS((struct iqueue_entry *));
179
extern void l_sfges PARAMS((struct iqueue_entry *));
180
extern void l_sflts PARAMS((struct iqueue_entry *));
181
extern void l_sfles PARAMS((struct iqueue_entry *));
182
extern void l_sfgtu PARAMS((struct iqueue_entry *));
183
extern void l_sfgeu PARAMS()(struct iqueue_entry *);
184
extern void l_sfltu PARAMS((struct iqueue_entry *));
185
extern void l_sfleu PARAMS((struct iqueue_entry *));
186
extern void l_extbs PARAMS((struct iqueue_entry *));
187
extern void l_extbz PARAMS((struct iqueue_entry *));
188
extern void l_exths PARAMS((struct iqueue_entry *));
189
extern void l_exthz PARAMS((struct iqueue_entry *));
190
extern void l_extws PARAMS((struct iqueue_entry *));
191
extern void l_extwz PARAMS((struct iqueue_entry *));
192
extern void l_mtspr PARAMS((struct iqueue_entry *));
193
extern void l_mfspr PARAMS((struct iqueue_entry *));
194
extern void l_sys PARAMS((struct iqueue_entry *));
195
extern void l_trap PARAMS((struct iqueue_entry *)); /* CZ 21/06/01 */
196
extern void l_macrc PARAMS((struct iqueue_entry *));
197
extern void l_mac PARAMS((struct iqueue_entry *));
198
extern void l_msb PARAMS((struct iqueue_entry *));
199
extern void l_invalid PARAMS((struct iqueue_entry *));
200
extern void l_cmov PARAMS ((struct iqueue_entry *));
201
extern void l_ff1 PARAMS ((struct iqueue_entry *));
202
extern void l_cust1 PARAMS ((struct iqueue_entry *));
203
extern void l_cust2 PARAMS ((struct iqueue_entry *));
204
extern void l_cust3 PARAMS ((struct iqueue_entry *));
205
extern void l_cust4 PARAMS ((struct iqueue_entry *));
206
extern void lf_add_s PARAMS ((struct iqueue_entry *));
207
extern void lf_div_s PARAMS ((struct iqueue_entry *));
208
extern void lf_ftoi_s PARAMS ((struct iqueue_entry *));
209
extern void lf_itof_s PARAMS ((struct iqueue_entry *));
210
extern void lf_madd_s PARAMS ((struct iqueue_entry *));
211
extern void lf_mul_s PARAMS ((struct iqueue_entry *));
212
extern void lf_rem_s PARAMS ((struct iqueue_entry *));
213
extern void lf_sfeq_s PARAMS ((struct iqueue_entry *));
214
extern void lf_sfge_s PARAMS ((struct iqueue_entry *));
215
extern void lf_sfgt_s PARAMS ((struct iqueue_entry *));
216
extern void lf_sfle_s PARAMS ((struct iqueue_entry *));
217
extern void lf_sflt_s PARAMS ((struct iqueue_entry *));
218
extern void lf_sfne_s PARAMS ((struct iqueue_entry *));
219
extern void lf_sub_s PARAMS((struct iqueue_entry *));
220
extern void l_none PARAMS((struct iqueue_entry *));
221
#else
222
extern void l_none PARAMS((void));
223 133 markom
#endif
224
 
225 676 markom
extern CONST struct or32_letter or32_letters[];
226 133 markom
 
227 676 markom
extern CONST struct  or32_opcode or32_opcodes[];
228 133 markom
 
229 680 ivang
extern CONST int num_opcodes;
230 133 markom
 
231 676 markom
/* Calculates instruction length in bytes.  Always 4 for OR32. */
232
extern int insn_len PARAMS((int insn_index));
233 133 markom
 
234 676 markom
/* Is individual insn's operand signed or unsigned? */
235
extern int letter_signed PARAMS((char l));
236 133 markom
 
237 676 markom
/* Number of letters in the individual lettered operand. */
238
extern int letter_range PARAMS((char l));
239 133 markom
 
240
/* MM: Returns index of given instruction name.  */
241 676 markom
extern int insn_index PARAMS((char *insn));
242 133 markom
 
243 138 markom
/* MM: Returns instruction name from index.  */
244 676 markom
extern CONST char *insn_name PARAMS ((int index));
245 138 markom
 
246
/* MM: Constructs new FSM, based on or32_opcodes.  */
247
extern void build_automata PARAMS ((void));
248
 
249
/* MM: Destructs FSM.  */
250
extern void destruct_automata PARAMS ((void));
251
 
252
/* MM: Decodes instruction using FSM.  Call build_automata first.  */
253 676 markom
extern int insn_decode PARAMS((unsigned int insn));
254 138 markom
 
255 371 markom
/* Disassemble one instruction from insn to disassemble.
256
   Return the size of the instruction.  */
257 676 markom
int disassemble_insn (unsigned long insn);
258 371 markom
 
259 703 markom
/* Disassemble one instruction from insn index.
260
   Return the size of the instruction.  */
261
int disassemble_index (unsigned long insn, int index);
262
 
263 879 markom
/* FOR INTERNAL USE ONLY */
264
/* Automatically does zero- or sign- extension and also finds correct
265
   sign bit position if sign extension is correct extension. Which extension
266
   is proper is figured out from letter description. */
267
unsigned long extend_imm(unsigned long imm, char l);
268
 
269
/* Extracts value from opcode */
270
unsigned long or32_extract(char param_ch, char *enc_initial, unsigned long insn);
271
 
272 133 markom
#endif
273 676 markom
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.