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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [gdb-5.3/] [sim/] [ppc/] [ld-insn.h] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1181 sfurman
/*  This file is part of the program psim.
2
 
3
    Copyright (C) 1994,1995,1996, Andrew Cagney <cagney@highland.com.au>
4
 
5
    This program is free software; you can redistribute it and/or modify
6
    it under the terms of the GNU General Public License as published by
7
    the Free Software Foundation; either version 2 of the License, or
8
    (at your option) any later version.
9
 
10
    This program is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
    GNU General Public License for more details.
14
 
15
    You should have received a copy of the GNU General Public License
16
    along with this program; if not, write to the Free Software
17
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
 
19
    */
20
 
21
/*
22
#   --
23
#
24
#
25
# Fields:
26
#
27
#       1       Instruction format as a `start-bit,content' pairs.
28
#               the content is one of a digit, field name or `/' (aka.0)
29
#
30
#       2       Format specifier
31
#
32
#       3       Flags:  64 - 64bit only
33
#                       f - floating point enabled required
34
#
35
#       4       short name
36
#
37
#       5       Description
38
#
39
#
40
# For flags marked 'model', the fields are interpreted as follows:
41
#
42
#       1       Not used
43
#
44
#       2       Not used
45
#
46
#       3       "macro"
47
#
48
#       4       String name for model
49
#
50
#       5       Specific CPU model, must be an identifier
51
#
52
#       6       Comma separated list of functional units
53
 
54
*/
55
 
56
 
57
/* Global constants */
58
 
59
enum {
60
  max_insn_bit_size = 32,
61
};
62
 
63
 
64
typedef struct _insn_field insn_field;
65
struct _insn_field {
66
  int first;
67
  int last;
68
  int width;
69
  int is_int;
70
  int is_slash;
71
  int is_string;
72
  int val_int;
73
  char *pos_string;
74
  char *val_string;
75
  insn_field *next;
76
  insn_field *prev;
77
};
78
 
79
typedef struct _insn_fields insn_fields;
80
struct _insn_fields {
81
  insn_field *bits[max_insn_bit_size];
82
  insn_field *first;
83
  insn_field *last;
84
  unsigned value;
85
};
86
 
87
 
88
/****************************************************************/
89
 
90
typedef struct _opcode_field opcode_field;
91
struct _opcode_field {
92
  int first;
93
  int last;
94
  int is_boolean;
95
  unsigned boolean_constant;
96
  opcode_field *parent;
97
};
98
 
99
 
100
/****************************************************************/
101
 
102
typedef struct _insn_bits insn_bits;
103
struct _insn_bits {
104
  int is_expanded;
105
  int value;
106
  insn_field *field;
107
  opcode_field *opcode;
108
  insn_bits *last;
109
};
110
 
111
 
112
/****************************************************************/
113
 
114
 
115
typedef enum {
116
  insn_format,
117
  insn_form,
118
  insn_flags,
119
  insn_mnemonic,
120
  insn_name,
121
  insn_comment,
122
  nr_insn_table_fields
123
} insn_table_fields;
124
 
125
typedef enum {
126
  function_type = insn_format,
127
  function_name = insn_name,
128
  function_param = insn_comment
129
} function_table_fields;
130
 
131
typedef enum {
132
  model_name = insn_mnemonic,
133
  model_identifer = insn_name,
134
  model_default = insn_comment,
135
} model_table_fields;
136
 
137
typedef enum {
138
  include_flags = insn_flags,
139
  include_path = insn_name,
140
} model_include_fields;
141
 
142
typedef struct _insn insn;
143
struct _insn {
144
  table_entry *file_entry;
145
  insn_fields *fields;
146
  insn *next;
147
};
148
 
149
typedef struct _insn_undef insn_undef;
150
struct _insn_undef {
151
  insn_undef *next;
152
  char *name;
153
};
154
 
155
typedef struct _model model;
156
struct _model {
157
  model *next;
158
  char *name;
159
  char *printable_name;
160
  char *insn_default;
161
  table_model_entry *func_unit_start;
162
  table_model_entry *func_unit_end;
163
};
164
 
165
typedef struct _insn_table insn_table;
166
struct _insn_table {
167
  int opcode_nr;
168
  insn_bits *expanded_bits;
169
  int nr_insn;
170
  insn *insns;
171
  insn *functions;
172
  insn *last_function;
173
  decode_table *opcode_rule;
174
  opcode_field *opcode;
175
  int nr_entries;
176
  insn_table *entries;
177
  insn_table *sibling;
178
  insn_table *parent;
179
};
180
 
181
typedef enum {
182
  insn_model_name,
183
  insn_model_fields,
184
  nr_insn_model_table_fields
185
} insn_model_table_fields;
186
 
187
 
188
extern insn_table *load_insn_table
189
(const char *file_name,
190
 decode_table *decode_rules,
191
 filter *filters,
192
 table_include *includes);
193
 
194
model *models;
195
model *last_model;
196
 
197
insn *model_macros;
198
insn *last_model_macro;
199
 
200
insn *model_functions;
201
insn *last_model_function;
202
 
203
insn *model_internal;
204
insn *last_model_internal;
205
 
206
insn *model_static;
207
insn *last_model_static;
208
 
209
insn *model_data;
210
insn *last_model_data;
211
 
212
int max_model_fields_len;
213
 
214
extern void insn_table_insert_insn
215
(insn_table *table,
216
 table_entry *file_entry,
217
 insn_fields *fields);
218
 
219
 
220
/****************************************************************/
221
 
222
/****************************************************************/
223
 
224
typedef void leaf_handler
225
(insn_table *entry,
226
 lf *file,
227
 void *data,
228
 int depth);
229
 
230
typedef void insn_handler
231
(insn_table *table,
232
 lf *file,
233
 void *data,
234
 insn *instruction,
235
 int depth);
236
 
237
typedef void padding_handler
238
(insn_table *table,
239
 lf *file,
240
 void *data,
241
 int depth,
242
 int opcode_nr);
243
 
244
 
245
extern void insn_table_traverse_tree
246
(insn_table *table,
247
 lf *file,
248
 void *data,
249
 int depth,
250
 leaf_handler *start,
251
 insn_handler *handler,
252
 leaf_handler *end,
253
 padding_handler *padding);
254
 
255
 
256
extern void insn_table_traverse_insn
257
(insn_table *table,
258
 lf *file,
259
 void *data,
260
 insn_handler *handler);
261
 
262
 
263
 
264
/****************************************************************/
265
 
266
typedef void function_handler
267
(insn_table *table,
268
 lf *file,
269
 void *data,
270
 table_entry *function);
271
 
272
extern void
273
insn_table_traverse_function
274
(insn_table *table,
275
 lf *file,
276
 void *data,
277
 function_handler *leaf);
278
 
279
/****************************************************************/
280
 
281
 
282
 
283
extern void insn_table_expand_insns
284
(insn_table *table);
285
 
286
extern int insn_table_depth
287
(insn_table *table);

powered by: WebSVN 2.1.0

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