OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [include/] [opcode/] [or32.h] - Blame information for rev 225

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
/* Table of opcodes for the OpenRISC 1000 ISA.
2
   Copyright 2002, 2003 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, 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
#define MAX_GPRS 32
31 225 jeremybenn
#define PAGE_SIZE 8192
32 24 jeremybenn
#undef __HALF_WORD_INSN__
33
 
34
#define OPERAND_DELIM (',')
35
 
36
#define OR32_IF_DELAY (1)
37
#define OR32_W_FLAG   (2)
38
#define OR32_R_FLAG   (4)
39
 
40 225 jeremybenn
#if defined(HAS_EXECUTION)
41
# if SIMPLE_EXECUTION
42
#  include "simpl32_defs.h"
43
# elif DYNAMIC_EXECUTION
44
#  include "dyn32_defs.h"
45
# else
46
extern void l_none (void);
47
# endif
48
#else
49
extern void l_none (void);
50
#endif
51
 
52 24 jeremybenn
struct or32_letter
53
{
54
  char letter;
55
  int  sign;
56
  /* int  reloc; relocation per letter ??  */
57
};
58
 
59 225 jeremybenn
enum insn_type {
60
  it_unknown,
61
  it_exception,
62
  it_arith,
63
  it_shift,
64
  it_compare,
65
  it_branch,
66
  it_jump,
67
  it_load,
68
  it_store,
69
  it_movimm,
70
  it_move,
71
  it_extend,
72
  it_nop,
73
  it_mac,
74
  it_float };
75
 
76 24 jeremybenn
/* Main instruction specification array.  */
77
struct or32_opcode
78
{
79
  /* Name of the instruction.  */
80
  char *name;
81
 
82
  /* A string of characters which describe the operands.
83
     Valid characters are:
84
     ,() Itself.  Characters appears in the assembly code.
85
     rA  Register operand.
86
     rB  Register operand.
87
     rD  Register operand.
88
     I   An immediate operand, range -32768 to 32767.
89
     J   An immediate operand, range . (unused)
90
     K   An immediate operand, range 0 to 65535.
91
     L   An immediate operand, range 0 to 63.
92
     M   An immediate operand, range . (unused)
93
     N   An immediate operand, range -33554432 to 33554431.
94
     O   An immediate operand, range . (unused).  */
95
  char *args;
96
 
97
  /* Opcode and operand encoding.  */
98
  char *encoding;
99 225 jeremybenn
 
100
#ifdef HAS_EXECUTION
101
# if COMPLEX_EXECUTION
102
  char *function_name;
103
# elif SIMPLE_EXECUTION
104
  void (*exec)(struct iqueue_entry *);
105
# else /* DYNAMIC_EXECUTION */
106
  void (*exec)(struct op_queue *opq, int param_t[3], orreg_t param[3], int);
107
# endif
108
#else  /* HAS_EXECUTION */
109
  void (*exec)(void);
110
#endif
111
 
112 24 jeremybenn
  unsigned int flags;
113 225 jeremybenn
  enum insn_type func_unit;
114 24 jeremybenn
};
115
 
116
#define OPTYPE_LAST (0x80000000)
117
#define OPTYPE_OP   (0x40000000)
118
#define OPTYPE_REG  (0x20000000)
119
#define OPTYPE_SIG  (0x10000000)
120
#define OPTYPE_DIS  (0x08000000)
121
#define OPTYPE_DST  (0x04000000)
122
#define OPTYPE_SBIT (0x00001F00)
123
#define OPTYPE_SHR  (0x0000001F)
124
#define OPTYPE_SBIT_SHR (8)
125
 
126
/* MM: Data how to decode operands.  */
127
extern struct insn_op_struct
128
{
129
  unsigned long type;
130
  unsigned long data;
131
} **op_start;
132
 
133 225 jeremybenn
/* Leaf flag used in automata building */
134
#define LEAF_FLAG         (0x80000000)
135 24 jeremybenn
 
136 225 jeremybenn
struct temp_insn_struct
137
{
138
  unsigned long insn;
139
  unsigned long insn_mask;
140
  int in_pass;
141
};
142
 
143
extern unsigned long *automata;
144
extern struct temp_insn_struct *ti;
145
 
146 24 jeremybenn
extern const struct or32_letter or32_letters[];
147
 
148
extern const struct  or32_opcode or32_opcodes[];
149
 
150
extern const unsigned int or32_num_opcodes;
151
 
152
/* Calculates instruction length in bytes.  Always 4 for OR32.  */
153
extern int insn_len (int);
154
 
155
/* Is individual insn's operand signed or unsigned?  */
156
extern int letter_signed (char);
157
 
158
/* Number of letters in the individual lettered operand.  */
159
extern int letter_range (char);
160
 
161
/* MM: Returns index of given instruction name.  */
162
extern int insn_index (char *);
163
 
164
/* MM: Returns instruction name from index.  */
165
extern const char *insn_name (int);
166
 
167
/* MM: Constructs new FSM, based on or32_opcodes.  */
168
extern void build_automata (void);
169
 
170
/* MM: Destructs FSM.  */
171
extern void destruct_automata (void);
172
 
173
/* MM: Decodes instruction using FSM.  Call build_automata first.  */
174
extern int insn_decode (unsigned int);
175
 
176
/* Disassemble one instruction from insn to disassemble.
177
   Return the size of the instruction.  */
178
int disassemble_insn (unsigned long);
179
 
180 225 jeremybenn
/* Extract instruction */
181
extern unsigned long insn_extract(char,char*);
182
 
183
/* Disassemble one instruction from insn index.
184
   Return the size of the instruction.  */
185
int disassemble_index (unsigned long,int);
186
 
187
/* FOR INTERNAL USE ONLY */
188
/* Automatically does zero- or sign- extension and also finds correct
189
   sign bit position if sign extension is correct extension. Which extension
190
   is proper is figured out from letter description. */
191
unsigned long extend_imm(unsigned long,char);
192
 
193 24 jeremybenn
#endif

powered by: WebSVN 2.1.0

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