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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [binutils/] [binutils-2.16.1/] [include/] [opcode/] [or32.h] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1616 phoenix
/* Table of opcodes for the OpenRISC 1000 ISA.
2
   Copyright 1990, 1991, 1992, 1993, 2005 Free Software Foundation, Inc.
3
   Contributed by Damjan Lampret (lampret@opencores.org).
4
 
5
This file is part of or1k_gen_isa, or1ksim, GDB and GAS.
6
 
7
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
 
12
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
 
17
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
 
21
/* We treat all letters the same in encode/decode routines so
22
   we need to assign some characteristics to them like signess etc.*/
23
 
24
#ifndef OR32_H_ISA
25
#define OR32_H_ISA
26
 
27
#define NUM_UNSIGNED (0)
28
#define NUM_SIGNED (1)
29
 
30
#ifndef CONST
31
#define CONST const
32
#endif
33
 
34
#define MAX_GPRS 32
35
#define PAGE_SIZE 8192
36
#undef __HALF_WORD_INSN__
37
 
38
#define OPERAND_DELIM (',')
39
 
40
#define OR32_IF_DELAY (1)
41
#define OR32_W_FLAG   (2)
42
#define OR32_R_FLAG   (4)
43
 
44
#if defined(HAS_EXECUTION)
45
# if SIMPLE_EXECUTION
46
#  include "simpl32_defs.h"
47
# elif DYNAMIC_EXECUTION
48
#  include "dyn32_defs.h"
49
# else
50
extern void l_none (void);
51
# endif
52
#else
53
extern void l_none (void);
54
#endif
55
 
56
 
57
struct or32_letter {
58
  char letter;
59
  int  sign;
60
  /* int  reloc; relocation per letter ??*/
61
};
62
 
63
enum insn_type {
64
 it_unknown,
65
 it_exception,
66
 it_arith,
67
 it_shift,
68
 it_compare,
69
 it_branch,
70
 it_jump,
71
 it_load,
72
 it_store,
73
 it_movimm,
74
 it_move,
75
 it_extend,
76
 it_nop,
77
 it_mac,
78
 it_float };
79
 
80
/* Main instruction specification array.  */
81
struct or32_opcode {
82
  /* Name of the instruction.  */
83
  char *name;
84
 
85
  /* A string of characters which describe the operands.
86
     Valid characters are:
87
     ,() Itself.  Characters appears in the assembly code.
88
     rA  Register operand.
89
     rB  Register operand.
90
     rD  Register operand (destination).
91
     I   An immediate operand, range -32768 to 32767.
92
     J   An immediate operand, range . (unused)
93
     K   An immediate operand, range 0 to 65535.
94
     L   An immediate operand, range 0 to 63.
95
     M   An immediate operand, range . (unused)
96
     N   An immediate operand, range -33554432 to 33554431.
97
     O   An immediate operand, range . (unused) */
98
  char *args;
99
 
100
  /* Opcode and operand encoding. */
101
  char *encoding;
102
 
103
#ifdef HAS_EXECUTION
104
# if COMPLEX_EXECUTION
105
  char *function_name;
106
# elif SIMPLE_EXECUTION
107
  void (*exec)(struct iqueue_entry *);
108
# else /* DYNAMIC_EXECUTION */
109
  void (*exec)(struct op_queue *opq, int param_t[3], orreg_t param[3], int);
110
# endif
111
#else  /* HAS_EXECUTION */
112
  void (*exec)(void);
113
#endif
114
 
115
  unsigned int flags;
116
  enum insn_type func_unit;
117
};
118
 
119
/* This operand is the last in the list */
120
#define OPTYPE_LAST (0x80000000)
121
/* This operand marks the end of the operand sequence (for things like I(rD)) */
122
#define OPTYPE_OP   (0x40000000)
123
/* The operand specifies a register index */
124
#define OPTYPE_REG  (0x20000000)
125
/* The operand must be sign extended */
126
#define OPTYPE_SIG  (0x10000000)
127
/* Operand is a relative address, the `I' in `I(rD)' */
128
#define OPTYPE_DIS  (0x08000000)
129
/* The operand is a destination */
130
#define OPTYPE_DST  (0x04000000)
131
/* Which bit of the operand is the sign bit */
132
#define OPTYPE_SBIT (0x00001F00)
133
/* Amount to shift the instruction word right to get the operand */
134
#define OPTYPE_SHR  (0x0000001F)
135
#define OPTYPE_SBIT_SHR (8)
136
 
137
/* MM: Data how to decode operands.  */
138
extern struct insn_op_struct {
139
  unsigned long type;
140
  unsigned long data;
141
} **op_start;
142
 
143
/* Leaf flag used in automata building */
144
#define LEAF_FLAG         (0x80000000)
145
 
146
struct temp_insn_struct
147
{
148
  unsigned long insn;
149
  unsigned long insn_mask;
150
  int in_pass;
151
};
152
 
153
extern unsigned long *automata;
154
extern struct temp_insn_struct *ti;
155
 
156
extern CONST struct or32_letter or32_letters[];
157
 
158
extern CONST struct  or32_opcode or32_opcodes[];
159
 
160
extern CONST int num_opcodes;
161
 
162
/* Calculates instruction length in bytes.  Always 4 for OR32. */
163
extern int insn_len (int insn_index);
164
 
165
/* Is individual insn's operand signed or unsigned? */
166
extern int letter_signed (char l);
167
 
168
/* Number of letters in the individual lettered operand. */
169
extern int letter_range (char l);
170
 
171
/* MM: Returns index of given instruction name.  */
172
extern int insn_index (char *insn);
173
 
174
/* MM: Returns instruction name from index.  */
175
extern CONST char *insn_name (int index);
176
 
177
/* MM: Constructs new FSM, based on or32_opcodes.  */
178
extern void build_automata (void);
179
 
180
/* MM: Destructs FSM.  */
181
extern void destruct_automata (void);
182
 
183
/* MM: Decodes instruction using FSM.  Call build_automata first.  */
184
extern int insn_decode (unsigned int insn);
185
 
186
/* Extract instruction */
187
extern unsigned long insn_extract(char param_ch,char *enc_initial);
188
 
189
/* Disassemble one instruction from insn to disassemble.
190
   Return the size of the instruction.  */
191
int disassemble_insn (unsigned long insn);
192
 
193
/* Disassemble one instruction from insn index.
194
   Return the size of the instruction.  */
195
int disassemble_index (unsigned long insn, int index);
196
 
197
/* FOR INTERNAL USE ONLY */
198
/* Automatically does zero- or sign- extension and also finds correct
199
   sign bit position if sign extension is correct extension. Which extension
200
   is proper is figured out from letter description. */
201
unsigned long extend_imm(unsigned long imm, char l);
202
 
203
#endif

powered by: WebSVN 2.1.0

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