1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
|
/* This file is part of the program psim.
Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* code-generation options: */
typedef enum {
/* Transfer control to an instructions semantic code using the the
standard call/return mechanism */
generate_calls,
/* Transfer control to an instructions semantic code using
(computed) goto's instead of the more conventional call/return
mechanism */
generate_jumps,
} igen_code;
typedef enum {
nia_is_cia_plus_one,
nia_is_void,
nia_is_invalid,
} igen_nia;
typedef struct _igen_gen_options igen_gen_options;
struct _igen_gen_options {
int direct_access;
int semantic_icache;
int insn_in_icache;
int conditional_issue;
int slot_verification;
int delayed_branch;
/* If zeroing a register, which one? */
int zero_reg;
int zero_reg_nr;
/* should multiple simulators be generated? */
int multi_sim;
/* should the simulator support multi word instructions and if so,
what is the max nr of words. */
int multi_word;
/* SMP? Should the generated code include SMP support (>0) and if
so, for how many processors? */
int smp;
/* how should the next instruction address be computed? */
igen_nia nia;
/* nr of instructions in the decoded instruction cache */
int icache;
int icache_size;
/* see above */
igen_code code;
};
typedef struct _igen_trace_options igen_trace_options;
struct _igen_trace_options {
int rule_selection;
int rule_rejection;
int entries;
int combine;
};
typedef struct _igen_prefix_name {
char *name;
char *uname;
} igen_prefix_name;
typedef struct _igen_prefix_options {
igen_prefix_name global;
igen_prefix_name engine;
igen_prefix_name icache;
igen_prefix_name idecode;
igen_prefix_name itable;
igen_prefix_name semantics;
igen_prefix_name support;
} igen_prefix_options;
typedef struct _igen_decode_options igen_decode_options ;
struct _igen_decode_options {
/* Combine tables? Should the generator make a second pass through
each generated table looking for any sub-entries that contain the
same instructions. Those entries being merged into a single
table */
int combine;
/* Instruction expansion? Should the semantic code for each
instruction, when the oportunity arrises, be expanded according
to the variable opcode files that the instruction decode process
renders constant */
int duplicate;
/* Treat reserved fields as constant (zero) instead of ignoring
their value when determining decode tables */
int zero_reserved;
/* Convert any padded switch rules into goto_switch */
int switch_as_goto;
/* Force all tables to be generated with this lookup mechanism */
char *overriding_gen;
};
typedef struct _igen_warn_options igen_warn_options;
struct _igen_warn_options {
int discard;
};
typedef struct _igen_options igen_options;
struct _igen_options {
/* What does the instruction look like - bit ordering, size, widths or
offesets */
int hi_bit_nr;
int insn_bit_size;
int insn_specifying_widths;
/* what should global names be prefixed with? */
igen_prefix_options prefix;
/* See above for options and flags */
igen_gen_options gen;
/* See above for trace options */
igen_trace_options trace;
/* See above for decode options */
igen_decode_options decode;
/* Filter set to be used on the flag field of the instruction table */
filter *flags_filter;
/* See above for warn options */
igen_warn_options warn;
/* Be more picky about the input */
error_func (*warning);
/* Model (processor) set - like flags_filter. Used to select the
specific ISA within a processor family. */
filter *model_filter;
/* Format name set */
filter *format_name_filter;
};
extern igen_options options;
/* default options - hopefully backward compatible */ \
#define INIT_OPTIONS(OPTIONS) \
do { \
memset (&(OPTIONS), 0, sizeof (OPTIONS)); \
memset (&(OPTIONS).warn, -1, sizeof ((OPTIONS).warn)); \
(OPTIONS).hi_bit_nr = 0; \
(OPTIONS).insn_bit_size = default_insn_bit_size; \
(OPTIONS).insn_specifying_widths = 0; \
(OPTIONS).prefix.global.name = ""; \
(OPTIONS).prefix.global.uname = ""; \
(OPTIONS).prefix.engine = (OPTIONS).prefix.global; \
(OPTIONS).prefix.icache = (OPTIONS).prefix.global; \
(OPTIONS).prefix.idecode = (OPTIONS).prefix.global; \
(OPTIONS).prefix.itable = (OPTIONS).prefix.global; \
(OPTIONS).prefix.semantics = (OPTIONS).prefix.global; \
(OPTIONS).prefix.support = (OPTIONS).prefix.global; \
(OPTIONS).gen.code = generate_calls; \
(OPTIONS).gen.icache_size = 1024; \
(OPTIONS).warning = warning; \
} while (0)
|