1 /* The IGEN simulator generator for GDB, the GNU Debugger.
3 Copyright 2002, 2007, 2008, 2009 Free Software Foundation, Inc.
5 Contributed by Andrew Cagney.
7 This file is part of GDB.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 /* code-generation options: */
28 /* Transfer control to an instructions semantic code using the the
29 standard call/return mechanism */
33 /* Transfer control to an instructions semantic code using
34 (computed) goto's instead of the more conventional call/return
52 typedef struct _igen_gen_options igen_gen_options;
53 struct _igen_gen_options
58 int conditional_issue;
59 int slot_verification;
62 /* If zeroing a register, which one? */
66 /* should multiple simulators be generated? */
69 /* name of the default multi-sim model */
72 /* should the simulator support multi word instructions and if so,
73 what is the max nr of words. */
76 /* SMP? Should the generated code include SMP support (>0) and if
77 so, for how many processors? */
80 /* how should the next instruction address be computed? */
83 /* nr of instructions in the decoded instruction cache */
92 typedef struct _igen_trace_options igen_trace_options;
93 struct _igen_trace_options
103 typedef struct _igen_name
109 typedef struct _igen_module
116 typedef struct _igen_module_options
123 igen_module semantics;
128 typedef struct _igen_decode_options igen_decode_options;
129 struct _igen_decode_options
132 /* Combine tables? Should the generator make a second pass through
133 each generated table looking for any sub-entries that contain the
134 same instructions. Those entries being merged into a single
138 /* Instruction expansion? Should the semantic code for each
139 instruction, when the oportunity arrises, be expanded according
140 to the variable opcode files that the instruction decode process
144 /* Treat reserved fields as constant (zero) instead of ignoring
145 their value when determining decode tables */
148 /* Convert any padded switch rules into goto_switch */
151 /* Force all tables to be generated with this lookup mechanism */
152 char *overriding_gen;
156 typedef struct _igen_warn_options igen_warn_options;
157 struct _igen_warn_options
160 /* Issue warning about discarded instructions */
163 /* Issue warning about invalid instruction widths */
166 /* Issue warning about unimplemented instructions */
173 typedef struct _igen_options igen_options;
177 /* What does the instruction look like - bit ordering, size, widths or
181 int insn_specifying_widths;
183 /* what should global names be prefixed with? */
184 igen_module_options module;
186 /* See above for options and flags */
187 igen_gen_options gen;
189 /* See above for trace options */
190 igen_trace_options trace;
192 /* See above for include options */
193 table_include *include;
195 /* See above for decode options */
196 igen_decode_options decode;
198 /* Filter set to be used on the flag field of the instruction table */
199 filter *flags_filter;
201 /* See above for warn options */
202 igen_warn_options warn;
204 /* Be more picky about the input */
205 error_func (*warning);
207 /* Model (processor) set - like flags_filter. Used to select the
208 specific ISA within a processor family. */
209 filter *model_filter;
211 /* Format name set */
212 filter *format_name_filter;
215 extern igen_options options;
217 /* default options - hopefully backward compatible */
218 #define INIT_OPTIONS() \
220 memset (&options, 0, sizeof options); \
221 memset (&options.warn, -1, sizeof (options.warn)); \
222 options.hi_bit_nr = 0; \
223 options.insn_bit_size = default_insn_bit_size; \
224 options.insn_specifying_widths = 0; \
225 options.module.global.prefix.u = ""; \
226 options.module.global.prefix.l = ""; \
228 options.module.engine = options.module.global; \
229 options.module.icache = options.module.global; \
230 options.module.idecode = options.module.global; \
231 options.module.itable = options.module.global; \
232 options.module.semantics = options.module.global; \
233 options.module.support = options.module.global; \
235 options.module.engine.suffix.l = "engine"; \
236 options.module.engine.suffix.u = "ENGINE"; \
237 options.module.icache.suffix.l = "icache"; \
238 options.module.icache.suffix.u = "ICACHE"; \
239 options.module.idecode.suffix.l = "idecode"; \
240 options.module.idecode.suffix.u = "IDECODE"; \
241 options.module.itable.suffix.l = "itable"; \
242 options.module.itable.suffix.u = "ITABLE"; \
243 options.module.semantics.suffix.l = "semantics"; \
244 options.module.semantics.suffix.u = "SEMANTICS"; \
245 options.module.support.suffix.l = "support"; \
246 options.module.support.suffix.u = "SUPPORT"; \
248 options.gen.code = generate_calls; \
249 options.gen.icache_size = 1024; \
250 options.warning = warning; \